From 4cd892e288c08b04f038bf6034c14ec022c0e919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gyq=E7=81=AC=E6=98=8E?= Date: Thu, 5 Dec 2024 07:54:05 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E9=85=8D=E7=BD=AE=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/apis/auth/type.ts | 1 + src/apis/common/captcha.ts | 5 + src/apis/system/type.ts | 5 + src/views/login/components/account/index.vue | 56 ++++--- .../config/components/CaptchaSetting.vue | 151 ++++++++++++++++++ src/views/system/config/index.vue | 5 + 7 files changed, 204 insertions(+), 20 deletions(-) create mode 100644 src/views/system/config/components/CaptchaSetting.vue diff --git a/package.json b/package.json index 42f3b08..ecb4317 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "version": "3.4.0", "private": "true", "scripts": { + "bootstrap": "pnpm install --registry=https://registry.npmmirror.com", "dev": "vite --host", "build": "vue-tsc --noEmit && vite build", "build:test": "vue-tsc --noEmit && vite build --mode test", diff --git a/src/apis/auth/type.ts b/src/apis/auth/type.ts index 578010c..b154ea4 100644 --- a/src/apis/auth/type.ts +++ b/src/apis/auth/type.ts @@ -45,6 +45,7 @@ export interface RouteItem { export interface AccountLoginReq { username: string password: string + unCaptcha: boolean captcha: string uuid: string } diff --git a/src/apis/common/captcha.ts b/src/apis/common/captcha.ts index 29ac1cb..5887f01 100644 --- a/src/apis/common/captcha.ts +++ b/src/apis/common/captcha.ts @@ -5,6 +5,11 @@ export type * from './type' const BASE_URL = '/captcha' +/** @desc 获取图片验证码 */ +export function getCaptchaConfig() { + return http.get(`${BASE_URL}/config`) +} + /** @desc 获取图片验证码 */ export function getImageCaptcha() { return http.get(`${BASE_URL}/image`) diff --git a/src/apis/system/type.ts b/src/apis/system/type.ts index c5fb7a6..96e48d6 100644 --- a/src/apis/system/type.ts +++ b/src/apis/system/type.ts @@ -316,6 +316,11 @@ export interface SecurityConfig { PASSWORD_REQUIRE_SYMBOLS: OptionResp } +/** 安全配置类型 */ +export interface CaptchaSetting { + NEED_CAPTCHA: OptionResp +} + /** 绑定三方账号信息 */ export interface BindSocialAccountRes { source: string diff --git a/src/views/login/components/account/index.vue b/src/views/login/components/account/index.vue index 96e6c1a..3590e4f 100644 --- a/src/views/login/components/account/index.vue +++ b/src/views/login/components/account/index.vue @@ -1,18 +1,18 @@ diff --git a/src/views/system/config/components/CaptchaSetting.vue b/src/views/system/config/components/CaptchaSetting.vue new file mode 100644 index 0000000..5c04e79 --- /dev/null +++ b/src/views/system/config/components/CaptchaSetting.vue @@ -0,0 +1,151 @@ + + + + + diff --git a/src/views/system/config/index.vue b/src/views/system/config/index.vue index 3b4541f..8508951 100644 --- a/src/views/system/config/index.vue +++ b/src/views/system/config/index.vue @@ -15,6 +15,9 @@ + + + @@ -27,6 +30,7 @@ import { useRoute, useRouter } from 'vue-router' import BasicSetting from './components/BasicSetting.vue' import MailSetting from './components/MailSetting.vue' import SecuritySetting from './components/SecuritySetting.vue' +import LoginSetting from './components/CaptchaSetting.vue' defineOptions({ name: 'SystemConfig' }) @@ -34,6 +38,7 @@ const PanMap: Record = { 1: BasicSetting, 2: MailSetting, 3: SecuritySetting, + 4: LoginSetting, } const route = useRoute()