Sfoglia il codice sorgente

更新 邮箱配置

wzg 1 anno fa
parent
commit
41e7e9b2da
1 ha cambiato i file con 14 aggiunte e 15 eliminazioni
  1. 14 15
      src/views/toolManage/emailConfig.vue

+ 14 - 15
src/views/toolManage/emailConfig.vue

@@ -13,10 +13,10 @@
           placeholder="请输入用户名"
         ></el-input>
       </el-form-item>
-      <el-form-item label="新密码" prop="newPassword">
+      <el-form-item label="邮箱密码" prop="password">
         <el-input
           class="w500"
-          v-model="ruleForm.newPassword"
+          v-model="ruleForm.password"
           placeholder="请输入新密码"
         ></el-input>
       </el-form-item>
@@ -72,7 +72,6 @@ const ruleFormRef = ref(null);
 const ruleForm = ref({
   username: "",
   from: "",
-  newPassword: "",
   password: "",
   smtpHost: "",
   smtpPort: 0,
@@ -82,7 +81,6 @@ const rules = ref({});
 async function getEmailConfig() {
   let { data } = await api.getEmailConfig();
   ruleForm.value = data.result;
-  console.log(data);
 }
 async function updateEmailConfig() {
   ElMessageBox.confirm("确认更新邮箱配置", "提示", {
@@ -90,20 +88,21 @@ async function updateEmailConfig() {
     cancelButtonText: "取消",
     type: "warning",
   }).then(async () => {
-    if (
-      md5(md5(ruleForm.value.newPassword)) === ruleForm.value.password ||
-      ruleForm.value.newPassword === ""
-    ) {
-      delete ruleForm.value.password;
-      delete ruleForm.value.newPassword;
-    } else {
-      ruleForm.value.password = md5(md5(ruleForm.value.newPassword));
-      delete ruleForm.value.newPassword;
-    }
+    const loading = ElLoading.service({
+      text: "正在更新邮箱配置...",
+      lock: true,
+      background: "rgba(0, 0, 0, 0.7)",
+      fullscreen: true,
+    });
     let { data } = await api.updateEmailConfig({
       ...ruleForm.value,
     });
-    console.log(data);
+    ElNotification({
+      title: "提示",
+      message: data.msg,
+    });
+    loading.close();
+    ruleForm.value = data.result;
   });
 }