Przeglądaj źródła

删除作品功能

bayi 2 lat temu
rodzic
commit
81afcf96dc

+ 1 - 1
components/videoPreview/index.js

@@ -164,7 +164,7 @@ Component({
               title: '删除成功!',
               icon: "none"
             })
-            this.triggerEvent('getList')
+            this.triggerEvent('deleteVideo', this.properties.videoInfo.userRead.id)
           }
         }
       })

+ 10 - 0
components/worksList/index.js

@@ -94,6 +94,16 @@ Component({
       this.setData({
         worksListCopy
       })
+    },
+    deleteVideo({
+      detail
+    }) {
+      let worksListCopy = this.properties.worksListCopy.filter(item => {
+        return item.userRead.id != detail
+      })
+      this.setData({
+        worksListCopy
+      })
     }
   },
 })

+ 2 - 2
components/worksList/index.wxml

@@ -3,8 +3,8 @@
   <videoPreview class="videoPreview" wx:for="{{worksListCopy}}" wx:key="index" videoType="{{videoType}}"
     videoInfo="{{item}}" index='{{index}}' currentId="{{currentId}}" data-id="{{item.userRead.id}}"
     data-audio="{{item.userRead.audioPath}}"
-    data-type="{{!item.userReadExtend||item.userReadExtend.resourcesType==0?0:1}}" bind:playVideo="playVideo"
-    bind:openComment="openComment" bind:setListFans="setListFans" bind:playAudio="playAudio">
+    data-type="{{!item.userReadExtend||item.userReadExtend.resourcesType==0?0:1}}" bind:openComment="openComment"
+    bind:setListFans="setListFans" bind:playAudio="playAudio" bind:deleteVideo='deleteVideo'>
   </videoPreview>
   <Comment id="comment" tabBarPadding="{{tabBarPadding}}" bind:addCommentNum="addCommentNum" />
   <canvas id='share' class="share" type="2d"> </canvas>