Pārlūkot izejas kodu

重置登录账户密码

huangbin 4 gadi atpakaļ
vecāks
revīzija
e96be68589

+ 10 - 0
src/views/information/account_info/compoments/interface.ts

@@ -6,4 +6,14 @@ export interface BusinessFormState {
     mobile?: string // 手机号码(明文)
     roleids: number[]; // uint64 账号角色
     logintaaccounts: number[],
+}
+
+export interface ResetPasswordFormState {
+    logincode?: string // 登录账号
+    accountname?: string // 账户名称
+    password: string // 登录密码(明文)
+    oldPassword: string //
+    comfirePassword: string
+    mobile?: string // 手机号码(明文)
+    roleids?: number[]; // uint64 账号角色
 }

+ 4 - 4
src/views/information/account_info/compoments/reset-business/index.vue

@@ -64,13 +64,13 @@
 <script lang="ts">
 import { closeModal } from '@/common/setup/modal/index';
 import { defineComponent, ref, PropType, watchEffect } from 'vue';
-import { handleBusinessForm } from './setup';
 import { ErmcpLoginUser } from '@/services/go/ermcp/account/interface';
-import { FormState } from './interface';
+import { ResetPasswordFormState } from '../interface';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { loginAccountOperate } from '@/services/proto/accountinfo';
 import { LoginaccountOperateReq } from '@/services/proto/accountinfo/interface';
 import { validateAction } from '@/common/setup/form';
