From 1cb01720589cba3f8944eebb35457d30ee4658f8 Mon Sep 17 00:00:00 2001 From: Charles7c Date: Sat, 19 Oct 2024 14:51:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E3=80=81=E9=82=AE=E7=AE=B1=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E7=BC=BA=E5=A4=B1=E8=A1=8C=E4=B8=BA=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E5=8F=82=E6=95=B0=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/common/captcha.ts | 8 ++++---- src/apis/common/type.ts | 6 ++++++ src/views/setting/components/VerifyModel.vue | 12 ++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/apis/common/captcha.ts b/src/apis/common/captcha.ts index 692650f..29ac1cb 100644 --- a/src/apis/common/captcha.ts +++ b/src/apis/common/captcha.ts @@ -11,13 +11,13 @@ export function getImageCaptcha() { } /** @desc 获取短信验证码 */ -export function getSmsCaptcha(query: { phone: string }) { - return http.get(`${BASE_URL}/sms`, query) +export function getSmsCaptcha(phone: string, captchaReq: T.BehaviorCaptchaReq) { + return http.get(`${BASE_URL}/sms?phone=${phone}&captchaVerification=${encodeURIComponent(captchaReq.captchaVerification || '')}`) } /** @desc 获取邮箱验证码 */ -export function getEmailCaptcha(query: { email: string }) { - return http.get(`${BASE_URL}/mail`, query) +export function getEmailCaptcha(email: string, captchaReq: T.BehaviorCaptchaReq) { + return http.get(`${BASE_URL}/mail?email=${email}&captchaVerification=${encodeURIComponent(captchaReq.captchaVerification || '')}`) } /** @desc 获取行为验证码 */ diff --git a/src/apis/common/type.ts b/src/apis/common/type.ts index ce7d3a3..638737f 100644 --- a/src/apis/common/type.ts +++ b/src/apis/common/type.ts @@ -38,6 +38,12 @@ export interface BehaviorCaptchaResp { wordList: string[] } +export interface BehaviorCaptchaReq { + captchaType?: string + captchaVerification?: string + clientUid?: string +} + export interface CheckBehaviorCaptchaResp { repCode: string repMsg: string diff --git a/src/views/setting/components/VerifyModel.vue b/src/views/setting/components/VerifyModel.vue index a100832..bf98126 100644 --- a/src/views/setting/components/VerifyModel.vue +++ b/src/views/setting/components/VerifyModel.vue @@ -19,7 +19,7 @@ import { useWindowSize } from '@vueuse/core' import { Message } from '@arco-design/web-vue' import NProgress from 'nprogress' -import { getEmailCaptcha, updateUserEmail, updateUserPassword, updateUserPhone } from '@/apis' +import { type BehaviorCaptchaReq, getEmailCaptcha, updateUserEmail, updateUserPassword, updateUserPhone } from '@/apis' import { encryptByRsa } from '@/utils/encrypt' import { useUserStore } from '@/stores' import { type Columns, GiForm, type Options } from '@/components/GiForm' @@ -173,19 +173,15 @@ const reset = () => { } // 获取验证码 -const getCaptcha = async () => { +const getCaptcha = async (captchaReq: BehaviorCaptchaReq) => { // 发送验证码 try { captchaLoading.value = true captchaBtnName.value = '发送中...' if (verifyType.value === 'phone') { - // await getSmsCaptcha({ - // phone: form.phone - // }) + // await getSmsCaptcha(form.phone, captchaReq) } else if (verifyType.value === 'email') { - await getEmailCaptcha({ - email: form.email - }) + await getEmailCaptcha(form.email, captchaReq) } captchaLoading.value = false captchaDisable.value = true