From 9715087b54437a68e1a3c78d268a832ec92ecd81 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 4 Sep 2022 17:44:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=90=8E=E5=8F=B0=E7=9A=84?= =?UTF-8?q?=20uniapp=20=E9=AA=8C=E8=AF=81=E7=A0=81=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao-spring-boot-starter-captcha/pom.xml | 6 +++--- .../yudao/framework/captcha/package-info.java | 2 +- .../yudao-module-system-biz/pom.xml | 10 +++++----- .../admin/auth/vo/AuthLoginReqVO.java | 2 ++ yudao-ui-admin-uniapp/config.js | 2 +- yudao-ui-admin-uniapp/pages/login.vue | 17 +++++++++++------ 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/pom.xml b/yudao-framework/yudao-spring-boot-starter-captcha/pom.xml index 83ee5e5ba..c2d237406 100644 --- a/yudao-framework/yudao-spring-boot-starter-captcha/pom.xml +++ b/yudao-framework/yudao-spring-boot-starter-captcha/pom.xml @@ -13,7 +13,7 @@ ${project.artifactId} 验证码拓展 - 1. 基于 aj-captcha 实现图形验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/ + 1. 基于 aj-captcha 实现滑块验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/ @@ -25,8 +25,8 @@ - org.springframework.boot - spring-boot-starter-data-redis + cn.iocoder.boot + yudao-spring-boot-starter-redis diff --git a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/package-info.java b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/package-info.java index 5fd8a52ba..e78d9eab2 100644 --- a/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/package-info.java +++ b/yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/package-info.java @@ -1,6 +1,6 @@ /** * 验证码拓展 - * 1. 基于 aj-captcha 实现图形验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/ + * 1. 基于 aj-captcha 实现滑块验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/ * * @author 星语 */ diff --git a/yudao-module-system/yudao-module-system-biz/pom.xml b/yudao-module-system/yudao-module-system-biz/pom.xml index 0963bd77b..ecac34aa5 100644 --- a/yudao-module-system/yudao-module-system-biz/pom.xml +++ b/yudao-module-system/yudao-module-system-biz/pom.xml @@ -72,11 +72,6 @@ yudao-spring-boot-starter-redis - - cn.iocoder.boot - yudao-spring-boot-starter-captcha - - cn.iocoder.boot @@ -102,6 +97,11 @@ yudao-spring-boot-starter-excel + + cn.iocoder.boot + yudao-spring-boot-starter-captcha + + diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthLoginReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthLoginReqVO.java index 346ce78c7..bafc322e2 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthLoginReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthLoginReqVO.java @@ -33,6 +33,8 @@ public class AuthLoginReqVO { @Length(min = 4, max = 16, message = "密码长度为 4-16 位") private String password; + // ========== 图片验证码相关 ========== + @ApiModelProperty(value = "验证码", required = true, example = "PfcH6mgr8tpXuMWFjvW6YVaqrswIuwmWI5dsVZSg7sGpWtDCUbHuDEXl3cFB1+VvCC/rAkSwK8Fad52FSuncVg==", notes = "验证码开启时,需要传递") diff --git a/yudao-ui-admin-uniapp/config.js b/yudao-ui-admin-uniapp/config.js index 410abe155..d8d38e8d2 100644 --- a/yudao-ui-admin-uniapp/config.js +++ b/yudao-ui-admin-uniapp/config.js @@ -2,7 +2,7 @@ module.exports = { // baseUrl: 'http://localhost:8080', baseUrl: 'http://localhost:48080', - baseApi: 'admin-api', + baseApi: '/admin-api', // 应用信息 appInfo: { // 应用名称 diff --git a/yudao-ui-admin-uniapp/pages/login.vue b/yudao-ui-admin-uniapp/pages/login.vue index 710aba5d4..bb7908eb9 100644 --- a/yudao-ui-admin-uniapp/pages/login.vue +++ b/yudao-ui-admin-uniapp/pages/login.vue @@ -39,7 +39,7 @@ }, data() { return { - captchaEnabled: true, + captchaEnabled: true, // 验证码开关 TODO 芋艿:需要抽到配置里 globalConfig: getApp().globalData.config, loginForm: { username: "admin", @@ -66,14 +66,19 @@ } else if (this.loginForm.password === "") { this.$modal.msgError("请输入您的密码") } else { - this.$modal.loading("登录中,请耐心等待...") - // 显示验证码 - this.$refs.verify.show() + // 显示验证码 + if (this.captchaEnabled) { + this.$refs.verify.show() + } else { // 直接登录 + await this.pwdLogin({}) + } } }, // 密码登录 - async pwdLogin(params) { - this.loginForm.captchaVerification = params.captchaVerification + async pwdLogin(captchaParams) { + this.$modal.loading("登录中,请耐心等待...") + // 执行登录 + this.loginForm.captchaVerification = captchaParams.captchaVerification this.$store.dispatch('Login', this.loginForm).then(() => { this.$modal.closeLoading() this.loginSuccess()