wj
litian
2024-10-23 abe52e53bee051e3f801d001c4de58d34a3fefd7
packageBookService/pages/bookServices/detail/components/teachResource/index.js
@@ -1,3 +1,4 @@
const app = getApp();
Component({
  properties: {
    applyState: {
@@ -16,6 +17,9 @@
      type: String,
      value: "",
    },
    md5List: {
      type: Array,
    }
  },
  data: {
    showRejectDialog: false,
@@ -23,6 +27,8 @@
      content: "知道了",
      variant: "base"
    },
    dialogBox: false,
    input: '',
  },
  methods: {
    copy() {
@@ -59,5 +65,53 @@
    uploadBtn() {
      this.triggerEvent("uploadFile", true);
    },
    mailbox() {
      this.setData({
        dialogBox: true
      })
    },
    // 弹窗取消
    closeDialog() {
      this.setData({
        dialogBox: false,
      })
    },
    //提交
    confirmM(e) {
      wx.showLoading({
        title: '发送中...',
      })
      const isEmailValid = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/.test(this.data.input);
      if (isEmailValid && this.data.input) {
        this.setData({
          dialogBox: false
        })
        let query = {
          eMail: this.data.input,
          md5s: this.properties.md5List
        }
        app.MG.file.sendFileWithEmail(query).then(res => {
          wx.hideLoading()
          if (res) {
            wx.showToast({
              icon: 'success',
              title: '邮件已发送',
            })
          }
        })
      } else {
        // 校验不通过,给出错误提示
        wx.showToast({
          title: '邮箱格式不正确',
          icon: 'none',
        });
      }
    },
    inputChange(e) {
      this.setData({
        input: e.detail.value
      })
    },
  },
});