import httpRequestApi from '../../utils/APIClient'; 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 => { const followData = res.data.data.list; const followTemp = []; followData.forEach(item => { const temp = {}; temp.nickName = item.user.wechatName; temp.avatar = item.user.avatar; temp.plays = item.userRead.playAmount; temp.likes = item.userRead.likeAmount; temp.id = item.userRead.id; // 还差一些字段 followTemp.push(temp); }); console.log(followTemp); }); } that.getWorks(1, 1, 10); }