111
QYF-GitLab1
2025-01-03 2ee8ddb1ecac7df4198e54e08ec7f22daf4b07c0
packageBookService/pages/bookServices/detail/components/teachResource/index.js
@@ -1,3 +1,4 @@
const app = getApp();
Component({
  properties: {
    applyState: {
@@ -16,17 +17,27 @@
      type: String,
      value: "",
    },
    md5List: {
      type: Array,
    }
  },
  data: {
    showRejectDialog: false,
    confirmBtn: { content: "知道了", variant: "base" },
    confirmBtn: {
      content: "知道了",
      variant: "base"
    },
    dialogBox: false,
    input: '',
  },
  methods: {
    copy() {
      wx.setClipboardData({
        data: "http://182.92.203.7:3007/jsek/website/#/home/index",
        data: "https://jsek.bnuic.com/home/#/home/index",
        success: function (res) {
          wx.showToast({ title: "复制成功" });
          wx.showToast({
            title: "复制成功"
          });
        },
        fail: function (res) {
          console.log(res);
@@ -51,5 +62,56 @@
        showRejectDialog: false,
      });
    },
    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
      })
    },
  },
});
});