123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- 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: {
- title: '修改资料',
- concern: '我的关注',
- course: '我的课程',
- read: '我的朗读',
- keep: '我的收藏',
- collage: '我的拼团',
- wallet: '我的钱包',
- schoolCity: '',
- schoolName: '',
- user: {},
- isIOS: app.globalData.isIOS,
- isVIP: true,
- grade:''
- },
- 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=修改资料`
- });
- },
- that.toMyConcern = e => {
- wx.navigateTo({
- url: `../myconcern/myconcern?title=我的关注`
- });
- }
- that.toMyRead = e => {
- wx.navigateTo({
- url: `../user/myread/myread?title=我的朗读`
- });
- },
- that.toMyKeep = e => {
- wx.navigateTo({
- url: `../mycollection/mycollection`
- });
- },
- 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.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.getFollowWorks(1, 3);
- }
|