From cb15c57d0ff984f5a100cf25d560fb0a69c00984 Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期二, 16 四月 2024 18:21:05 +0800 Subject: [PATCH] 音频bug4 --- packageBookService/pages/bookServices/detail/index.js | 108 +++++++++++++++++++++++++++++++++--------------------- 1 files changed, 66 insertions(+), 42 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js index cb319a8..4399b17 100644 --- a/packageBookService/pages/bookServices/detail/index.js +++ b/packageBookService/pages/bookServices/detail/index.js @@ -18,6 +18,7 @@ name: "", }, bookDetail: {}, + bookClass: [], bookItemDetail: {}, link: { jd: "", @@ -133,6 +134,22 @@ icon1: { name: "/static/images/bookService/detail/dangdang.png", }, + rowCol: [{ + width: '50%', + }, + { + width: '100%' + }, + { + width: '80%' + }, + { + width: '100%' + }, { + width: '100%' + }, + ], + showIndex: '' }, resetTree: function (e) { @@ -160,6 +177,9 @@ name: options.name, }, }); + wx.setNavigationBarTitle({ + title: options.name, + }) this.getBookInfo(options.id); this.getResourceClass(); // 鑾峰彇璧勬簮鎵�灞炲垎绫� const token = wx.getStorageSync(app.config.tokenKey); @@ -190,16 +210,16 @@ onShow() { if (wx.getStorageSync("paperBookList")) { this.setData({ - paperBookList: wx.getStorageSync("paperBookList"), + paperBookList: JSON.parse(wx.getStorageSync("paperBookList")), }); } if (wx.getStorageSync("electronicBookList")) { this.setData({ - electronicBookList: wx.getStorageSync("electronicBookList"), + electronicBookList: JSON.parse(wx.getStorageSync("electronicBookList")), }); } this.setData({ - num: this.data.paperBookList.length + this.data.electronicBookList.length, + num: Number(this.data.paperBookList.length) + Number(this.data.electronicBookList.length), }); }, @@ -376,13 +396,15 @@ } 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); + } } } @@ -415,7 +437,6 @@ "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( @@ -423,7 +444,7 @@ ), pageLoading: false, }); - console.log("鍥句功淇℃伅", this.data.bookDetail); + console.log("鍥句功淇℃伅", this.data.bookClass); }); }, //璇锋眰瀛愬晢鍝佺殑鏂囦欢 @@ -551,13 +572,19 @@ 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() { @@ -603,24 +630,11 @@ // 妫�鏌ョ櫥褰曠姸鎬� const token = wx.getStorageSync(app.config.tokenKey); const child = this.selectComponent("#suggest-component"); - if (!token) { - wx.showLoading({ - title: "鍔犺浇涓�", - }); - loginInfo(app, (data) => { - // 濡傛灉涓嶆槸绗竴娆$櫥褰曪紝浼氭墽琛屽洖璋� - if (data) { - // 鐧诲綍鎴愬姛锛岃嚜鍔ㄨ褰晅oken鍜岀敤鎴蜂俊鎭紝骞惰繑鍥瀟rue - child.showDialog(); - wx.hideLoading(); - } else { - // 鍑虹幇閿欒锛岃繑鍥瀎alse - } - }); - } else { - // 濡傛灉鏄涓�娆$櫥褰曪紝浼氳烦杞嚦缁戝畾鐢ㄦ埛淇℃伅椤甸潰锛屽~鍐欏畬鐢ㄦ埛淇℃伅鍚庤繘琛岀櫥褰曞苟鍌ㄥ瓨token鍜岀敤鎴蜂俊鎭紝缁撴潫鍚庤烦杞洖褰撳墠椤甸潰锛堟惡甯﹂〉闈㈠弬鏁帮級 - child.showDialog(); - } + if (token) + // child.showDialog(); + this.setData({ + showIndex: '1' + }) }, // 璺宠浆缃戝簵 goShop(e) { @@ -660,6 +674,9 @@ (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(); @@ -881,29 +898,29 @@ }, // 鑾峰彇灞曞紑椤� 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 } } }, @@ -1375,16 +1392,23 @@ }, 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) { -- Gitblit v1.9.1