From e68118a722857e52b9c83e08ac213621aac58c01 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期五, 12 四月 2024 15:01:53 +0800 Subject: [PATCH] 骨架屏样式优化,云测试单选按钮修改 --- packageBookService/pages/bookServices/detail/index.js | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packageBookService/pages/bookServices/detail/index.js b/packageBookService/pages/bookServices/detail/index.js index d9f8618..ec8d5e4 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: "", @@ -376,13 +377,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 +418,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 +425,7 @@ ), pageLoading: false, }); - console.log("鍥句功淇℃伅", this.data.bookDetail); + console.log("鍥句功淇℃伅", this.data.bookClass); }); }, //璇锋眰瀛愬晢鍝佺殑鏂囦欢 @@ -551,13 +553,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() { -- Gitblit v1.9.1