管理后台的 uniapp 验证码,增加开关
This commit is contained in:
parent
a484cd5193
commit
9715087b54
@ -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>
|
||||
|
||||
<!-- 验证码相关 -->
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 验证码拓展
|
||||
* 1. 基于 aj-captcha 实现图形验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/
|
||||
* 1. 基于 aj-captcha 实现滑块验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/
|
||||
*
|
||||
* @author 星语
|
||||
*/
|
||||
|
@ -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>
|
||||
|
@ -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 = "验证码开启时,需要传递")
|
||||
|
@ -2,7 +2,7 @@
|
||||
module.exports = {
|
||||
// baseUrl: 'http://localhost:8080',
|
||||
baseUrl: 'http://localhost:48080',
|
||||
baseApi: 'admin-api',
|
||||
baseApi: '/admin-api',
|
||||
// 应用信息
|
||||
appInfo: {
|
||||
// 应用名称
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user