提交 9c47af20 编写于 作者: yma16's avatar yma16

feat:反馈邮件功能

上级 85d0cec1
...@@ -179,9 +179,9 @@ export default { ...@@ -179,9 +179,9 @@ export default {
const that = this; const that = this;
let clientIp = "未知"; let clientIp = "未知";
try { try {
console.log("ip待定"); console.warn("ip待定");
} catch (e) { } catch (e) {
console.log(e); console.warn(e);
} }
that.$axios that.$axios
.post(this.baseUrl + "count/add/", { .post(this.baseUrl + "count/add/", {
......
...@@ -207,7 +207,7 @@ ...@@ -207,7 +207,7 @@
</div> </div>
</div> </div>
<template> <template>
<Email v-if="drawObj.show" :drawObj="drawObj"></Email> <Email :drawObj="drawObj"></Email>
</template> </template>
</div> </div>
</template> </template>
......
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
msgDrawTitle: "~邮件沟通~", msgDrawTitle: "~邮件沟通~",
direction: "rtl", direction: "rtl",
msgDraw: false, msgDraw: false,
baseUrl: "http://localhost:8006/", baseUrl: "/api/",
basePath: "send-email/", basePath: "send-email/",
loading: false, loading: false,
emailForm: { emailForm: {
...@@ -93,10 +93,10 @@ export default { ...@@ -93,10 +93,10 @@ export default {
/^([0-9a-zA-Z_\.\-\])+\@([0-9a-zA-Z_\.\-\])+\.([a-zA-Z]+)$/; /^([0-9a-zA-Z_\.\-\])+\@([0-9a-zA-Z_\.\-\])+\.([a-zA-Z]+)$/;
let testEmail = patter.test(value); let testEmail = patter.test(value);
if (!testEmail) { if (!testEmail) {
return Promise.reject("请输入正确的邮箱格式"); return Promise.reject("邮箱格式有误");
} }
} }
return Promise.resolve(); return Promise.resolve("");
}, },
trigger: "blur", trigger: "blur",
}, },
...@@ -115,13 +115,14 @@ export default { ...@@ -115,13 +115,14 @@ export default {
}, },
methods: { methods: {
//关闭抽屉 //关闭抽屉
handleDrawClose(done) { handleDrawClose() {
const that = this; const that = this;
that.drawObj.show = false; that.drawObj.show = false;
}, },
// 发送消息 // 发送消息
sendEmail(formName) { sendEmail(formName) {
// 发送email内容 // 发送email内容
try {
const that = this; const that = this;
that.loading = true; that.loading = true;
that.$refs[formName].validate((valid) => { that.$refs[formName].validate((valid) => {
...@@ -133,14 +134,21 @@ export default { ...@@ -133,14 +134,21 @@ export default {
}; };
try { try {
axios.post(that.baseUrl + that.basePath, params).then((res) => { axios.post(that.baseUrl + that.basePath, params).then((res) => {
if (res && res.code && res.code === 20000) { console.log(res);
if (
res &&
res.data &&
res.data.code &&
res.data.code === 20000
) {
that.loading = false; that.loading = false;
that.$message({ that.$message({
message: "邮件发送成功!", message: "邮件发送成功!",
type: "success", type: "success",
}); });
that.drawObj.show = false; that.drawObj.show = false;
}else{ } else {
that.loading = false;
that.$message({ that.$message({
message: "邮件发送失败!", message: "邮件发送失败!",
type: "warning", type: "warning",
...@@ -155,6 +163,10 @@ export default { ...@@ -155,6 +163,10 @@ export default {
that.loading = false; that.loading = false;
} }
}); });
} catch (r) {
that.loading = false;
throw Error(r);
}
}, },
}, },
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册