Commit ffd0c18f authored by 以墨为白's avatar 以墨为白 🎧

用户编辑的时候邮件问题

parent 03d4cd4e
...@@ -9,6 +9,10 @@ export const HTTP_STATUS = {message: "服务请求失败", code:9004}; ...@@ -9,6 +9,10 @@ export const HTTP_STATUS = {message: "服务请求失败", code:9004};
/** /**
* 邮件系统 * 邮件系统
*/ */
// export const MAIL_ADDRESS = "http://6.1.22.93:8000";
// export const MAIL_MANAGER_ADDRESS = "http://6.1.22.93:8010";
// export const MAIL_DOMAIN = "zyyt.com"
export const MAIL_ADDRESS = "http://192.168.168.100:8000"; export const MAIL_ADDRESS = "http://192.168.168.100:8000";
export const MAIL_MANAGER_ADDRESS = "http://192.168.168.100:8010"; export const MAIL_MANAGER_ADDRESS = "http://192.168.168.100:8010";
export const MAIL_DOMAIN = "zyyt.com" export const MAIL_DOMAIN = "zyyt.com"
\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
v-text="item.name"> v-text="item.name">
</div> </div>
</div> </div>
<h1><span>业务辅助分析系统</span></h1> <h1><span>东部战区心理战训练系统</span></h1>
<div class="home-date"> <div class="home-date">
<span class="date" v-text="myDate.day"></span>&emsp;&emsp; <span class="date" v-text="myDate.day"></span>&emsp;&emsp;
<span class="week" v-text="myDate.week"></span> <span class="week" v-text="myDate.week"></span>
......
<template> <template>
<div class="homepage"> <div class="homepage">
<div class="header"> <div class="header">
<h1><span>业务辅助分析系统</span></h1> <h1><span>东部战区心理战训练系统</span></h1>
<div> <div>
<span class="date" v-text="myDate.day"></span>&emsp;&emsp; <span class="date" v-text="myDate.day"></span>&emsp;&emsp;
<span class="week" v-text="myDate.week"></span> <span class="week" v-text="myDate.week"></span>
......
<template> <template>
<div class="login"> <div class="login">
<div class="login-head"> <div class="login-head">
<h1><span>业务辅助分析系统</span></h1> <h1><span>东部战区心理战训练系统</span></h1>
<div> <div>
<span class="date" v-text="myDate.day"></span>&emsp;&emsp; <span class="date" v-text="myDate.day"></span>&emsp;&emsp;
<span class="week" v-text="myDate.week"></span> <span class="week" v-text="myDate.week"></span>
......
...@@ -442,7 +442,8 @@ export default { ...@@ -442,7 +442,8 @@ export default {
this.index = index; this.index = index;
}, },
addNew() { addNew() {
this.new_user = {}; //需要注意的是此处尽量不用直接赋值{},会导致watch里面属性的时候出现无法输入的情况
Object.keys(this.new_user).forEach(key => this.new_user[key] = null);
this.type = "add"; this.type = "add";
this.centerDialogVisible = true; this.centerDialogVisible = true;
}, },
...@@ -519,14 +520,9 @@ export default { ...@@ -519,14 +520,9 @@ export default {
}); });
}, },
submit(formName) { submit(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
startLoading(); startLoading();
post("api/rest/system/user/register", this.new_user) this.$refs[formName].validate().then(res => {
.then(res => { if (this.new_user.mail) {
if (res != 1) {
return Promise.reject({ message: "用户新增失败" });
} else if (this.new_user.mail) {
return addUser({ return addUser({
password: this.new_user.password, password: this.new_user.password,
email: this.new_user.mail, email: this.new_user.mail,
...@@ -536,50 +532,46 @@ export default { ...@@ -536,50 +532,46 @@ export default {
} else {//没有输入邮箱 } else {//没有输入邮箱
return Promise.resolve(); return Promise.resolve();
} }
}) }).then(res => {
.then((data) => { post("api/rest/system/user/register", this.new_user)
}).then(res => {
this.$message.success("新增成功!"); this.$message.success("新增成功!");
this.centerDialogVisible = false; this.centerDialogVisible = false;
//再次查询用户名 重新赋值 //再次查询用户名 重新赋值
this.queryUser(); this.queryUser();
endLoading(); endLoading();
}) }).catch(err => {
.catch((err) => {
this.$message.warning(err.message);
endLoading(); endLoading();
}); if (typeof err == "boolean") {
this.$message.warning("数据验证失败");
} else { } else {
return false; this.$message.warning(err.message);
} }
}); });
}, },
submit_edit(formName) { submit_edit(formName) {
this.$refs[formName].validate((valid) => { this.$refs[formName].validate().then(res => {
if (valid) { if (this.edit_user.mail && !this.edit_user.mailReadOnly) {//本次编辑增加了邮箱(如果原本有邮箱则会设置只读)
post("api/rest/system/user/updateUser", this.edit_user)
.then(res => {
if (res != 1) {
return Promise.reject({ message: "用户新增失败" });
} else if (this.edit_user.mail) {
return addUser({ return addUser({
password: "3z111111", password: "3z111111",
email: this.edit_user.mail, email: this.edit_user.mail,
uname: this.edit_user.username, uname: this.edit_user.username,
tel: this.edit_user.telephone tel: this.edit_user.telephone
}); });
} else { } else {//没有或者没有修改
return Promise.resolve(); return Promise.resolve();
} }
}) }).then(res => {
.then((data) => { res || (this.edit_user.mail = null); //没有注册邮箱此处设置为空
return post("api/rest/system/user/updateUser", this.edit_user);
}).then(res => {
this.$message.success("修改成功!"); this.$message.success("修改成功!");
(this.centerDialogVisible = false), this.queryUser(); (this.centerDialogVisible = false), this.queryUser();
}) }).catch(err => {
.catch((err) => { if (typeof err == "boolean") {
this.$message.warning(err.message); this.$message.warning("数据验证失败");
});
} else { } else {
return false; this.$message.warning(err.message);
} }
}); });
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment