1234567891011121314151617181920212223242526272829303132333435363738 |
- import httpRequestApi from '../../utils/APIClient';
- import {
- formatDate
- } from '../../utils/util';
- export const followInit = (that) => {
- that.setData({
- followData: []
- })
- //请求数据封装
- that.getWorks = (pageNo, pageSize) => {
- httpRequestApi.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.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.getWorks(1, 5);
- }
|