闫增涛
2024-11-28 dce885689d308043450f199981722b5c80360fe7
packageBookService/pages/bookServices/detail/components/testResource/testResource.js
@@ -5,6 +5,12 @@
   * 组件的属性列表
   */
  properties: {
    isBuyBank: {
      type: Boolean
    },
    bankSaleData: {
      type: Object
    },
    list: {
      type: Array,
      value: [],
@@ -28,6 +34,9 @@
    storeInfo: {
      type: String,
      value: "",
    },
    jslx: {
      type: Boolean,
    },
  },
@@ -57,7 +66,6 @@
      })
    },
    async goTest(e) {
      console.log(e.detail.value.item, 666)
      const value = e.detail.value.item;
      const token = wx.getStorageSync("jsek-token");
      if (!token) {
@@ -68,12 +76,16 @@
          },
        });
      }
      if (!this.data.isBuyBank) return wx.showToast({
        icon: 'error',
        title: '请先购买题库',
      })
      wx.showLoading({
        title: "加载中",
      });
      // 获取章节下是否有题目
      let idPathList = [];
      if (this.properties.storeInfo) {
      if (this.properties.storeInfo || this.properties.jslx) {
        idPathList.push({
          id: this.properties.bookInfo.id,
          name: this.properties.bookInfo.name,
@@ -91,6 +103,7 @@
            size: 999,
          },
        };
        console.log(value.childrenFolderCount, 1234578)
        if (value.childrenFolderCount == 0) {
          wx.hideLoading();
          return wx.showToast({
@@ -107,6 +120,7 @@
              type: item.type,
            });
          });
          console.log(idPathList, 123413456578)
        }
      }
      wx.hideLoading();
@@ -117,7 +131,7 @@
          this.properties.bookInfo.rootCmsItemId
        }&idPathList=${JSON.stringify(idPathList)}&answerTitle=${
          value.name
        }&answerType=${"option"}&storeInfo=${this.properties.storeInfo}`,
        }&answerType=${"option"}&storeInfo=${this.properties.storeInfo}&jslx=${this.properties.jslx}`,
      });
    },
    goMycollect(e) {
@@ -192,5 +206,14 @@
        loading: type,
      });
    },
    // 题库购买
    buyBank() {
      var myEventDetail = {} // detail对象,提供给事件监听函数
      var myEventOption = {
        bubbles: true,
        composed: true
      } // 触发事件的选项
      this.triggerEvent('buyBank', myEventDetail, myEventOption)
    }
  },
});