litian
2024-07-22 f4e7324c27b7c6ecb824029e22a13541c5033ade
packageBookService/pages/bookServices/detail/index.js
@@ -35,6 +35,7 @@
    teach: [],
    learn: [],
    test: [],
    jslx: true,
    openTeachids: [],
    openLearnids: [],
    openTestids: [],
@@ -154,7 +155,8 @@
    ],
    showIndex: '',
    successOrderNumber: '',
    applicationState: '' // 电子样书申请状态
    applicationState: '', // 电子样书申请状态
  },
  resetTree: function (e) {
@@ -385,7 +387,6 @@
      },
    };
    app.MG.store.getProductDetail(query).then(async (res) => {
      console.log(res.datas, 'res.datas');
      this.setData({
        bookDetail: res.datas,
        buyIdList: res.datas.purchasedSaleMethodIdList,
@@ -457,7 +458,6 @@
        ),
      });
      console.log("图书信息", this.data.bookClass);
    });
  },
  //请求子商品的文件
@@ -658,8 +658,6 @@
      this.setData({
        showIndex: '1'
      })
    console.log(this.data.bookDetail.icon, '0111111');
    console.log(this.data.bookDetail.name, '45688');
  },
  // 跳转网店
  goShop(e) {
@@ -977,15 +975,16 @@
  },
  //  获取 云测试
  getResourceData(type) {
    this.setData({
    var that = this
    that.setData({
      loading: true,
      noResources: false,
    });
    let query = {
      path: "*",
      queryType: "*",
      storeInfo: this.data.options.storeInfo,
      productId: this.data.bookDetail.id,
      storeInfo: that.data.options.storeInfo,
      productId: that.data.bookDetail.id,
      cmsPath: type.productLinkPath,
      cmsType: '*',
      itemFields: {
@@ -1012,38 +1011,57 @@
        if (type.refCode == "questionBank") {
          let data = []
          let result = [];
          if (this.data.options.storeInfo == 'jsek_jslx') {
          const isTSFW = res.datas.cmsDatas[0].datas.filter(
            (item) =>
            item.type == 'questionBankFolder' &&
            (item.name == '填空题' ||
              item.name == '判断题' ||
              item.name == '单选题' ||
              item.name == '多选题' ||
              item.name == '简答题')
          )
          if (that.data.options.storeInfo == 'jsek_jslx') {
            data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder');
            if (data.length > 0) {
              this.setData({
              that.setData({
                test: data,
                loading: false,
                openTeachids: result,
              });
            } else {
              this.setData({
              that.setData({
                noResources: true,
                loading: false,
              });
            }
          } else {
            data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' && item.childrenFolderCount > 0);
            if (isTSFW.length > 0) {
              data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder' && item.childrenFolderCount > 0)
              that.setData({
                jslx: false,
              });
            } else {
              data = res.datas.cmsDatas[0].datas.filter((item) => item.type == 'questionBankFolder')
              that.setData({
                jslx: true,
              });
            }
            if (data.length > 0) {
              let list = []
              // 测试 6位// 正式 5位//  测试调用传20,内部7  正式调用传17 内部传6
              const addNum = query.cmsPath.length > 10 ? 7 : query.cmsPath.length > 14 ? 8 : 6
              const num = query.cmsPath.length + addNum
              this.getTreeList(data, num, list, '\\', addNum)
              list = this.ensureTreeConsistency(list)
              this.findChildIds(list[0].children, result);
              this.setData({
                test: list[0].children,
              that.getTreeList(data, num, list, '\\', addNum)
              list = that.ensureTreeConsistency(list)
              that.findChildIds(list[0].children, result);
              that.setData({
                test: list.length == 1 && list[0].name == '题库' ? list[0].children : list,
                loading: false,
                openTeachids: result,
              });
            } else {
              this.setData({
              that.setData({
                noResources: true,
                loading: false,
              });
@@ -1265,9 +1283,7 @@
            url,
          });
        }
      } else {
        console.log(222);
      }
      } else {}
    } else {
      wx.showToast({
        title: "商品不在有效期",
@@ -2228,7 +2244,6 @@
            });
            return false;
          } else if (isApply.state == 'Normal') {
            console.log(isApply.state, "isApply.state")
            const flag = new Date(isApply.feedBack.endDate + ' 23:59:59').getTime() > new Date().getTime()
            if (flag) {
              wx.showToast({