|
|
@ -2,12 +2,12 @@
|
|
|
|
* @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-28 21:34:32
|
|
|
|
* @LastEditTime: 2022-06-29 11:52:30
|
|
|
|
* @Description: file content
|
|
|
|
* @Description: file content
|
|
|
|
-->
|
|
|
|
-->
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div class="comment-info">
|
|
|
|
<div class="comment-info">
|
|
|
|
<div class="side-user" v-if="type == 'detail'">
|
|
|
|
<div class="side-user" v-if="source == 'detail'">
|
|
|
|
<el-avatar :size="55" :src="commentDetail.userAvatar" />
|
|
|
|
<el-avatar :size="55" :src="commentDetail.userAvatar" />
|
|
|
|
<p>{{commentDetail.userName}}</p>
|
|
|
|
<p>{{commentDetail.userName}}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -30,7 +30,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 追评 -->
|
|
|
|
<!-- 追评 -->
|
|
|
|
<UiButton class="follow-btn" type="yellow_line" radius="4px"
|
|
|
|
<UiButton class="follow-btn" type="yellow_line" radius="4px"
|
|
|
|
v-if="isCanFollowComment && !showFollowForm" @click="handleShowFollowForm">发起追评</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"/>
|
|
|
|
|
|
|
|
|
|
|
@ -41,7 +41,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="answerCommentList.length">{{answerCount}}条</template>评论
|
|
|
|
<template v-if="commentDetail.replyCount">{{commentDetail.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 +52,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 评论内容 -->
|
|
|
|
<!-- 评论内容 -->
|
|
|
|
<div class="answer" v-if="showAnswerBox">
|
|
|
|
<div class="answer" v-if="showAnswerBox">
|
|
|
|
<b class="answer--title">全部评论({{answerCount}})</b>
|
|
|
|
<b class="answer--title">全部评论({{commentDetail.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>
|
|
|
@ -93,9 +93,16 @@ import {COMMENT} from '@/constants'
|
|
|
|
export default {
|
|
|
|
export default {
|
|
|
|
components: { BsCommentFollowInfo, UiImgs, UiButton, BsCommentSubmit },
|
|
|
|
components: { BsCommentFollowInfo, UiImgs, UiButton, BsCommentSubmit },
|
|
|
|
props:{
|
|
|
|
props:{
|
|
|
|
type:{
|
|
|
|
// 来源 comment从我的订单来是需要操作评价,detail游客从商品中来只要显示评价详情
|
|
|
|
|
|
|
|
source:{
|
|
|
|
type : String,
|
|
|
|
type : String,
|
|
|
|
default : 'detail' // comment默认显示评价状态,follow默认追评状态 detail 查看状态
|
|
|
|
default : 'comment'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
// 是否默认打开追评,只有在无追评时有用
|
|
|
|
|
|
|
|
isFollowForm : {
|
|
|
|
|
|
|
|
type : Boolean,
|
|
|
|
|
|
|
|
default : false,
|
|
|
|
|
|
|
|
require : true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
commentDetail : {
|
|
|
|
commentDetail : {
|
|
|
|
type : Object,
|
|
|
|
type : Object,
|
|
|
@ -111,7 +118,7 @@ export default {
|
|
|
|
answer : null,
|
|
|
|
answer : null,
|
|
|
|
isLike : false,
|
|
|
|
isLike : false,
|
|
|
|
usefulCount : 0,
|
|
|
|
usefulCount : 0,
|
|
|
|
showFollowForm : this.type === 'follow' ? true : false,
|
|
|
|
showFollowForm : this.isFollowForm,
|
|
|
|
followComment : this.commentDetail.followComment || null
|
|
|
|
followComment : this.commentDetail.followComment || null
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -120,13 +127,6 @@ export default {
|
|
|
|
showAnswerBox(){
|
|
|
|
showAnswerBox(){
|
|
|
|
return (this.commentDetail.merchantComment || this.answerVisible) ? true : false
|
|
|
|
return (this.commentDetail.merchantComment || this.answerVisible) ? true : false
|
|
|
|
},
|
|
|
|
},
|
|
|
|
answerCount(){
|
|
|
|
|
|
|
|
let count = this.answerCommentList.length;
|
|
|
|
|
|
|
|
if(this.commentDetail.merchantComment){
|
|
|
|
|
|
|
|
count += 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return count
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
answerPlaceholder (){
|
|
|
|
answerPlaceholder (){
|
|
|
|
return this.answer ? `回复:${this.answer.userName}` : '说点什么吧?'
|
|
|
|
return this.answer ? `回复:${this.answer.userName}` : '说点什么吧?'
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -136,15 +136,10 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 是否需要显示追评按钮
|
|
|
|
* 是否需要显示追评按钮
|
|
|
|
* 如果是在订单里进来的,则只要判断没有追评则显示
|
|
|
|
* 如果是在订单里进来的,且没有追评则显示
|
|
|
|
* 如果在商品中看则需要这条评论是不是当前登录用户评论的,如果是则也可以追评
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
isCanFollowComment(){
|
|
|
|
isCanFollowComment(){
|
|
|
|
let status = false;
|
|
|
|
let status = (!this.followComment && this.source === 'comment')
|
|
|
|
const userId = this.$store.state.userInfo.id;
|
|
|
|
|
|
|
|
if(!this.followComment && (this.type !== 'detail' || this.commentDetail.userId === userId)){
|
|
|
|
|
|
|
|
status = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return status;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -165,18 +160,6 @@ export default {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
handleSubmit(result){
|
|
|
|
handleSubmit(result){
|
|
|
|
this.$emit('submit', result)
|
|
|
|
this.$emit('submit', result)
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 点击追评
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
handleShowFollowForm(){
|
|
|
|
|
|
|
|
if(this.type !== 'detail'){
|
|
|
|
|
|
|
|
this.showFollowForm = true;
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
this.$router.push(`/account/comment?commentId=${this.commentDetail.id}`);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 追评提交成功,抛出事件,方便父组件做数据处理
|
|
|
|
* 追评提交成功,抛出事件,方便父组件做数据处理
|
|
|
|