From 4c2d41b6998a57b87f50a880d523a9ff23c8cd6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=81=8C=E7=B3=96=E5=8C=85=E5=AD=90?= Date: Fri, 15 May 2026 22:52:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=8D=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E5=BD=A2=E9=AA=8C=E8=AF=81=E7=A0=81=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/debug/CaptchaSandbox.vue | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/views/debug/CaptchaSandbox.vue b/src/views/debug/CaptchaSandbox.vue index 8d8ea2f..18b364f 100644 --- a/src/views/debug/CaptchaSandbox.vue +++ b/src/views/debug/CaptchaSandbox.vue @@ -42,18 +42,15 @@ import { type TianAiCaptchaInstance } from '@/vendor/tianai-captcha' -type CaptchaType = 'RANDOM' | 'SLIDER' | 'ROTATE' | 'ROTATE_DEGREE' | 'CONCAT' | 'IMAGE_CLICK' | 'WORD_IMAGE_CLICK' +type CaptchaType = 'RANDOM' | 'SLIDER' | 'ROTATE' | 'CONCAT' | 'WORD_IMAGE_CLICK' -const baseApiUrl = import.meta.env.VITE_APP_API_BASE -const requestCaptchaBaseUrl = buildApiUrl(baseApiUrl, '/captcha/gen') -const validCaptchaUrl = buildApiUrl(baseApiUrl, '/captcha/check') +const requestCaptchaBaseUrl = buildApiUrl('/captcha/gen') +const validCaptchaUrl = buildApiUrl('/captcha/check') const captchaTypeOptions: Array<{ label: string, value: CaptchaType }> = [ { label: '随机', value: 'RANDOM' }, { label: '滑块拼图', value: 'SLIDER' }, { label: '旋转', value: 'ROTATE' }, - { label: '旋转(角度)', value: 'ROTATE_DEGREE' }, { label: '拼接', value: 'CONCAT' }, - { label: '点选', value: 'IMAGE_CLICK' }, { label: '汉字点选', value: 'WORD_IMAGE_CLICK' }, ] @@ -128,14 +125,9 @@ function destroyCaptcha(showMessage = true) { } } -function buildApiUrl(base: string | undefined, path: string) { - const normalizedBase = (base || '').replace(/\/+$/, '') +function buildApiUrl(path: string) { + const normalizedBase = (import.meta.env.VITE_APP_API_BASE || '').replace(/\/+$/, '') const normalizedPath = path.startsWith('/') ? path : `/${path}` - - if (!normalizedBase) { - return `/api/v2${normalizedPath}` - } - return `${normalizedBase}${normalizedPath}` }