| | |
| | | name: "", |
| | | }, |
| | | bookDetail: {}, |
| | | bookClass: [], |
| | | bookItemDetail: {}, |
| | | link: { |
| | | jd: "", |
| | |
| | | icon1: { |
| | | name: "/static/images/bookService/detail/dangdang.png", |
| | | }, |
| | | rowCol: [{ |
| | | width: '50%', |
| | | }, |
| | | { |
| | | width: '100%' |
| | | }, |
| | | { |
| | | width: '80%' |
| | | }, |
| | | { |
| | | width: '100%' |
| | | }, { |
| | | width: '100%' |
| | | }, |
| | | ], |
| | | showIndex: '' |
| | | }, |
| | | |
| | | resetTree: function (e) { |
| | |
| | | name: options.name, |
| | | }, |
| | | }); |
| | | wx.setNavigationBarTitle({ |
| | | title: options.name, |
| | | }) |
| | | this.getBookInfo(options.id); |
| | | this.getResourceClass(); // 获取资源所属分类 |
| | | const token = wx.getStorageSync(app.config.tokenKey); |
| | |
| | | } |
| | | this.getSubTtem(); |
| | | // 获取图书分类 |
| | | let className = ""; |
| | | if (res.datas.bookClassification) { |
| | | const bookClassification = JSON.parse(res.datas.bookClassification); |
| | | if (Array.isArray(bookClassification) && bookClassification.length) { |
| | | const iconType = bookClassification[0][0]; |
| | | const classType = bookClassification[0][1]; |
| | | className = await this.getBookClass(iconType, classType); |
| | | for (let index = 0; index < bookClassification.length; index++) { |
| | | const element = bookClassification[index]; |
| | | const iconType = element[0]; |
| | | const classType = element[1]; |
| | | await this.getBookClass(iconType, classType); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | "bookDetail.publicationDate": this.formatDate( |
| | | this.data.bookDetail.publicationDate |
| | | ), |
| | | "bookDetail.class": className, |
| | | "bookDetail.price": this.numFormat(this.data.bookDetail.price), |
| | | "bookDetail.oldPrice": this.numFormat(this.data.bookDetail.oldPrice), |
| | | "bookDetail.paperPrice": this.numFormat( |
| | |
| | | ), |
| | | pageLoading: false, |
| | | }); |
| | | console.log("图书信息", this.data.bookDetail); |
| | | console.log("图书信息", this.data.bookClass); |
| | | }); |
| | | }, |
| | | //请求子商品的文件 |
| | |
| | | if (item.value == iconType) { |
| | | item.child.forEach((citem) => { |
| | | if (citem.value == classType) { |
| | | name = citem.name; |
| | | const flag = this.data.bookClass.findIndex((ditem) => ditem == citem.name) |
| | | if (flag == -1) { |
| | | let list = this.data.bookClass |
| | | list.push(citem.name) |
| | | this.setData({ |
| | | bookClass: list |
| | | }) |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | }); |
| | | return name; |
| | | }, |
| | | // 收藏 |
| | | setCollect() { |
| | |
| | | // 检查登录状态 |
| | | 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(); |
| | |
| | | }, |
| | | // 获取展开项 |
| | | 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 |
| | | } |
| | | } |
| | | }, |
| | |
| | | }, |
| | | |
| | | updateShoppingCartHidden() { |
| | | |
| | | const isSHow = this.data.shoppingCartGetId.some( |
| | | (item) => item == data.saleMethod[0].Id |
| | | ); |
| | | return !isSHow; |
| | | }, |
| | | //刷新购物车图标 |
| | | updateCloudLearning() { |
| | | this.getBookInfo() |
| | | this.getShoppingCartProductGet() |
| | | const checkData = this.data.cmsDatas.find( |
| | | (item) => item.refCode == "jsek_cloudLearning" |
| | | ); |
| | | this.getResourceData(checkData); |
| | | |
| | | |
| | | |
| | | }, |
| | | // 遍历树结构转换为数组方法 |
| | | handleTreeData(array) { |