فهرست منبع

开发我的作品页面及优化组件

bayi 2 سال پیش
والد
کامیت
2295f3ef0a
4فایلهای تغییر یافته به همراه38 افزوده شده و 32 حذف شده
  1. 3 3
      components/videoPreview/index.wxml
  2. 33 27
      components/worksList/index.js
  3. 1 1
      components/worksList/index.wxml
  4. 1 1
      pages/works/index.wxml

+ 3 - 3
components/videoPreview/index.wxml

@@ -2,13 +2,13 @@
 <view class="work">
   <view class="workHead">
     <view class="wH-left">
-      <image src="{{videoInfoCopy.user.avatar}}" class="avatar" bindtap="jumpUserInfo"/>
+      <image src="{{videoInfoCopy.user.avatar}}" class="avatar" bindtap="jumpUserInfo" />
       <view class="wH-left-user">
         <view class="nickname textOver">{{videoInfoCopy.user.nickName||videoInfoCopy.user.eid}}</view>
         <view class="time">{{videoInfoCopy.userRead.day}}</view>
       </view>
     </view>
-    <view class="wH-right" wx:if="{{videoType=='my'}}">
+    <view class="wH-right" wx:if="{{videoType=='my'&&videoInfo.userRead.status!='CHECK'}}">
       <view class="wH-right-btn" bindtap="download">
         <image class="img" src="/static/down.png" mode="" />
         <view class="text">下载</view>
@@ -55,7 +55,7 @@
       src="{{videoInfoCopy.userRead.videoPath}}" autoplay="true" object-fit="contain">
     </video>
   </view>
-  <view class="workFooter">
+  <view class="workFooter" wx:if="{{videoInfo.userRead.status!='CHECK'}}">
     <button class="resetBtn mangeL-box" open-type="share" data-info='{{videoInfo}}'>
       <image src="/static/share.png" mode="" class="icon" />
       <view class="icon-name">分享</view>

+ 33 - 27
components/worksList/index.js

@@ -1,34 +1,40 @@
 import behavior from '~/mixins/video'
 Component({
-    behaviors: [behavior],
-    properties: {
-        worksList: {
-            type: Array,
-            value: [],
-            observer(newVal) {
-                this.setData({
-                    worksListCopy: newVal
-                })
-            }
-        }
+  behaviors: [behavior],
+  properties: {
+    worksList: {
+      type: Array,
+      value: [],
+      observer(newVal) {
+        console.log(newVal);
+        this.setData({
+          worksListCopy: newVal
+        })
+      }
     },
-    data: {
-        worksListCopy: {}
+    videoType: {
+      type: String,
+      // value 为public时是默认公共样式,为my时为“我的”样式,展示下载删除是否公开,pk为pk的样式文案
+      value: 'public'
     },
-    methods: {
-        setListFans({
-            detail
-        }) {
-            let worksListCopy = JSON.parse(JSON.stringify(this.data.worksListCopy))
-            worksListCopy.forEach(item => {
-                if (item.user.uid == detail) {
-                    item.isFans = true
-                }
-            })
-            this.setData({
-                worksListCopy
-            })
+  },
+  data: {
+    worksListCopy: {}
+  },
+  methods: {
+    setListFans({
+      detail
+    }) {
+      let worksListCopy = JSON.parse(JSON.stringify(this.data.worksListCopy))
+      worksListCopy.forEach(item => {
+        if (item.user.uid == detail) {
+          item.isFans = true
         }
-    },
+      })
+      this.setData({
+        worksListCopy
+      })
+    }
+  },
 
 })

+ 1 - 1
components/worksList/index.wxml

@@ -1,5 +1,5 @@
 <view class="worksList">
-  <videoPreview wx:for="{{worksListCopy}}" wx:key="index" videoInfo="{{item}}" index='{{index}}'
+  <videoPreview wx:for="{{worksListCopy}}" wx:key="index" videoType="{{videoType}}" videoInfo="{{item}}" index='{{index}}'
     currentId="{{currentId}}" data-id="{{item.userRead.id}}" bind:playVideo="playVideo" bind:openComment="openComment"
     bind:setListFans="setListFans">
   </videoPreview>

+ 1 - 1
pages/works/index.wxml

@@ -8,5 +8,5 @@
     <view class="type {{currentType=='2'?'currentType':''}}" data-type='2'>我的作品</view>
   </view>
   <!-- 优秀作品展播及官方推荐列表组件 -->
-  <worksList id="worksList" worksList="{{list}}" />
+  <worksList id="worksList" videoType="{{currentType=='1'?'public':'my'}}" worksList="{{list}}" />
 </view>