From 2c28ff7b06fca6bf0d9887ca8b7c82a03f83bda0 Mon Sep 17 00:00:00 2001 From: rd <1344903914@qq.com> Date: Fri, 12 Sep 2025 14:06:36 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=8F=91=E9=80=81=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E4=BA=A4=E4=BA=92=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/index.ts | 3 +++ src/stores/modules/user/index.ts | 1 - .../components/change-mobile-modal/index.vue | 6 ++++- .../components/change-name-modal/index.vue | 7 ++++- .../change-password-modal/index.vue | 21 ++++++++++++++- .../change-password-modal/style.scss | 2 ++ .../components/verification-code/index.vue | 2 ++ .../components/management/person/index.vue | 27 ------------------- 8 files changed, 38 insertions(+), 31 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 86bf9a9..dfeca91 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -64,6 +64,9 @@ export class Request { const { data, status } = res; switch (status) { case HttpStatusCode.Success: + if (data.code !== HttpStatusCode.Success) { + message.error(data.message); + } return data; default: return Promise.reject(data); diff --git a/src/stores/modules/user/index.ts b/src/stores/modules/user/index.ts index 9d978e1..4cd8142 100644 --- a/src/stores/modules/user/index.ts +++ b/src/stores/modules/user/index.ts @@ -79,7 +79,6 @@ export const useUserStore = defineStore('user', { const { primary_enterprise } = data; if (!enterpriseStore.enterpriseInfo && !isEmpty(primary_enterprise)) { - console.log('setEnterpriseInfo'); enterpriseStore.setEnterpriseInfo(primary_enterprise); } } diff --git a/src/views/components/management/person/components/change-mobile-modal/index.vue b/src/views/components/management/person/components/change-mobile-modal/index.vue index 7592b7f..bad2197 100644 --- a/src/views/components/management/person/components/change-mobile-modal/index.vue +++ b/src/views/components/management/person/components/change-mobile-modal/index.vue @@ -16,7 +16,7 @@ :wrapperCol="{ span: 19 }" > - + @@ -54,6 +54,7 @@ import { useUserStore } from '@/stores'; const store = useUserStore(); const formRef = ref(); +const inputRef = ref(); const visible = ref(false); const timer = ref(); const isLegalMobile = ref(false); @@ -112,6 +113,9 @@ const canGetCaptcha = computed(() => { // 打开弹窗 const open = () => { visible.value = true; + nextTick(() => { + inputRef.value?.focus(); + }); }; // 发送验证码 diff --git a/src/views/components/management/person/components/change-name-modal/index.vue b/src/views/components/management/person/components/change-name-modal/index.vue index 97984a6..b7c54fe 100644 --- a/src/views/components/management/person/components/change-name-modal/index.vue +++ b/src/views/components/management/person/components/change-name-modal/index.vue @@ -10,7 +10,7 @@ >
- +
@@ -29,6 +29,7 @@ import { useUserStore } from '@/stores'; const store = useUserStore(); const formRef = ref(); +const inputRef = ref(); const visible = ref(false); const submitLoading = ref(false); const form = ref({ @@ -39,6 +40,10 @@ const form = ref({ const open = (userName) => { form.value.name = userName; visible.value = true; + + nextTick(() => { + inputRef.value?.focus(); + }); }; // 确定按钮点击 diff --git a/src/views/components/management/person/components/change-password-modal/index.vue b/src/views/components/management/person/components/change-password-modal/index.vue index ab71f64..c9eba78 100644 --- a/src/views/components/management/person/components/change-password-modal/index.vue +++ b/src/views/components/management/person/components/change-password-modal/index.vue @@ -57,6 +57,12 @@
+ + @@ -64,8 +70,10 @@ import { computed, ref } from 'vue'; import { Button, Form, FormItem, Input, message, Modal } from 'ant-design-vue'; import VerificationCode from '../verification-code/index.vue'; +import PuzzleVerification from '@/views/login/components/PuzzleVerification.vue'; import { postUpdatePasswordCaptcha, postUpdatePassword } from '@/api/all/login'; +import { postClearRateLimiter } from '@/api/all/common'; import icon1 from '@/assets/img/login/icon-close.png'; import icon2 from '@/assets/img/login/icon-open.png'; @@ -75,7 +83,7 @@ const visible = ref(false); const phone = ref(''); const isCheckPass = ref(false); const formRef = ref(null); - +const isVerificationVisible = ref(false); // 验证码输入相关 const countdown = ref(0); const timer = ref(null); @@ -146,9 +154,20 @@ const getCaptcha = async () => { // 重置倒计时 countdown.value = 0; clearInterval(timer.value); + + if (error.status === 429) { + isVerificationVisible.value = true; + } } }; +const handleVerificationSubmit = async () => { + isVerificationVisible.value = false; + verificationCodeRef.value?.init(); + await postClearRateLimiter(); + getCaptcha(); +}; + // 开始倒计时 const startCountdown = () => { countdown.value = 60; diff --git a/src/views/components/management/person/components/change-password-modal/style.scss b/src/views/components/management/person/components/change-password-modal/style.scss index aa2630c..b1fb1dc 100644 --- a/src/views/components/management/person/components/change-password-modal/style.scss +++ b/src/views/components/management/person/components/change-password-modal/style.scss @@ -45,6 +45,8 @@ .ant-input-affix-wrapper { border-radius: 8px !important; + + } } } diff --git a/src/views/components/management/person/components/verification-code/index.vue b/src/views/components/management/person/components/verification-code/index.vue index f586963..0e2b762 100644 --- a/src/views/components/management/person/components/verification-code/index.vue +++ b/src/views/components/management/person/components/verification-code/index.vue @@ -127,6 +127,8 @@ defineExpose({ init }); border: 1px solid #d7d7d9; outline: none; + caret-color: #6d4cfe; + &:hover { border-color: #6d4cfe !important; } diff --git a/src/views/components/management/person/index.vue b/src/views/components/management/person/index.vue index 2914712..e44ddcd 100644 --- a/src/views/components/management/person/index.vue +++ b/src/views/components/management/person/index.vue @@ -137,21 +137,6 @@ const changePasswordModalRef = ref(null); const changeNameModalRef = ref(null); const changeMobileModalRef = ref(null); -// const userInfo = computed(() => { -// return store.userInfo ?? {}; -// }); - -const columns = [ - { - title: '用户信息', - slotName: 'info', - }, - { - title: '手机号', - slotName: 'mobile', - }, -]; - const infoVisible = ref(false); const imageVisible = ref(false); const mobileVisible = ref(false); @@ -290,18 +275,6 @@ async function handleVerificationSubmit() { beginCountdown(); } -async function handleUpdateMobile() { - if (!isSendCaptcha.value) { - message.error('请先获取验证码!'); - return false; - } - const res = await formRef.value.validate(); - if (res === true || res === undefined) { - await updateMobile(form); - message.success('修改成功!'); - } -} - function getFileExtension(filename: string): string { const match = filename.match(/\.([^.]+)$/); return match ? match[1].toLowerCase() : '';