This commit is contained in:
parent
21173963f9
commit
ec46a7a491
|
|
@ -0,0 +1,13 @@
|
|||
<!-- src/components/layout/Layout.vue -->
|
||||
<template>
|
||||
<div class="app-layout">
|
||||
<!-- 左侧菜单 -->
|
||||
<Sidebar />
|
||||
<!-- 右侧主内容区 -->
|
||||
<div class="main-content">
|
||||
<Header />
|
||||
<!-- 路由视图:渲染当前路由对应的页面(如dashboard/index.vue) -->
|
||||
<router-view />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<template>
|
||||
<div class="test-card">
|
||||
<h1>测试页</h1>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
</script>
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
<template>
|
||||
<Layout>
|
||||
</Layout>
|
||||
</template>
|
||||
|
|
@ -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的函数
|
||||
);
|
||||
|
||||
//把状态同步给子组件
|
||||
|
|
|
|||
|
|
@ -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的函数
|
||||
);
|
||||
|
||||
//把状态同步给子组件
|
||||
|
|
|
|||
|
|
@ -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的函数
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue