bug
litian
2024-09-10 99dfeb5fc86bce593a5d3f43f45c26eedc00ab0a
packageBookService/pages/bookServices/detail/index.js
@@ -169,6 +169,37 @@
      description: '',
      agree: false
    },
    resourceVisible: false,
    resourceValue: [],
    fileTypeList: [{
        label: '音频',
        value: '音频'
      },
      {
        label: '视频',
        value: '视频'
      },
      {
        label: '图片',
        value: '图片'
      },
      {
        label: 'PDF',
        value: 'PDF'
      },
      {
        label: '资源包',
        value: '资源包'
      },
      {
        label: '文档',
        value: '文档'
      },
      {
        label: '其他',
        value: '其他'
      }
    ],
    fileList: [],
    isShowUp: true,
    protocolShow: false,
@@ -193,19 +224,16 @@
      bookId: options.id + "",
      barHeight: systInfo.statusBarHeight,
      navBarHeight: navBarHeight,
    });
    this.setData({
      options: {
        id: options.id,
        name: options.name,
        name: decodeURI(options.name),
        storeInfo: options.storeInfo,
      },
    });
    wx.setNavigationBarTitle({
      title: options.name,
      title: decodeURI(options.name),
    })
    const token = wx.getStorageSync(app.config.tokenKey)
    let token = wx.getStorageSync(app.config.tokenKey)
    if (!token) {
      loginInfo(app, (data) => {
        if (data) {} else {}
@@ -213,7 +241,7 @@
    }
    this.getBookInfo(options.id);
    // this.getResourceClass(); // 获取资源所属分类
    token = wx.getStorageSync(app.config.tokenKey)
    if (token) {
      this.getShoppingCartProductGet();
      this.getApplyInfo(options.id);
@@ -232,10 +260,8 @@
      this.setData({
        tabValue: options.tabValue,
      });
      const checkData = this.data.cmsDatas.find(
        (item) => item.refCode == options.tabValue
      );
      this.getResourceDataList(checkData)
    }
  },
@@ -453,6 +479,16 @@
            })
          }
          await this.getBookClass(classData);
        }
      }
      if (this.data.tabValue == 'questionBank' || this.data.tabValue == 'jsek_cloudLearning' || this.data.tabValue == 'jsek_teachingResources') {
        const checkData = this.data.cmsDatas.find(
          (item) => item.refCode == this.data.tabValue
        );
        if (this.data.tabValue == "questionBank") {
          this.getResourceData(checkData)
        } else {
          this.getResourceDataList(checkData)
        }
      }
@@ -2585,7 +2621,6 @@
    return childrenList
  },
  uploadFile(e) {
    console.log(123)
    this.setData({
      dialogBox: true,
      isShowUp: true
@@ -2594,6 +2629,12 @@
  closeDialog() {
    this.setData({
      dialogBox: false,
      resourceInfo: {
        resourceName: '',
        fileType: '',
        description: '',
        agree: false
      },
    });
  },
  onCloseProtocol() {
@@ -2637,9 +2678,24 @@
      'resourceInfo.resourceName': e.detail.value,
    });
  },
  onFileTypeInput(e) {
  onResourcePicker(e) {
    this.setData({
      'resourceInfo.fileType': e.detail.value,
      resourceVisible: true,
    });
  },
  onPickerChange(e) {
    const {
      value
    } = e.detail;
    this.setData({
      resourceVisible: false,
      resourceValue: value,
      'resourceInfo.fileType': value.join(' '),
    });
  },
  onPickerCancel(e) {
    this.setData({
      resourceVisible: false,
    });
  },
  textareaChange(e) {
@@ -2680,6 +2736,7 @@
        const pdfData = ['pdf']
        const Compression = ['rar', 'zip']
        const pictureData = ['jpg', 'png']
        const documentData = ['doc', 'docx', 'xls', 'xlsx', "ppt", "pptx"]
        if (audioData.indexOf(Extension) > -1) {
          medioType = '音频'
        } else if (videoData.indexOf(Extension) > -1) {
@@ -2690,6 +2747,8 @@
          medioType = '资源包'
        } else if (pictureData.indexOf(Extension) > -1) {
          medioType = '图片'
        } else if (documentData.indexOf(Extension) > -1) {
          medioType = '文档'
        } else {
          medioType = '其他'
        }
@@ -2733,6 +2792,7 @@
                    that.setData({
                      "resourceInfo.resourceName": FileName,
                      "resourceInfo.fileType": medioType,
                      fileList: file,
                      isShowUp: false
                    })
@@ -2747,15 +2807,9 @@
  },
  handleRemove(e) {
    console.log(e)
    let md5 = e.currentTarget.dataset.md5
    for (let i = 0; i < this.data.fileList.length; i++) {
      if (this.data.fileList.md5 == md5) {
        this.data.fileList.splice(i, 1)
      }
    }
    this.setData({
      isShowUp: true,
      fileList: []
    });
  },
  confirmM() {
@@ -2768,7 +2822,7 @@
    if (this.data.resourceInfo.fileType == '') {
      return wx.showToast({
        icon: "error",
        title: "请填写资源类型",
        title: "请选择资源类型",
      });
    }
@@ -2798,9 +2852,7 @@
        icon: "success",
        title: "请上传资源文件",
      });
      this.setData({
        dialogBox: false,
      });
      this.closeDialog()
    })
  }
})