From 4bc1c36faeec2f90e5acfa836732e49fe0b245e9 Mon Sep 17 00:00:00 2001 From: yiming <m13691596795@163.com> Date: 星期五, 12 四月 2024 20:47:03 +0800 Subject: [PATCH] 云学习11 --- packageBookService/pages/bookServices/detail/index.js | 52 +++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 41 insertions(+), 11 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js index cb319a8..58289fc 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,21 @@ icon1: { name: "/static/images/bookService/detail/dangdang.png", }, + rowCol: [{ + width: '50%', + }, + { + width: '100%' + }, + { + width: '80%' + }, + { + width: '100%' + }, { + width: '100%' + }, + ] }, resetTree: function (e) { @@ -190,16 +206,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 +392,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 +433,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 +440,7 @@ ), pageLoading: false, }); - console.log("鍥句功淇℃伅", this.data.bookDetail); + console.log("鍥句功淇℃伅", this.data.bookClass); }); }, //璇锋眰瀛愬晢鍝佺殑鏂囦欢 @@ -551,13 +568,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() { @@ -1375,16 +1398,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