import httpRequestApi from '../../../utils/APIClient'; Page({ data: { titleIcon: '', title: '', bookInfo: '', lessonList: [] }, onLoad: function (options) { wx.setNavigationBarTitle({ title: options.title }) const uid= wx.getStorageSync('uid'); console.log(options.id) httpRequestApi.getBookDetail(uid, options.id).success((res) => { console.log(res.data.data) const bookInfo = res.data.data.product; const lessonList = res.data.data.lessonList; this.setData({ titleIcon: bookInfo.bgImg, title: bookInfo.title, bookInfo: bookInfo.description }) const lessonTemp = []; lessonList.forEach(item => { const temp = {}; temp.id = item.id; temp.title = item.title; temp.readNum = item.readCount; lessonTemp.push(temp); }); this.setData({ lessonList: lessonTemp }); console.log(this.data.lessonList) }); }, goToClass: function(e){ let id = e.currentTarget.dataset.id; let title = e.currentTarget.dataset.title; wx.navigateTo({ url: `../class/class?id=${id}&title=${title}` }) } })