// pages/test/testCover.js const app = getApp() Page({ /** * 页面的初始数据 */ data: { bookId: 0, bookName: '', cmsId: '', productLinkPath: '', rootCmsItemId: '', answerTitle: '', }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { if (options.scene) { this.getBookInfo(options.scene) } }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, getBookInfo(refcode) { const obj = { storeInfo: app.config.jslx, path: app.config.jslx, queryType: 'ProductCmsItem', SysType: "CmsFolder", RefCode: refcode, paging: { start: 0, size: 99, }, coverSize: { width: 260 }, fields: { ProductLinkInfo: [], productLinkPath: [], } } app.MG.resource.getItem(obj).then((res) => { console.log(res.datas, '图书信息') let idPathList = []; let book = res.datas[0] this.setData({ bookId: book.productLinkInfo.ProductId, bookName: book.productLinkInfo.Name, productLinkPath: book.productLinkInfo.LinkPath + "\\" + book.id, rootCmsItemId: book.productLinkInfo.LinkPath, cmsId: book.id, answerTitle: book.name }) idPathList.push({ id: book.id, name: book.name, productLinkPath: this.data.productLinkPath, type: book.type, }) wx.redirectTo({ url: `/packageBookService/pages/bookServices/examination/examination?bookId=${ this.data.bookId }&productLinkPath=${this.data.productLinkPath}& =${ this.data.rootCmsItemId }&idPathList=${JSON.stringify(idPathList)}&answerTitle=${ this.data.answerTitle }&answerType=${"option"}&storeInfo=${book.storeInfo}`, }); }) }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })