浏览代码

Merge branch 'yb5.3'

jwyu 2 年之前
父节点
当前提交
036dbf9c58
共有 1 个文件被更改,包括 16 次插入5 次删除
  1. 16 5
      src/components/QuestionComment.vue

+ 16 - 5
src/components/QuestionComment.vue

@@ -48,7 +48,7 @@ const openCommentHandle = () => {
         show: true,
         commentList: [],
         comment_content: '',
-        default_type: 1,//默认精选
+        default_type: 1,//默认全部
     }
     getComment(1)
 }
@@ -67,6 +67,15 @@ const getComment = async(type) => {
     
     if(code !== 200) return
     dataInfo.value.commentInfo.commentList = data.list || [];
+    if(type===1){//更新列表中展示的全部评论
+        const temarr=data.list || []
+        dataInfo.value.comment_list=temarr.map(item=>{
+            return {
+                comment:item.content,
+                qa_avatar_url:item.qa_avatar_url
+            }
+        })
+    }
     comment_total.value = {
         hot_num: data.hot_total,
         my_num: data.my_total
@@ -78,7 +87,7 @@ const closeComment = () => {
         show: false,
         commentList: [],
         comment_content: '',
-        default_type: 1,//默认精选
+        default_type: 1,//默认全部
     }
 }
 /* 校验昵称状态*/
@@ -104,7 +113,9 @@ const publishMessageHandle = async() => {
     commentInfo.comment_content = '';
 
     // 在我的评论tab下刷数据
-    commentInfo.default_type === 2 && getComment(2)
+    // commentInfo.default_type === 2 && getComment(2)
+    //刷新评论数据
+    getComment(dataInfo.value.commentInfo.default_type)
 
 }
 
@@ -160,7 +171,7 @@ const delCommentHandle = ({community_question_comment_id},index) => {
             <text style="min-width:50px;">{{dataInfo.like_total || ''}}</text>
         </view>
     </div>
-    <!-- 精选留言模块 -->
+    <!-- 全部留言模块 -->
     <div class="hot-comment-wrap" v-if="dataInfo.commentInfo&&!dataInfo.commentInfo.show&&dataInfo.comment_list.length>0">
         <template v-for="(item,index) in dataInfo.comment_list" :key="index">
             <img class="avatar" :src="item.qa_avatar_url" alt="">
@@ -192,7 +203,7 @@ const delCommentHandle = ({community_question_comment_id},index) => {
 
         <div class="list-cont">
             <ul class="list-tab">
-                <li :class="dataInfo.commentInfo.default_type===1 && 'act'" @click="getComment(1)">精选评论({{comment_total.hot_num}})</li>
+                <li :class="dataInfo.commentInfo.default_type===1 && 'act'" @click="getComment(1)">全部评论({{comment_total.hot_num}})</li>
                 <li :class="dataInfo.commentInfo.default_type===2 && 'act'" @click="getComment(2)">我的评论({{comment_total.my_num}})</li>
             </ul>
             <ul class="list-ul" v-if="dataInfo.commentInfo.commentList.length">