const app = getApp(); Component({ properties: { applyState: { type: String, value: "none", }, rejectCause: { type: String, value: "", }, applyResourceLoading: { type: Boolean, value: false, }, deadline: { type: String, value: "", }, md5List: { type: Array, } }, data: { showRejectDialog: false, confirmBtn: { content: "知道了", variant: "base" }, dialogBox: false, input: '', }, methods: { copy() { wx.setClipboardData({ data: "https://jsek.bnuic.com/home/#/home/index", success: function (res) { wx.showToast({ title: "复制成功" }); }, fail: function (res) { console.log(res); }, }); }, applyResource() { var myEventDetail = {}; var myEventOption = { bubbles: true, composed: true, }; // 触发事件的选项 this.triggerEvent("applyResource", myEventDetail, myEventOption); }, showDialog() { this.setData({ showRejectDialog: true, }); }, closeDialog() { this.setData({ 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 }) }, }, });