diff --git a/src/components/layout/Header.vue b/src/components/layout/Header.vue new file mode 100644 index 0000000..e69de29 diff --git a/src/components/layout/Sidebar.vue b/src/components/layout/Sidebar.vue new file mode 100644 index 0000000..e69de29 diff --git a/src/components/layout/index.vue b/src/components/layout/index.vue new file mode 100644 index 0000000..6a0d6ed --- /dev/null +++ b/src/components/layout/index.vue @@ -0,0 +1,13 @@ + + \ No newline at end of file diff --git a/src/views/Test/index.vue b/src/views/Test/index.vue deleted file mode 100644 index 8f180ec..0000000 --- a/src/views/Test/index.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue new file mode 100644 index 0000000..927f694 --- /dev/null +++ b/src/views/dashboard/index.vue @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/src/views/user/ChangePassword.vue b/src/views/user/ChangePassword.vue index 63ffe4f..83fea73 100644 --- a/src/views/user/ChangePassword.vue +++ b/src/views/user/ChangePassword.vue @@ -134,6 +134,20 @@ watch( { immediate: false } // 关键:关闭立即执行,避免刷新时触发 ) +// 定义发送验证码接口 +const sendCodeApi = async () => { + // 发送验证码参数 + const sendParams = { + email: changePasswordForm.value.email, + mobile: changePasswordForm.value.phone, + reg_type: activeTab.value === 'email' ? 1 : 2, + type:'resetPass_code' + } + return userStore.sendCode(sendParams) +} + + + //发送验证码 const handleSendCode = async () => { const currentType = activeTab.value @@ -141,14 +155,13 @@ const handleSendCode = async () => { const type: string = currentType || 'email' const receiver = type === 'phone' ? changePasswordForm.value.phone : changePasswordForm.value.email; const currentCaptchaState = type === 'phone' ? phoneCaptchaState : emailCaptchaState; - const sendFunc = type === 'phone' ? "sendPhoneCaptcha" : "sendEmailCaptcha"; // 第三步:调用封装的发送函数(传正确的函数,而非字符串) await sendCaptcha( type, receiver, currentCaptchaState, // 只更新当前类型的倒计时状态 - sendFunc // 传入返回Promise的函数 + () => sendCodeApi() // 传入返回Promise的函数 ); //把状态同步给子组件 diff --git a/src/views/user/ForgotPassword.vue b/src/views/user/ForgotPassword.vue index 147d942..eaaa150 100644 --- a/src/views/user/ForgotPassword.vue +++ b/src/views/user/ForgotPassword.vue @@ -150,6 +150,18 @@ watch(activeTab, (newTab) => { } }) +// 定义发送验证码接口 +const sendCodeApi = async () => { + // 发送验证码参数 + const sendParams = { + email: forgotPasswordForm.value.email, + mobile: forgotPasswordForm.value.phone, + reg_type: getStorage('forgotType', 'session') === 'email' ? 1 : 2, + type:'transfer_code' + } + return userStore.sendCode(sendParams) +} + //发送验证码 const handleSendCode = async () => { // 第二步:确定类型、接收方、对应的倒计时状态和发送函数 @@ -163,7 +175,7 @@ const handleSendCode = async () => { type, receiver, currentCaptchaState, // 只更新当前类型的倒计时状态 - sendFunc // 传入返回Promise的函数 + () => sendCodeApi() // 传入返回Promise的函数 ); //把状态同步给子组件 diff --git a/src/views/user/Register.vue b/src/views/user/Register.vue index b97b683..93b8e6f 100644 --- a/src/views/user/Register.vue +++ b/src/views/user/Register.vue @@ -111,7 +111,17 @@ const { isCounting: phoneIsCounting, countdown: phoneCountdown } = phoneCaptchaS //方法 - +// 定义发送验证码接口 +const sendCodeApi = async () => { + // 发送验证码参数 + const sendParams = { + email: registerForm.value.email, + mobile: registerForm.value.phone, + reg_type: activeTab.value === 'email' ? 1 : 2, + type:'resetPass_code' + } + return userStore.sendCode(sendParams) +} //发送验证码 const handleSendCode = async () => { if (!registerFormRef.value) return @@ -133,7 +143,7 @@ const handleSendCode = async () => { type, receiver, currentCaptchaState, // 只更新当前类型的倒计时状态 - sendFunc // 传入返回Promise的函数 + () => sendCodeApi() // 传入返回Promise的函数 ); }