<template>
	<view class="detail-page-container">
		<dynamic-item :form="form" @refresh="handleRefresh" @deleteSuccess="deleteSuccess"></dynamic-item>
		<!-- 评论管理区 -->
		<comment-item  :form="form" ></comment-item>
	</view>
</template>

<script>
	import DynamicItem from '@/components/Dynamic-Item.vue';
	import CommentItem from '../../components/Comment-Item.vue';
	import {dynamicDetail,dynamicDetailComments} from '@/api/api.js'
	export default {
		data() {
			return {
				momentId:'',
				form:{},
				queryParams:{
					pageNum:1,
					pageSize:10,
					momentId:''
				},
				commentList:[]
			}
		},
		onLoad(options){
			let {momentId} = options;
			this.momentId = momentId;
			this.queryParams.momentId = momentId
			this.getDetail()
		},
		components: {
			DynamicItem,
			CommentItem
		},
		methods: {
			handleRefresh(){
				this.getDetail();
			},
			getDetail(){
				dynamicDetail(this.momentId).then(res=>{
					if(res.code == 200){
						this.form = {...res.data}
					}
				})
			},
			deleteSuccess(){
				history.go(-1)
			}
		}
	}
</script>

<style lang="scss">
@import '@/static/styles/common.scss';
</style>