Merge branch 'feature/comment-0624-ch' into msb_test

fix/comment-0701
ch 2 years ago
commit f04113a6d8

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-24 11:43:04 * @Date: 2022-06-24 11:43:04
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-29 18:41:01 * @LastEditTime: 2022-06-29 19:22:24
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -17,7 +17,8 @@
<span>{{commentDetail.skuName}}</span> <span>{{commentDetail.skuName}}</span>
</div> </div>
<main> <main>
<BsCommentSubmit v-if="!commentDetail.id" :commentDetail="commentDetail" @submit="handleSubmit"/> <BsCommentSubmit v-if="!commentDetail.id" :commentDetail="commentDetail" @submit="handleSubmit"
@editStatusChange="editStatusChange"/>
<template v-else> <template v-else>
<div class="top"> <div class="top">
<el-rate :value="commentDetail.commentScore" disabled/> <el-rate :value="commentDetail.commentScore" disabled/>
@ -31,8 +32,9 @@
<!-- 追评 --> <!-- 追评 -->
<UiButton class="follow-btn" type="yellow_line" radius="4px" <UiButton class="follow-btn" type="yellow_line" radius="4px"
v-if="isCanFollowComment && !showFollowForm" @click="showFollowForm = true">发起追评</UiButton> v-if="isCanFollowComment && !showFollowForm" @click="showFollowForm = true">发起追评</UiButton>
<BsCommentSubmit v-if="showFollowForm && !followComment" :type="COMMENT.TYPE.FOLLOW_COMMENT" <BsCommentSubmit v-if="showFollowForm && !followComment" :type="COMMENT.TYPE.FOLLOW_COMMENT"
:commentDetail="commentDetail" @submit="handleSubmitFollow"/> :commentDetail="commentDetail" @submit="handleSubmitFollow" @editStatusChange="editStatusChange"/>
<BsCommentFollowInfo v-if="followComment" <BsCommentFollowInfo v-if="followComment"
:followComment="followComment" :commentTime="commentDetail.commentTime"/> :followComment="followComment" :commentTime="commentDetail.commentTime"/>
@ -41,7 +43,7 @@
<div class="operation"> <div class="operation">
<div> <div>
<span class="operation--chat" @click="answerVisible = !answerVisible"> <span class="operation--chat" @click="answerVisible = !answerVisible">
<template v-if="commentDetail.replyCount">{{commentDetail.replyCount}}</template> <template v-if="replyCount">{{replyCount}}</template>
</span> </span>
<span class="operation--show" v-if="answerCommentList.length" @click="answerVisible = !answerVisible"> <span class="operation--show" v-if="answerCommentList.length" @click="answerVisible = !answerVisible">
{{answerVisible ? '收起' : '展开'}} {{answerVisible ? '收起' : '展开'}}
@ -52,7 +54,7 @@
<!-- 评论内容 --> <!-- 评论内容 -->
<div class="answer" v-if="showAnswerBox"> <div class="answer" v-if="showAnswerBox">
<b class="answer--title">全部评论({{commentDetail.replyCount}})</b> <b class="answer--title">全部评论({{replyCount}})</b>
<ul> <ul>
<li class="answer--item" v-if="commentDetail.merchantComment"> <li class="answer--item" v-if="commentDetail.merchantComment">
<div class="answer--name"><b>{{commentDetail.merchantComment.userName}}</b><span>{{commentDetail.merchantComment.createTime}}</span></div> <div class="answer--name"><b>{{commentDetail.merchantComment.userName}}</b><span>{{commentDetail.merchantComment.createTime}}</span></div>
@ -118,6 +120,7 @@ export default {
answer : null, answer : null,
isLike : false, isLike : false,
usefulCount : 0, usefulCount : 0,
replyCount : this.commentDetail.replyCount,
showFollowForm : this.isFollowForm, showFollowForm : this.isFollowForm,
followComment : this.commentDetail.followComment || null followComment : this.commentDetail.followComment || null
@ -146,6 +149,7 @@ export default {
watch:{ watch:{
commentDetail(){ commentDetail(){
this.followComment = this.commentDetail.followComment; this.followComment = this.commentDetail.followComment;
this.replyCount = this.commentDetail.replyCount || 0;
this.answerCommentList = this.commentDetail.answerCommentList || []; this.answerCommentList = this.commentDetail.answerCommentList || [];
this.isLike = this.commentDetail.isLike; this.isLike = this.commentDetail.isLike;
this.usefulCount = this.commentDetail.usefulCount; this.usefulCount = this.commentDetail.usefulCount;
@ -201,6 +205,7 @@ export default {
parentName: this.answer ? this.answer.userName : '' parentName: this.answer ? this.answer.userName : ''
}); });
this.answerContent = ''; this.answerContent = '';
this.replyCount++;
this.$message.success('评论成功!'); this.$message.success('评论成功!');
}, },
/** /**
@ -231,6 +236,12 @@ export default {
}); });
this.commentDetail.isLike = this.isLike; this.commentDetail.isLike = this.isLike;
},
/**
* 动态监听是否有输入内容的评价或追评
*/
editStatusChange(val){
this.$emit('editStatusChange', val)
} }
} }
} }

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-25 15:29:43 * @Date: 2022-06-25 15:29:43
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-29 18:06:08 * @LastEditTime: 2022-06-29 19:23:57
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -56,6 +56,9 @@ export default {
} }
}, },
computed:{ computed:{
isEdit(){
return (this.commentContent || this.fileList.length > 0) ? true : false
},
reteDesc(){ reteDesc(){
return COMMENT.RATE_LEVEL[this.rate]; return COMMENT.RATE_LEVEL[this.rate];
}, },
@ -70,6 +73,11 @@ export default {
return status; return status;
} }
}, },
watch : {
isEdit(val){
this.$emit('editStatusChange', val)
}
},
methods : { methods : {
async handleSubmit(){ async handleSubmit(){
let data = { let data = {
@ -89,6 +97,8 @@ export default {
this.$message.error(error.message); this.$message.error(error.message);
return false; return false;
} }
this.commentContent = '';
this.fileList = [];
this.$emit('submit',result); this.$emit('submit',result);
}, },

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-27 11:46:34 * @Date: 2022-06-27 11:46:34
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-29 11:53:25 * @LastEditTime: 2022-06-29 19:27:26
* @Description: file content * @Description: file content
--> -->
<template> <template>
@ -17,7 +17,7 @@
<UiLoading v-if="loading"></UiLoading> <UiLoading v-if="loading"></UiLoading>
<BsCommentInfo v-else source="comment" :isFollowForm="isFollow" v-for="(item, idx) in list" :key="idx" <BsCommentInfo v-else source="comment" :isFollowForm="isFollow" v-for="(item, idx) in list" :key="idx"
:commentDetail="item" @submit="handleSubmitComment($event, idx)" :commentDetail="item" @submit="handleSubmitComment($event, idx)"
@submitFollow="handleSubmitFollow($event, idx)"/> @submitFollow="handleSubmitFollow($event, idx)" @editStatusChange="editChange($event, idx)"/>
</div> </div>
</div> </div>
</template> </template>
@ -47,9 +47,36 @@ export default {
if(this.orderId){ if(this.orderId){
this.getOrderCommentDetail(); this.getOrderCommentDetail();
}else if(this.commentId){ }else if(this.commentId){
this.getCommentDetail() this.getCommentDetail();
} }
}, },
beforeRouteLeave(to, from, next) {
if(this.list.findIndex(i => i.isEdit) > -1){
this.$confirm('你正在进行商品评价,退出后评价的内容将不保存!','提示').then(()=>{
next()
}).catch(()=>{
})
}
// if (to.params.status) {
// next();
// } else {
// this.$confirm(" , bom, ", "", {
// confirmButtonText: "",
// cancelButtonText: "",
// type: "warning",
// })
// .then(() => {
// this.deleteFile();//
// next();
// })
// .catch(() => {
// // alert("router")
// });
// }
},
methods:{ methods:{
/** /**
* 按订单查询评价详情 * 按订单查询评价详情
@ -94,6 +121,10 @@ export default {
// this.$router.replace('/account/comment/success'); // this.$router.replace('/account/comment/success');
} }
}, },
editChange(isEdit, idx){
this.$set(this.list[idx], 'isEdit', isEdit);
},
} }
} }
</script> </script>

Loading…
Cancel
Save