| | |
| | | }, { |
| | | width: '100%' |
| | | }, |
| | | ] |
| | | ], |
| | | showIndex: '', |
| | | successOrderNumber: '' |
| | | }, |
| | | |
| | | resetTree: function (e) { |
| | |
| | | name: options.name, |
| | | }, |
| | | }); |
| | | wx.setNavigationBarTitle({ |
| | | title: options.name, |
| | | }) |
| | | this.getBookInfo(options.id); |
| | | this.getResourceClass(); // 获取资源所属分类 |
| | | const token = wx.getStorageSync(app.config.tokenKey); |
| | |
| | | }, |
| | | }; |
| | | app.MG.store.getProductDetail(query).then(async (res) => { |
| | | console.log(res.datas, 'res.datas'); |
| | | this.setData({ |
| | | bookDetail: res.datas, |
| | | buyIdList: res.datas.purchasedSaleMethodIdList, |
| | | |
| | | }); |
| | | if (res.datas.cmsDatas && res.datas.cmsDatas.length) { |
| | | this.setData({ |
| | |
| | | this.setData({ |
| | | noFile: true, |
| | | }); |
| | | // debugger |
| | | if (this.data.bookDetail.pdf) { |
| | | this.setData({ |
| | | "fileInfo.bookName": this.data.bookDetail.name, |
| | |
| | | "fileInfo.freePage": this.data.bookDetail.probationPage, |
| | | }); |
| | | } else if (this.data.bookDetail.protectedEpub) { |
| | | |
| | | this.setData({ |
| | | "fileInfo.bookName": this.data.bookDetail.name, |
| | | "fileInfo.fileType": "epub", |
| | |
| | | // 检查登录状态 |
| | | const token = wx.getStorageSync(app.config.tokenKey); |
| | | const child = this.selectComponent("#suggest-component"); |
| | | if (!token) { |
| | | wx.showLoading({ |
| | | title: "加载中", |
| | | }); |
| | | loginInfo(app, (data) => { |
| | | // 如果不是第一次登录,会执行回调 |
| | | if (data) { |
| | | // 登录成功,自动记录token和用户信息,并返回true |
| | | child.showDialog(); |
| | | wx.hideLoading(); |
| | | } else { |
| | | // 出现错误,返回false |
| | | } |
| | | }); |
| | | } else { |
| | | // 如果是第一次登录,会跳转至绑定用户信息页面,填写完用户信息后进行登录并储存token和用户信息,结束后跳转回当前页面(携带页面参数) |
| | | child.showDialog(); |
| | | } |
| | | if (token) |
| | | // child.showDialog(); |
| | | this.setData({ |
| | | showIndex: '1' |
| | | }) |
| | | }, |
| | | // 跳转网店 |
| | | goShop(e) { |
| | |
| | | (e.detail.value == "jsek_cloudLearning" && !this.data.learn.length) || |
| | | (e.detail.value == "questionBank" && !this.data.test.length) |
| | | ) { |
| | | if (e.detail.value == "jsek_teachingResources") { |
| | | wx.setStorageSync('teachResourcesPath', checkData.productLinkPath) |
| | | } |
| | | this.getResourceData(checkData); |
| | | } |
| | | if (e.detail.value == "questionBank" && token) this.getMockData(); |
| | |
| | | openLearnids: result, |
| | | }); |
| | | } |
| | | console.log(list, '云學習789'); |
| | | } else { |
| | | // 无数据 |
| | | } |
| | |
| | | }, |
| | | // 获取展开项 |
| | | findChildIds(data, result) { |
| | | let index = 0; |
| | | let index = 0 |
| | | for (let i = 0; i < data.length; i++) { |
| | | if (index < 3) { |
| | | const item = data[i]; |
| | | if (item.children && item.children.length > 0) { |
| | | result.push(item.id); |
| | | const item = data[i] |
| | | if (item.childrenFolderCount > 0) { |
| | | result.push(item.id) |
| | | for (let j = 0; j < item.children.length; j++) { |
| | | if (index < 3) { |
| | | const childrenItme = item.children[j]; |
| | | if (item.children && item.children.length > 0) { |
| | | result.push(childrenItme.id); |
| | | index += 1; |
| | | const childrenItme = item.children[j] |
| | | if (item.childrenCount > 0) { |
| | | result.push(childrenItme.id) |
| | | index += 1 |
| | | } |
| | | } else { |
| | | break; |
| | | break |
| | | } |
| | | } |
| | | } else if (item.children && item.children.length > 0) { |
| | | result.push(item.id); |
| | | index += 1; |
| | | } else if (item.childrenCount > 0) { |
| | | result.push(item.id) |
| | | index += 1 |
| | | } |
| | | } else { |
| | | break; |
| | | break |
| | | } |
| | | } |
| | | }, |
| | |
| | | }, |
| | | // 申请教学资源 |
| | | applyResource() { |
| | | if (this.data.applyResourceState) { |
| | | return wx.showToast({ |
| | | icon: "error", |
| | | title: "请勿重复点击", |
| | | }); |
| | | } |
| | | |
| | | // if (this.data.applyResourceState) { |
| | | // return wx.showToast({ |
| | | // icon: "error", |
| | | // title: "请勿重复点击", |
| | | // }); |
| | | // } |
| | | this.setData({ |
| | | applyResourceState: true, |
| | | }); |
| | |
| | | }; |
| | | // 确认订单 |
| | | const confirmOrderRes = await app.MG.store.confirmOrder(parameter); |
| | | console.log(confirmOrderRes.orderNumber, 'confirmOrderRes.orderNumber'); |
| | | |
| | | |
| | | |
| | | if (confirmOrderRes.orderNumber) { |
| | | child.changeReceive(false); |
| | | wx.showToast({ |
| | | title: "领取成功", |
| | | }); |
| | | this.getBookInfo(this.data.bookId); |
| | | this.setData({ |
| | | successOrderNumber: confirmOrderRes.orderNumber |
| | | }) |
| | | |
| | | |
| | | } |
| | | } catch (error) { |
| | | console.log(error); |
| | |
| | | } |
| | | |
| | | wx.setStorageSync("bookPathList", JSON.stringify(bookPathList)); |
| | | this.setData({ |
| | | learn: [], |
| | | teach: [] |
| | | }) |
| | | this.onLoad({ |
| | | id: e.detail.id, |
| | | name: e.detail.name, |
| | |
| | | }); |
| | | return false; |
| | | } |
| | | |
| | | // debugger |
| | | wx.navigateTo({ |
| | | url: "/packageBookService/pages/components/webView/index?md5=" + |
| | | this.data.fileInfo.md5 + |