管理后台的 uniapp 验证码,增加开关
This commit is contained in:
parent
a484cd5193
commit
9715087b54
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
<description>验证码拓展
|
<description>验证码拓展
|
||||||
1. 基于 aj-captcha 实现图形验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/
|
1. 基于 aj-captcha 实现滑块验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
<!-- DB 相关 -->
|
<!-- DB 相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
<artifactId>yudao-spring-boot-starter-redis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 验证码相关 -->
|
<!-- 验证码相关 -->
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* 验证码拓展
|
* 验证码拓展
|
||||||
* 1. 基于 aj-captcha 实现图形验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/
|
* 1. 基于 aj-captcha 实现滑块验证码,文档:https://ajcaptcha.beliefteam.cn/captcha-doc/
|
||||||
*
|
*
|
||||||
* @author 星语
|
* @author 星语
|
||||||
*/
|
*/
|
||||||
|
@ -72,11 +72,6 @@
|
|||||||
<artifactId>yudao-spring-boot-starter-redis</artifactId>
|
<artifactId>yudao-spring-boot-starter-redis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
|
||||||
<artifactId>yudao-spring-boot-starter-captcha</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Job 定时任务相关 -->
|
<!-- Job 定时任务相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.iocoder.boot</groupId>
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
@ -102,6 +97,11 @@
|
|||||||
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-spring-boot-starter-captcha</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -33,6 +33,8 @@ public class AuthLoginReqVO {
|
|||||||
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
// ========== 图片验证码相关 ==========
|
||||||
|
|
||||||
@ApiModelProperty(value = "验证码", required = true,
|
@ApiModelProperty(value = "验证码", required = true,
|
||||||
example = "PfcH6mgr8tpXuMWFjvW6YVaqrswIuwmWI5dsVZSg7sGpWtDCUbHuDEXl3cFB1+VvCC/rAkSwK8Fad52FSuncVg==",
|
example = "PfcH6mgr8tpXuMWFjvW6YVaqrswIuwmWI5dsVZSg7sGpWtDCUbHuDEXl3cFB1+VvCC/rAkSwK8Fad52FSuncVg==",
|
||||||
notes = "验证码开启时,需要传递")
|
notes = "验证码开启时,需要传递")
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
// baseUrl: 'http://localhost:8080',
|
// baseUrl: 'http://localhost:8080',
|
||||||
baseUrl: 'http://localhost:48080',
|
baseUrl: 'http://localhost:48080',
|
||||||
baseApi: 'admin-api',
|
baseApi: '/admin-api',
|
||||||
// 应用信息
|
// 应用信息
|
||||||
appInfo: {
|
appInfo: {
|
||||||
// 应用名称
|
// 应用名称
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
captchaEnabled: true,
|
captchaEnabled: true, // 验证码开关 TODO 芋艿:需要抽到配置里
|
||||||
globalConfig: getApp().globalData.config,
|
globalConfig: getApp().globalData.config,
|
||||||
loginForm: {
|
loginForm: {
|
||||||
username: "admin",
|
username: "admin",
|
||||||
@ -66,14 +66,19 @@
|
|||||||
} else if (this.loginForm.password === "") {
|
} else if (this.loginForm.password === "") {
|
||||||
this.$modal.msgError("请输入您的密码")
|
this.$modal.msgError("请输入您的密码")
|
||||||
} else {
|
} else {
|
||||||
this.$modal.loading("登录中,请耐心等待...")
|
// 显示验证码
|
||||||
// 显示验证码
|
if (this.captchaEnabled) {
|
||||||
this.$refs.verify.show()
|
this.$refs.verify.show()
|
||||||
|
} else { // 直接登录
|
||||||
|
await this.pwdLogin({})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 密码登录
|
// 密码登录
|
||||||
async pwdLogin(params) {
|
async pwdLogin(captchaParams) {
|
||||||
this.loginForm.captchaVerification = params.captchaVerification
|
this.$modal.loading("登录中,请耐心等待...")
|
||||||
|
// 执行登录
|
||||||
|
this.loginForm.captchaVerification = captchaParams.captchaVerification
|
||||||
this.$store.dispatch('Login', this.loginForm).then(() => {
|
this.$store.dispatch('Login', this.loginForm).then(() => {
|
||||||
this.$modal.closeLoading()
|
this.$modal.closeLoading()
|
||||||
this.loginSuccess()
|
this.loginSuccess()
|
||||||
|
Loading…
Reference in New Issue
Block a user