jwyu hace 2 años
padre
commit
405c39f127
Se han modificado 2 ficheros con 21 adiciones y 16 borrados
  1. 13 12
      pages/video/components/comment.vue
  2. 8 4
      pages/video/videoSearch.vue

+ 13 - 12
pages/video/components/comment.vue

@@ -15,10 +15,10 @@
             </view>
         </view>
         <view class="list-commnet-box" v-if="info.comment_list.length>0">
-            <view class="item" v-for="(item,index) in info.comment_list" :key="index">
+            <template class="item" v-for="(item,index) in info.comment_list" >
                 <image class="avatar" :src="item.qa_avatar_url" mode="aspectFill" lazy-load="false" :key="index"/>
 				<text :key="index">{{item.comment}}</text>
-            </view>
+            </template>
               
         </view>
           
@@ -70,7 +70,7 @@
 </template>
 
 <script>
-import {apiSetLike,apiHotComment,apiMyComment} from '@/api/question'
+import {apiSetLike,apiHotComment,apiMyComment,apiPublishComment,apiDelComment} from '@/api/question'
 export default {
     props:{
         videoInfo:null
@@ -143,11 +143,12 @@ export default {
                         qa_avatar_url:item.qa_avatar_url
                     }
                 })
+                this.info.comment_total=arr.length
             }
         },
 
         //删除我的评论
-        delCommentHandle(){
+        delCommentHandle({community_question_comment_id},index){
             wx.showModal({
                 title: "",
                 content: "评论删除后不可恢复,确认删除吗?",
@@ -155,14 +156,14 @@ export default {
                 cancelColor: '#333',
                 success:  async(res) => {
                     if( res.cancel) return
-                    // const { code } = await apiDelComment({ community_question_comment_id });
-                    // if( code !== 200 ) return
+                    const { code } = await apiDelComment({ community_question_comment_id });
+                    if( code !== 200 ) return
                     
-                    // this.commentList.splice(index,1)
-                    // this.comment_obj.total--
+                    this.commentList.splice(index,1)
+                    this.comment_obj.total--
                                 
-                    // wx.showToast({title: '删除成功'});
-                    // this.refreshPage()
+                    wx.showToast({title: '删除成功'});
+                    this.getComment('refresh')
                 }
             })
         },
@@ -237,7 +238,7 @@ export default {
     margin-top: 34rpx;
     background-color: #F9F9F9;
     padding: 20rpx;
-    .item{
+    // .item{
         color: #666;
 		font-size: 28rpx;
         .avatar{
@@ -252,7 +253,7 @@ export default {
 			line-height: 56rpx;
 			margin-right: 20rpx;
 		}
-    }
+    // }
 }
 .comment-cont {
 	height: calc(100vh - 250rpx);

+ 8 - 4
pages/video/videoSearch.vue

@@ -29,6 +29,7 @@
                     :data-item="item">
                     <image class="share-img" src="@/static/share-icon.png" mode="aspectFill"/>
                 </button>
+                <view class="time">发布时间:{{item.publish_time}}</view>
                 <video
                     autoplay
                     object-fit="contain"
@@ -41,7 +42,7 @@
                     v-if="item.community_video_id==curVideoId"
                 ></video>
                 <image @click="handelClickPlay(item)" v-else class="poster" :src="item.cover_img_url" mode="aspectFill" lazy-load/>
-                <view class="time">发布时间:{{item.publish_time}}</view>
+                <commnet :videoInfo="item"></commnet>
             </view>
         </view>
     </view>
@@ -50,9 +51,11 @@
 <script>
 import searchBox from '@/components/searchBox/searchBox.vue'
 import {apiVideoList,apiVideoPlayLog} from '@/api/video'
+import commnet from './components/comment.vue'
 export default {
     components: {
-        searchBox
+        searchBox,
+        commnet
     },
     data() {
         return {
@@ -182,8 +185,8 @@ page{
                 top: 34rpx;
                 right: 34rpx;
                 background-color: transparent;
-                width: 32rpx;
-                height: 32rpx;
+                width: 36rpx;
+                height: 36rpx;
                 line-height: 1;
                 padding: 0;
                 &::after{
@@ -234,6 +237,7 @@ page{
             .time{
                 font-size: 28rpx;
                 color: #999;
+                margin-top: 20rpx;
             }
         }
     }