管理后台的 uniapp 验证码,增加开关

This commit is contained in:
YunaiV 2022-09-04 17:44:26 +08:00
parent a484cd5193
commit 9715087b54
6 changed files with 23 additions and 16 deletions

View File

@ -13,7 +13,7 @@
<name>${project.artifactId}</name>
<description>验证码拓展
1. 基于 aj-captcha 实现图形验证码文档https://ajcaptcha.beliefteam.cn/captcha-doc/
1. 基于 aj-captcha 实现滑块验证码文档https://ajcaptcha.beliefteam.cn/captcha-doc/
</description>
<dependencies>
@ -25,8 +25,8 @@
<!-- DB 相关 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-redis</artifactId>
</dependency>
<!-- 验证码相关 -->

View File

@ -1,6 +1,6 @@
/**
* 验证码拓展
* 1. 基于 aj-captcha 实现图形验证码文档https://ajcaptcha.beliefteam.cn/captcha-doc/
* 1. 基于 aj-captcha 实现滑块验证码文档https://ajcaptcha.beliefteam.cn/captcha-doc/
*
* @author 星语
*/

View File

@ -72,11 +72,6 @@
<artifactId>yudao-spring-boot-starter-redis</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-captcha</artifactId>
</dependency>
<!-- Job 定时任务相关 -->
<dependency>
<groupId>cn.iocoder.boot</groupId>
@ -102,6 +97,11 @@
<artifactId>yudao-spring-boot-starter-excel</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-captcha</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -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 = "验证码开启时,需要传递")

View File

@ -2,7 +2,7 @@
module.exports = {
// baseUrl: 'http://localhost:8080',
baseUrl: 'http://localhost:48080',
baseApi: 'admin-api',
baseApi: '/admin-api',
// 应用信息
appInfo: {
// 应用名称

View File

@ -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("登录中,请耐心等待...")
//
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()