yiming
2024-04-11 a9bd2df4da1cf7b198db7bf2d67ce8adbbe89b32
pages/bibliographyList/index.js
@@ -7,6 +7,11 @@
     * 页面的初始数据
     */
    data: {
      input: '',
      dialogKey: '',
      showWithInput: false,
      showTextAndTitleWithInput: false,
      downloadLoadin: false,
      isMore: null,
      higherList: [],
      vocationalList: [],
@@ -19,7 +24,11 @@
      navBarHeight: '',
      start: 1,
      tabValue: '',
      keyword: ''
      keyword: '',
      Md5: '',
      emailError: false,
      loading: true, //开启骨架屏加载
      hidden: true, //是否展示内容
    },
    /**
@@ -38,9 +47,10 @@
        barHeight: systInfo.statusBarHeight,
      })
      let event =
      {
        detail: { value: "0" }
      let event = {
        detail: {
          value: "0"
        }
      }
      this.onTabsChange(event)
@@ -166,8 +176,13 @@
          higherTotal: res.total
        })
        console.log(this.data.higherList, '5555');
        this.setData({
          loading: false, //开启骨架屏加载
          hidden: false, //是否展示内容
        })
      })
      wx.stopPullDownRefresh()
    },
@@ -247,12 +262,13 @@
          teacherList: res.datas,
          teacherTotal: res.total
        })
      })
      wx.stopPullDownRefresh()
    },
    downloadData(event) {
      this.setData({
        downloadLoadin: true
      })
      console.log(111);
      const item = event.currentTarget.dataset.item;
      // console.log(item.datas.freeFile.Value);
@@ -282,6 +298,11 @@
          console.log('下载文件失败', res);
        }
      });
      setTimeout(() => {
        this.setData({
          downloadLoadin: false
        });
      }, 2000);
    },
    onSearchSubmit: function (e) {
      const keyword = e.detail.value;
@@ -290,7 +311,6 @@
      this.higherGet(keyword)
      this.vocationalGet(keyword)
      this.teacherGet(keyword)
    },
@@ -365,20 +385,81 @@
    },
    onPullDownRefresh() {
      let keyword = this.data.value
      this.setData({
        start: 1,
      })
      this.higherGet(keyword)
      this.vocationalGet(keyword)
      this.teacherGet(keyword)
    },
    // 邮箱点击
    mailbox(e) {
      const key = e.currentTarget.dataset.key;
      const item = e.currentTarget.dataset.item;
      this.setData({
        [key]: true,
        dialogKey: key,
        input: '',
        Md5: item.datas.freeFile.FileList[0].Md5
      });
    },
    onEmailInput(e) {
      const isEmailValid = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/.test(e.detail.value);
      this.setData({
        emailError: !isEmailValid,
        "input": e.detail.value,
      });
    },
    //弹窗确认
    onConfirm() {
      if (!this.data.emailError && this.data.input) {
        const {
          dialogKey
        } = this.data;
        this.setData({
          [dialogKey]: false
        });
        console.log(this.data.input);
        console.log(this.data.Md5);
        if (this.data.input) {
          let query = {
            eMail: this.data.input,
            md5s: [this.data.Md5]
          }
          app.MG.file.sendFileWithEmail(query).then(res => {
            console.log(res);
          })
        }
      } else {
        // 校验不通过,给出错误提示
        wx.showToast({
          title: '邮箱格式不正确',
          icon: 'none',
        });
      }
    },
    // 弹窗取消
    closeDialog() {
      const {
        dialogKey
      } = this.data;
      this.setData({
        [dialogKey]: false
      });
      console.log(111);
    },
  })