Jelajahi Sumber

修改密码

zhaoke 1 tahun lalu
induk
melakukan
d5c46b5311
1 mengubah file dengan 26 tambahan dan 12 penghapusan
  1. 26 12
      src/layout/components/ChangePassword/index.vue

+ 26 - 12
src/layout/components/ChangePassword/index.vue

@@ -5,7 +5,10 @@
         特殊字符:!、@、#、$、%、^、&、*、(、)、+、{、}、"、:、?、,、.、/、'、;、=、-、\、|
       </div>
       <div class="ruleDesc">
-        密码规则:长度为6-{{securityData.pwd_cons || ''}}个字符,并且必须包含{{renderText}}
+        密码规则:长度为
+        <template v-if="securityData.pwd_cons > 6">6-{{securityData.pwd_cons || ''}}</template>
+        <template v-else>6</template>
+        个字符,并且必须包含{{renderText}}
       </div>
       <el-form ref="formRef" :model="formData" :rules="formRules" label-position="top" class="password-form">
         <el-form-item label="旧密码" prop="old">
@@ -29,7 +32,7 @@ import { useUserStore } from "@/store/user";
 import { ElMessage, FormInstance } from "element-plus";
 import MD5 from "blueimp-md5";
 import { Query } from "@/api/webApi";
-import { onMounted, computed } from "vue";
+import { onMounted, computed, watch } from "vue";
 
 const emit = defineEmits(["logout"]);
 
@@ -59,32 +62,43 @@ const formRules = {
     { validator: repeatValidator, trigger: "blur" },
   ],
 };
+
+watch(
+  () => passwordDialogVisible,
+  (item) => {
+    if (item.value) {
+      getSecurityPolicy();
+    }
+  },
+  { deep: true }
+);
+
 const renderText = computed(() => {
   const renderData = securityData.value;
   if (renderData?.pwd_type) {
     const { pwd_type, pwd_case } = renderData;
+    let str: string = "";
+    if (pwd_case == 1) {
+      str = `(不区分大小写)`;
+    } else {
+      str = `(区分大小写)`;
+    }
     switch (Number(pwd_type)) {
       case 1:
-        return "英文";
+        return `英文${str}`;
         break;
       case 2:
         return "数字";
         break;
       case 3:
-        return "英文、数字";
+        return `英文${str}、数字`;
         break;
       case 4:
-        let str: string = "";
-        if (pwd_case == 1) {
-          str = `(英文不区分大小写)`;
-        } else {
-          str = `(英文区分大小写)`;
-        }
-        return "英文、数字、特殊字符" + str;
+        return `英文${str}、数字、特殊字符`;
         break;
 
       default:
-        return "英文";
+        return `英文${str}`;
         break;
     }
   } else {