| | |
| | | showDialog: false, |
| | | }); |
| | | }, |
| | | |
| | | // 初始化函数 |
| | | async init() { |
| | | // 获取图书详情,判断题库是否购买 |
| | | const query = { |
| | | path: "*", |
| | | queryType: "*", |
| | | productId: this.data.bookId, |
| | | favoriteTypes: "FavoriteBookCity", |
| | | itemFields: { |
| | | "SysType=": "CmsFolder", |
| | | }, |
| | | coverSize: { |
| | | height: 300, |
| | | }, |
| | | fields: {}, |
| | | }; |
| | | const res = await app.MG.store.getProductDetail(query) |
| | | const saleData = res.datas.saleMethod.find(item => item.Name.includes('题库')) |
| | | if (saleData && !res.datas.purchasedSaleMethodIdList.includes(saleData.Id)) return wx.showModal({ |
| | | title: '提示', |
| | | content: '请先购买题库再答题', |
| | | confirmColor: "#ff6c00", |
| | | cancelColor: "#949494", |
| | | editable: false, //是否显示输入框 |
| | | showCancel: false, |
| | | complete: () => { |
| | | this.setData({ |
| | | submitStatus: true |
| | | }) |
| | | wx.setStorageSync('tabValue', 'questionBank') |
| | | wx.navigateTo({ |
| | | url: `/packageBookService/pages/bookServices/detail/index?id=${res.datas.id}&name=${res.datas.name}`, |
| | | }) |
| | | } |
| | | }) |
| | | this.setData({ |
| | | loading: true, |
| | | subjectiveTotal: 0, |