import APIClient from '../../utils/APIClient'; const app = getApp(); import { formatDate } from '../../utils/util'; export const myInit = (that) => { console.log(123123123, app.globalData.isIOS) that.setData({ myData: { isVIP: wx.getStorageSync('vip'), price: wx.getStorageSync('price'), date: wx.getStorageSync('date') }, followData: [] }); that.getUserWorksInfo(); // that.getUserAuth(); //用户鉴权 // that.getMyRead(); console.log(that.data.myData) that.toMyEdit = (e) => { let title = e.currentTarget.dataset.title; wx.navigateTo({ url: `../user/myEdit/myEdit?title=修改资料` }); APIClient.userEvent('MY_INFO'); }, that.toMyConcern = e => { wx.navigateTo({ url: `../myconcern/myconcern?title=我的关注` }); APIClient.userEvent('MY_SUBSCRIBE'); } that.toMyRead = e => { wx.navigateTo({ url: `../user/myread/myread?title=我的朗读` }); }, that.toMyKeep = e => { wx.navigateTo({ url: `../mycollection/mycollection` }); APIClient.userEvent('MY_FAVORITES'); }, 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.nickName; temp.avatar = item.user.avatar; temp.uid = item.user.uid; temp.plays = item.userRead.playAmount; temp.likes = item.userRead.likeAmount; temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0; temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046; temp.img = item.userRead.iconImg; temp.id = item.userRead.id; temp.title = item.userRead.title; temp.summary = item.userRead.summary; temp.type = item.userRead.type; temp.isLike = item.isLike; temp.isFavorite = item.isFavorites; 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.toVIPBuy = function(e) { if (app.globalData.isIOS) { wx.navigateTo({ url: `../../pages/vipPage/vipCode/vipCode` }); } else { wx.navigateTo({ url: `../../pages/vipPage/vip/vip` }); } }, /**创建支付订单 */ that.moneyBuy = function() { // that.messageAuth(); that.goToPruduct(); } that.getFollowWorks(1, 3); }