|
@@ -2,9 +2,19 @@ const app = getApp()
|
|
|
import {
|
|
|
getBannerList
|
|
|
} from '~/api/global'
|
|
|
+import {
|
|
|
+ getSelfRead
|
|
|
+} from '~/api/user'
|
|
|
+import {
|
|
|
+ getFollowWorks
|
|
|
+} from '~/api/works'
|
|
|
+import reachBottom from '~/mixins/reachBottom'
|
|
|
Page({
|
|
|
+ behaviors: [reachBottom],
|
|
|
data: {
|
|
|
- bannerList: []
|
|
|
+ bannerList: [],
|
|
|
+ // 1关注的人的作品,2是自己的作品
|
|
|
+ currentType: '1',
|
|
|
},
|
|
|
onShow() {
|
|
|
if (typeof this.getTabBar === 'function') {
|
|
@@ -12,17 +22,42 @@ Page({
|
|
|
selected: 2
|
|
|
})
|
|
|
}
|
|
|
- getApp().callBack = (res) => {
|
|
|
+ let uid = wx.getStorageSync('uid')
|
|
|
+ if (uid) {
|
|
|
+ this.resetData()
|
|
|
+ } else {
|
|
|
+ getApp().callBack = (res) => {
|
|
|
+ this.resetData()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ loadMore() {
|
|
|
+ if (this.data.currentType == '1') {
|
|
|
+ this.getData(getFollowWorks, {})
|
|
|
+ } else if (this.data.currentType == '2') {
|
|
|
+ this.getData(getSelfRead, {})
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async getFollowWorks() {
|
|
|
+ let res = await getFollowWorks()
|
|
|
+ console.log(res);
|
|
|
+ },
|
|
|
+ changeType({
|
|
|
+ target
|
|
|
+ }) {
|
|
|
+ if (target.dataset.type) {
|
|
|
+ this.setData({
|
|
|
+ currentType: target.dataset.type
|
|
|
+ })
|
|
|
+ this.resetData()
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom() {
|
|
|
-
|
|
|
+ this.loadMore()
|
|
|
},
|
|
|
-
|
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|