bayi 1 年之前
父節點
當前提交
e67ae6b1d1
共有 2 個文件被更改,包括 28 次插入8 次删除
  1. 24 4
      pages/userWorks/index.js
  2. 4 4
      pages/userWorks/index.wxml

+ 24 - 4
pages/userWorks/index.js

@@ -1,7 +1,11 @@
 import {
-    getSelfRead
+    getSelfRead,
+    getFavoritesList
 } from '~/api/user'
 import {
+    getFollowWorks
+} from '~/api/works'
+import {
     getreadInfo
 } from '~/api/video'
 import share from '~/mixins/share'
@@ -10,10 +14,20 @@ import reachBottom from '~/mixins/reachBottom'
 Page({
     behaviors: [reachBottom, share, event],
     data: {
-        firstWork: ''
+        firstWork: '',
+        type: 'my'
     },
     onLoad(options) {
-        console.log(options);
+        if (options.type) {
+            this.setData({
+                type: options.type
+            })
+            if(options.type!='my'){
+                wx.setNavigationBarTitle({
+                    title:options.type=='follow'?'关注作品':'收藏作品'
+                })
+            }
+        }
         if (options.id) {
             this.getreadInfo(options.id)
             wx.nextTick(() => {
@@ -32,7 +46,13 @@ Page({
         }
     },
     loadMore() {
-        this.getData(this.getSelfRead)
+        if (this.data.type == 'follow') {
+            this.getData(getFollowWorks, {})
+        } else if (this.data.type == 'my') {
+            this.getData(getSelfRead, {})
+        } else if (this.data.type == 'collect') {
+            this.getData(getFavoritesList, {})
+        }
     },
     getSelfRead(data) {
         return new Promise(async (reslove) => {

+ 4 - 4
pages/userWorks/index.wxml

@@ -1,6 +1,6 @@
 <view class="worksBox">
-  <!-- 作品列表 -->
-  <canvas id='share' type="2d"> </canvas>
-  <worksList id="worksList" videoType='my' worksList="{{list}}" autoPlay='{{false}}' />
-  <emptyBg wx:if="{{list.length==0}}" message='您还没有作品哦,赶快去发表吧!'></emptyBg>
+    <!-- 作品列表 -->
+    <canvas id='share' type="2d"> </canvas>
+    <worksList id="worksList" videoType="{{type=='my'?'my':'follow'}}" worksList="{{list}}" autoPlay='{{false}}' />
+    <emptyBg wx:if="{{list.length==0}}" message='您还没有作品哦,赶快去发表吧!'></emptyBg>
 </view>