feature/comment-0615-ch
ch 2 years ago
parent 74df08bdb4
commit b028e0a2a4

@ -46,28 +46,28 @@
:src="item" :src="item"
/> />
</div> </div>
<template v-if="state.detailData.followComment"> <template v-if="state.followComment">
<b class="comment--title"> <b class="comment--title">
用户追评 用户追评
<small>{{ state.detailData.followComment.createTime }}</small> <small>{{ state.followComment.createTime }}</small>
</b> </b>
<p class="comment--ctx">{{ state.detailData.followComment.commentContent }}</p> <p class="comment--ctx">{{ state.followComment.commentContent }}</p>
</template> </template>
</div> </div>
<template v-if="state.detailData.merchantComment"> <template v-if="state.merchantComment">
<div class="title"> <div class="title">
<b>商家{{ state.detailData.merchantComment.userName }} 回复</b> <b>商家{{ state.merchantComment.userName }} 回复</b>
<span>{{ state.detailData.merchantComment.createTime }}</span> <span>{{ state.merchantComment.createTime }}</span>
</div> </div>
<p class="reply--ctx">{{ state.detailData.merchantComment.commentContent }}</p> <p class="reply--ctx">{{ state.merchantComment.commentContent }}</p>
<br /> <br />
</template> </template>
<div class="title"> <div class="title">
<b>全部回复{{ state.detailData.answerCommentList?.length || 0 }}</b> <b>全部回复{{ state.answerCommentList?.length || 0 }}</b>
</div> </div>
<ul class="reply" v-if="state.detailData.answerCommentList?.length"> <ul class="reply" v-if="state.answerCommentList?.length">
<li class="reply--item" v-for="item in state.detailData.answerCommentList" :key="item.id"> <li class="reply--item" v-for="item in state.answerCommentList" :key="item.id">
<div class="reply--title"> <div class="reply--title">
{{ item.userName }} {{ item.userName }}
<span v-if="item.parentId !== state.detailData.id"> {{ item.parentUserName }}</span> <span v-if="item.parentId !== state.detailData.id"> {{ item.parentUserName }}</span>
@ -95,7 +95,7 @@
</li> </li>
</ul> </ul>
<div class="reply__emtpy" v-else></div> <div class="reply__emtpy" v-else></div>
<div class="footer" v-if="!state.detailData.merchantComment"> <div class="footer" v-if="!state.merchantComment">
<textarea <textarea
class="footer--textarea" class="footer--textarea"
ref="$textarea" ref="$textarea"
@ -124,6 +124,9 @@
reply: {}, reply: {},
isSubmit: false, isSubmit: false,
detailData: {}, detailData: {},
answerCommentList: [],
followComment: {},
merchantComment: {},
}); });
// //
const sbumitDisabled = computed(() => { const sbumitDisabled = computed(() => {
@ -136,9 +139,16 @@
const getDetail = async () => { const getDetail = async () => {
state.detailData = {}; state.detailData = {};
state.answerCommentList = [];
state.followComment = {};
state.merchantComment = {};
const res = await store.dispatch('comment/getDetail', route.params.id); const res = await store.dispatch('comment/getDetail', route.params.id);
if (res) { if (res) {
state.detailData = _.cloneDeep(store.state.comment.detail); state.detailData = _.cloneDeep(store.state.comment.detail);
state.answerCommentList = state.detailData.answerCommentList;
state.followComment = state.detailData.followComment;
state.merchantComment = state.detailData.merchantComment;
if (state.detailData.pictureUrl) { if (state.detailData.pictureUrl) {
state.detailData.pictureUrl = state.detailData.pictureUrl.split(','); state.detailData.pictureUrl = state.detailData.pictureUrl.split(',');
} }
@ -191,7 +201,7 @@
ElMessage.success('回复成功!'); ElMessage.success('回复成功!');
state.isSubmit = false; state.isSubmit = false;
state.commentContent = ''; state.commentContent = '';
state.detailData.answerCommentList.push({ state.answerCommentList.push({
...res, ...res,
isShow: true, isShow: true,
}); });

Loading…
Cancel
Save