+import { handlePasswordForm } from '../setup';
 
 export default defineComponent({
     name: 'account_info_business_btn_reset',
@@ -83,7 +83,7 @@ export default defineComponent({
     setup(props, context) {
         // 控制关闭弹窗
         const { visible, cancel } = closeModal('account_info_business_btn_reset');
-        const { rules, formState, formRef } = handleBusinessForm();
+        const { rules, formState, formRef } = handlePasswordForm();
         const loading = ref<boolean>(false);
         watchEffect(() => {
             if (visible.value) {
@@ -92,7 +92,7 @@ export default defineComponent({
         });
 
         function submit() {
-            validateAction<FormState>(formRef, formState).then((res) => {
+            validateAction<ResetPasswordFormState>(formRef, formState).then((res) => {
                 let reqParam: LoginaccountOperateReq = {
                     userid: props.selectedData.userid,
                     loginid: props.selectedData.loginid,

+ 0 - 9
src/views/information/account_info/compoments/reset-business/interface.ts

@@ -1,9 +0,0 @@
-export interface FormState {
-    logincode?: string // 登录账号
-    accountname?: string // 账户名称
-    password: string // 登录密码(明文)
-    oldPassword: string //
-    comfirePassword: string
-    mobile?: string // 手机号码(明文)
-    roleids?: number[]; // uint64 账号角色
-}

+ 0 - 37
src/views/information/account_info/compoments/reset-business/setup.ts

@@ -1,37 +0,0 @@
-import { reactive, ref, UnwrapRef } from "vue";
-import { FormState } from './interface';
-
-
-/**
- * 表单
- * @returns 
- */
-export function handleBusinessForm() {
-    const formRef = ref();
-    const formState: UnwrapRef<FormState> = reactive({
-        accountname: '',
-        password: '',
-        oldPassword: '',
-        comfirePassword: '',
-    })
-    const validatePassword = () => {
-        const { comfirePassword, password } = formState
-        if (comfirePassword && comfirePassword === password) {
-            return Promise.resolve();
-        } else {
-            return Promise.reject('确认新密码错误');
-        }
-    }
-    const rules = {
-        password: [{ required: true, message: '请输入账户密码', trigger: 'blur' }],
-        oldPassword: [{ required: true, message: '请输入原密码', trigger: 'blur' }],
-        comfirePassword: [{ required: true, validator: validatePassword, trigger: 'blur' }],
-
-    }
-    return { rules, formState, formRef }
-}
-
-
-
-
-

+ 4 - 4
src/views/information/account_info/compoments/reset-trader/index.vue

@@ -64,13 +64,13 @@
 <script lang="ts">
 import { closeModal } from '@/common/setup/modal/index';
 import { defineComponent, ref, PropType, watchEffect } from 'vue';
-import { handleBusinessForm } from './setup';
 import { ErmcpLoginUser } from '@/services/go/ermcp/account/interface';
 import { requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
 import { loginAccountOperate } from '@/services/proto/accountinfo';
 import { LoginaccountOperateReq } from '@/services/proto/accountinfo/interface';
-import { FormState } from '../reset-business/interface';
+import { ResetPasswordFormState } from '../interface';
 import { validateAction } from '@/common/setup/form';
+import { handlePasswordForm } from '../setup';
 
 export default defineComponent({
     name: 'account_info_trade_btn_reset',
@@ -83,7 +83,7 @@ export default defineComponent({
     setup(props, context) {
         // 控制关闭弹窗
         const { visible, cancel } = closeModal('account_info_trade_btn_reset');
-        const { rules, formState, formRef } = handleBusinessForm();
+        const { rules, formState, formRef } = handlePasswordForm();
         const loading = ref<boolean>(false);
         watchEffect(() => {
             if (visible.value) {
@@ -92,7 +92,7 @@ export default defineComponent({
         });
 
         function submit() {
-            validateAction<FormState>(formRef, formState).then((res) => {
+            validateAction<ResetPasswordFormState>(formRef, formState).then((res) => {
                 let reqParam: LoginaccountOperateReq = {
                     userid: props.selectedData.userid,
                     loginid: props.selectedData.loginid,

+ 0 - 9
src/views/information/account_info/compoments/reset-trader/interface.ts

@@ -1,9 +0,0 @@
-export interface FormState {
-    logincode?: string // 登录账号
-    accountname?: string // 账户名称
-    password: string // 登录密码(明文)
-    oldPassword: string //
-    comfirePassword: string
-    mobile?: string // 手机号码(明文)
-    roleids?: number[]; // uint64 账号角色
-}

+ 0 - 37
src/views/information/account_info/compoments/reset-trader/setup.ts

@@ -1,37 +0,0 @@
-import { reactive, ref, UnwrapRef } from "vue";
-import { FormState } from './interface';
-
-
-/**
- * 表单
- * @returns 
- */
-export function handleBusinessForm() {
-    const formRef = ref();
-    const formState: UnwrapRef<FormState> = reactive({
-        accountname: '',
-        password: '',
-        oldPassword: '',
-        comfirePassword: '',
-    })
-    const validatePassword = () => {
-        const { comfirePassword, password } = formState
-        if (comfirePassword && comfirePassword === password) {
-            return Promise.resolve();
-        } else {
-            return Promise.reject('确认新密码错误');
-        }
-    }
-    const rules = {
-        password: [{ required: true, message: '请输入账户密码', trigger: 'blur' }],
-        oldPassword: [{ required: true, message: '请输入原密码', trigger: 'blur' }],
-        comfirePassword: [{ required: true, validator: validatePassword, trigger: 'blur' }],
-
-    }
-    return { rules, formState, formRef }
-}
-
-
-
-
-

+ 30 - 1
src/views/information/account_info/compoments/setup.ts

@@ -1,6 +1,6 @@
 import { ErmcpLoginUser, ErmcpLoginUserEx } from "@/services/go/ermcp/account/interface";
 import { reactive, ref, UnwrapRef } from "vue";
-import { BusinessFormState } from './interface';
+import { BusinessFormState, ResetPasswordFormState } from './interface';
 
 
 /**
@@ -49,3 +49,32 @@ export function handleRoleName() {
     }
     return { rolename, getRoleName }
 }
+
+/**
+ * 处理密码表单
+ * @returns 
+ */
+export function handlePasswordForm() {
+    const formRef = ref();
+    const formState: UnwrapRef<ResetPasswordFormState> = reactive({
+        accountname: '',
+        password: '',
+        oldPassword: '',
+        comfirePassword: '',
+    })
+    const validatePassword = () => {
+        const { comfirePassword, password } = formState
+        if (comfirePassword && comfirePassword === password) {
+            return Promise.resolve();
+        } else {
+            return Promise.reject('确认新密码错误');
+        }
+    }
+    const rules = {
+        password: [{ required: true, message: '请输入账户密码', trigger: 'blur' }],
+        oldPassword: [{ required: true, message: '请输入原密码', trigger: 'blur' }],
+        comfirePassword: [{ required: true, validator: validatePassword, trigger: 'blur' }],
+
+    }
+    return { rules, formState, formRef }
+}