import APIClient from '../../utils/APIClient'; const app = getApp(); import { formatDate } from '../../utils/util'; export const myInit = (that) => { that.setData({ myData: { title: '修改资料', concern: '我的关注', course: '我的课程', read: '我的朗读', keep: '我的收藏', collage: '我的拼团', wallet: '我的钱包', schoolCity: '', schoolName: '', user: {}, isIOS: app.globalData.isIOS }, followData:[] }); that.getUserWorksInfo(); console.log(that.data.myData) that.toMyEdit = (e) => { let title = e.currentTarget.dataset.title; wx.navigateTo({ url: `../user/myEdit/myEdit?title=修改资料` }); }, that.toMyConcern = e => { wx.navigateTo({ url: `../user/myconcern/myconcern?title=我的关注` }); } that.toMyRead = e => { wx.navigateTo({ url: `../user/myread/myread?title=我的朗读` }); }, that.toMyKeep = e => { let title = e.currentTarget.dataset.title; wx.navigateTo({ url: `../user/mycollection/mycollection?title=${title}` }); }, that.getFollowWorks = (pageNo, pageSize) => { APIClient.getFollowWorks(pageNo, pageSize).success(res => { console.log(res) const followData = res.data.data.list; // const followTemp = []; followData.forEach(item => { const temp = {}; console.log(item.userRead.id) temp.nickName = item.user.wechatName; temp.avatar = item.user.avatar; temp.uid = item.user.uid; temp.plays = item.userRead.playAmount; temp.likes = item.userRead.likeAmount; temp.img = item.userRead.iconImg; temp.id = item.userRead.id; temp.title = item.userRead.title; temp.summary = item.userRead.summary; temp.time = formatDate(item.userRead.gmtCreated, 3); // 还差一些字段 that.data.followData.push(temp); }); // console.log(followTemp); that.setData({ followData: that.data.followData, followPageTotalNo: res.data.data.totalNo }) }); }, that.toWalletDetail = function(e) { wx.navigateTo({ url: `../../pages/user/walletDetails/walletDetails?title=资金明细` }); }, that.getFollowWorks(1, 3); }