This commit is contained in:
Mrx
2026-02-28 11:36:26 +08:00
parent ca575800ba
commit 653e1357ac
2 changed files with 24 additions and 18 deletions

View File

@@ -59,6 +59,7 @@ async function sendVerificationCode() {
} }
} }
); );
} }
function startCountdown() { function startCountdown() {

View File

@@ -6,11 +6,13 @@ import { useAgentStore } from '@/stores/agentStore'
import { useUserStore } from '@/stores/userStore' import { useUserStore } from '@/stores/userStore'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import useApiFetch from '@/composables/useApiFetch' import useApiFetch from '@/composables/useApiFetch'
import { useAliyunCaptcha } from '@/composables/useAliyunCaptcha'
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const agentStore = useAgentStore() const agentStore = useAgentStore()
const userStore = useUserStore() const userStore = useUserStore()
const { runWithCaptcha } = useAliyunCaptcha()
const appName = import.meta.env.VITE_APP_NAME || '全能查'; const appName = import.meta.env.VITE_APP_NAME || '全能查';
const phoneNumber = ref('') const phoneNumber = ref('')
@@ -84,12 +86,14 @@ async function sendVerificationCode() {
return return
} }
const { data, error } = await useApiFetch('auth/sendSms') // 使用滑块验证码保护发送短信接口
.post({ mobile: phoneNumber.value, actionType: 'agentApply' }) runWithCaptcha(
.json() (captchaVerifyParam) =>
useApiFetch('auth/sendSms')
if (data.value && !error.value) { .post({ mobile: phoneNumber.value, actionType: 'agentApply', captchaVerifyParam })
if (data.value.code === 200) { .json(),
(res) => {
if (res.code === 200) {
showToast({ message: "获取成功" }); showToast({ message: "获取成功" });
startCountdown() startCountdown()
// 聚焦到验证码输入框 // 聚焦到验证码输入框
@@ -100,9 +104,10 @@ async function sendVerificationCode() {
} }
}); });
} else { } else {
showToast(data.value.msg) showToast(res.msg || "获取验证码失败")
} }
} }
);
} }
function startCountdown() { function startCountdown() {