From bd3a3057169eb727728f8a322f51fd4fb4b6cf30 Mon Sep 17 00:00:00 2001
From: 闫增涛 <1829501689@qq.com>
Date: 星期四, 11 四月 2024 22:08:32 +0800
Subject: [PATCH] 答题器听力题播放功能优化

---
 packageBookService/pages/bookServices/list/index.js |   50 ++++++++++++++++++++++++--------------------------
 1 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/packageBookService/pages/bookServices/list/index.js b/packageBookService/pages/bookServices/list/index.js
index f57e643..a8abbc8 100644
--- a/packageBookService/pages/bookServices/list/index.js
+++ b/packageBookService/pages/bookServices/list/index.js
@@ -245,7 +245,7 @@
     });
   },
   // 鑾峰彇涓�绾у垎绫讳笅浜岀骇鍒嗙被
-  getSecondList(path) {
+  async getSecondList(path) {
     const options = [];
     const query = {
       path,
@@ -260,16 +260,7 @@
         field: "LinkOrder",
       },
     };
-    app.MG.store.getStoreChannelList(query).then((res) => {
-      if (!res.datas.length) {
-        this.setData({
-          disabledSecondList: true,
-        });
-      } else {
-        this.setData({
-          disabledSecondList: false,
-        });
-      }
+    await app.MG.store.getStoreChannelList(query).then((res) => {
       for (let index = 0; index < res.datas.length; index++) {
         const item = res.datas[index];
         options.push({
@@ -441,11 +432,6 @@
       },
     };
     app.MG.store.getProductList(query).then((res) => {
-      if (!res.datas.length && !this.data.pathList.length) {
-        this.setData({
-          disabledSecondList: true
-        })
-      }
       this.setData({
         bookList: res.datas,
         isMore: null,
@@ -460,6 +446,18 @@
           noData: true,
         });
       }
+      // 浜岀骇绂佺敤閫昏緫
+      // 1.涓�绾у垎绫绘湭閫変腑锛屼簩绾у垎绫荤鐢�
+      if (!this.data.stairList.value) {
+        this.setData({
+          disabledSecondList: true
+        })
+      } else if (this.data.stairList.value && !this.data.secondList.options.length) {
+        // 2. 涓�绾у垎绫婚�変腑锛屾棤浜岀骇鍒嗙被
+        this.setData({
+          disabledSecondList: true
+        })
+      }
       if (this.data.triggered) {
         this.setData({
           triggered: false,
@@ -471,7 +469,7 @@
     });
   },
   // 涓�绾у垎绫诲垏鎹�
-  onChangeStair(e) {
+  async onChangeStair(e) {
     const path = e.detail.value.length ?
       `${this.data.assortCheck.code}\\${e.detail.value}` :
       this.data.assortCheck.code;
@@ -482,16 +480,16 @@
       secondCode: "",
       path: path,
       "stairList.value": e.detail.value,
-      disabledSecondList: false
+      // disabledSecondList: false
     });
-    if (e.detail.value == "") {
-      this.setData({
-        disabledSecondList: true,
-      });
-    } else {
-      this.getSecondList(path);
-    }
-    this.getBookList(path);
+    // if (e.detail.value == "") {
+    //   this.setData({
+    //     disabledSecondList: true,
+    //   });
+    // } else {
+    await this.getSecondList(path);
+    // }
+    await this.getBookList(path);
   },
   // 浜岀骇鍒嗙被鍒囨崲
   onChangeSecond(e) {

--
Gitblit v1.9.1