From 6af68085ff6615e1ec3a5dd18c761250800d6fca Mon Sep 17 00:00:00 2001
From: LiuHao <liuhaoai545@gmail.com>
Date: 星期二, 06 六月 2023 22:23:43 +0800
Subject: [PATCH] update 修改页面代码 去除ele的引入以及vue的类型声明

---
 src/views/system/user/profile/resetPwd.vue |   70 ++++++++++++++++++----------------
 1 files changed, 37 insertions(+), 33 deletions(-)

diff --git a/src/views/system/user/profile/resetPwd.vue b/src/views/system/user/profile/resetPwd.vue
index 0207342..11b00f6 100644
--- a/src/views/system/user/profile/resetPwd.vue
+++ b/src/views/system/user/profile/resetPwd.vue
@@ -1,18 +1,31 @@
+<template>
+  <el-form ref="pwdRef" :model="user" :rules="rules" label-width="80px">
+    <el-form-item label="鏃у瘑鐮�" prop="oldPassword">
+      <el-input v-model="user.oldPassword" placeholder="璇疯緭鍏ユ棫瀵嗙爜" type="password" show-password />
+    </el-form-item>
+    <el-form-item label="鏂板瘑鐮�" prop="newPassword">
+      <el-input v-model="user.newPassword" placeholder="璇疯緭鍏ユ柊瀵嗙爜" type="password" show-password />
+    </el-form-item>
+    <el-form-item label="纭瀵嗙爜" prop="confirmPassword">
+      <el-input v-model="user.confirmPassword" placeholder="璇风‘璁ゆ柊瀵嗙爜" type="password" show-password />
+    </el-form-item>
+    <el-form-item>
+      <el-button type="primary" @click="submit">淇濆瓨</el-button>
+      <el-button type="danger" @click="close">鍏抽棴</el-button>
+    </el-form-item>
+  </el-form>
+</template>
+
 <script setup lang="ts">
-import { updateUserPwd } from '@/api/system/user';
-import { ComponentInternalInstance } from 'vue';
-import { ResetPwdForm } from '@/api/system/user/types'
-import { ElForm } from 'element-plus';
+import { updateUserPwd } from "@/api/system/user";
+import type { ResetPwdForm } from "@/api/system/user/types";
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-
-
-const pwdRef = ref(ElForm);
-
+const pwdRef = ref<ElFormInstance>();
 const user = ref<ResetPwdForm>({
-  oldPassword: '',
-  newPassword: '',
-  confirmPassword: ''
+  oldPassword: "",
+  newPassword: "",
+  confirmPassword: ""
 });
 
 const equalToPassword = (rule: any, value: string, callback: any) => {
@@ -24,15 +37,24 @@
 };
 const rules = ref({
   oldPassword: [{ required: true, message: "鏃у瘑鐮佷笉鑳戒负绌�", trigger: "blur" }],
-  newPassword: [{ required: true, message: "鏂板瘑鐮佷笉鑳戒负绌�", trigger: "blur" }, { min: 6, max: 20, message: "闀垮害鍦� 6 鍒� 20 涓瓧绗�", trigger: "blur" }],
-  confirmPassword: [{ required: true, message: "纭瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" }, { required: true, validator: equalToPassword, trigger: "blur" }]
+  newPassword: [{ required: true, message: "鏂板瘑鐮佷笉鑳戒负绌�", trigger: "blur" }, {
+    min: 6,
+    max: 20,
+    message: "闀垮害鍦� 6 鍒� 20 涓瓧绗�",
+    trigger: "blur"
+  }],
+  confirmPassword: [{ required: true, message: "纭瀵嗙爜涓嶈兘涓虹┖", trigger: "blur" }, {
+    required: true,
+    validator: equalToPassword,
+    trigger: "blur"
+  }]
 });
 
 /** 鎻愪氦鎸夐挳 */
 const submit = () => {
-  pwdRef.value.validate(async (valid: boolean) => {
+  pwdRef.value?.validate(async (valid: boolean) => {
     if (valid) {
-      await updateUserPwd(user.value.oldPassword, user.value.newPassword)
+      await updateUserPwd(user.value.oldPassword, user.value.newPassword);
       proxy?.$modal.msgSuccess("淇敼鎴愬姛");
     }
   });
@@ -42,21 +64,3 @@
   proxy?.$tab.closePage();
 };
 </script>
-
-<template>
-	<el-form ref="pwdRef" :model="user" :rules="rules" label-width="80px">
-		<el-form-item label="鏃у瘑鐮�" prop="oldPassword">
-			<el-input v-model="user.oldPassword" placeholder="璇疯緭鍏ユ棫瀵嗙爜" type="password" show-password />
-		</el-form-item>
-		<el-form-item label="鏂板瘑鐮�" prop="newPassword">
-			<el-input v-model="user.newPassword" placeholder="璇疯緭鍏ユ柊瀵嗙爜" type="password" show-password />
-		</el-form-item>
-		<el-form-item label="纭瀵嗙爜" prop="confirmPassword">
-			<el-input v-model="user.confirmPassword" placeholder="璇风‘璁ゆ柊瀵嗙爜" type="password" show-password />
-		</el-form-item>
-		<el-form-item>
-			<el-button type="primary" @click="submit">淇濆瓨</el-button>
-			<el-button type="danger" @click="close">鍏抽棴</el-button>
-		</el-form-item>
-	</el-form>
-</template>

--
Gitblit v1.9.3