12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- import httpRequestApi from '../../utils/APIClient';
- import {
- formatDate
- } from '../../utils/util';
- export const followInit = (that) => {
- that.setData({
- followData: []
- // title: '关注',
- // wareCards: [{
- // title: "铺满色巴掌的水泥道",
- // grade: "一年级 上学期",
- // img: "../../static/image/timg.jpg",
- // plays: "1",
- // likes: "2",
- // classId: "1",
- // avatar: '../../static/image/timg.jpg',
- // nickName: '萝莉小猫咪',
- // time: '11-01 14:14'
- // },
- // {
- // title: "铺满色巴掌的水泥道",
- // grade: "一年级 上学期",
- // img: "../../static/image/timg.jpg",
- // plays: "1",
- // likes: "2",
- // classId: "1",
- // avatar: '../../static/image/timg.jpg',
- // nickName: '萝莉小猫咪',
- // time: '11-01 14:14'
- // },
- // {
- // title: "铺满色巴掌的水泥道",
- // grade: "一年级 上学期",
- // img: "../../static/image/timg.jpg",
- // plays: "1",
- // likes: "2",
- // classId: "1",
- // avatar: '../../static/image/timg.jpg',
- // nickName: '萝莉小猫咪',
- // time: '11-01 14:14'
- // },
- // ]
- // }
- })
- //请求数据封装
- that.getWorks = (uid, pageNo, pageSize) => {
- httpRequestApi.getFollowWorks(uid, 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.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(that.uid, 1, 5);
- }
|