Commit b78378ce446323df8f85f4d71fe9fb86061ea3e9
1 parent
e842d2e0
AJ-Captcha vue2 增加验证码二次校验
Showing
3 changed files
with
8 additions
and
3 deletions
yudao-ui-admin/src/api/login.js
| ... | ... | @@ -3,10 +3,11 @@ import { getRefreshToken } from '@/utils/auth' |
| 3 | 3 | import service from '@/utils/request' |
| 4 | 4 | |
| 5 | 5 | // 登录方法 |
| 6 | -export function login(username, password, socialType, socialCode, socialState) { | |
| 6 | +export function login(username, password, captchaVerification, socialType, socialCode, socialState) { | |
| 7 | 7 | const data = { |
| 8 | 8 | username, |
| 9 | 9 | password, |
| 10 | + captchaVerification, | |
| 10 | 11 | // 社交相关 |
| 11 | 12 | socialType, |
| 12 | 13 | socialCode, | ... | ... |
yudao-ui-admin/src/store/modules/user.js
| ... | ... | @@ -36,11 +36,12 @@ const user = { |
| 36 | 36 | Login({ commit }, userInfo) { |
| 37 | 37 | const username = userInfo.username.trim() |
| 38 | 38 | const password = userInfo.password |
| 39 | + const captchaVerification = userInfo.captchaVerification | |
| 39 | 40 | const socialCode = userInfo.socialCode |
| 40 | 41 | const socialState = userInfo.socialState |
| 41 | 42 | const socialType = userInfo.socialType |
| 42 | 43 | return new Promise((resolve, reject) => { |
| 43 | - login(username, password, socialType, socialCode, socialState).then(res => { | |
| 44 | + login(username, password, captchaVerification, socialType, socialCode, socialState).then(res => { | |
| 44 | 45 | res = res.data; |
| 45 | 46 | // 设置 token |
| 46 | 47 | setToken(res) | ... | ... |
yudao-ui-admin/src/views/login.vue
| ... | ... | @@ -132,6 +132,7 @@ export default { |
| 132 | 132 | loginType: "uname", |
| 133 | 133 | username: "admin", |
| 134 | 134 | password: "admin123", |
| 135 | + captchaVerification: "", | |
| 135 | 136 | mobile: "", |
| 136 | 137 | mobileCode: "", |
| 137 | 138 | rememberMe: false, |
| ... | ... | @@ -213,7 +214,8 @@ export default { |
| 213 | 214 | tenantName: tenantName ? tenantName : this.loginForm.tenantName, |
| 214 | 215 | }; |
| 215 | 216 | }, |
| 216 | - handleLogin() { | |
| 217 | + handleLogin(params) { | |
| 218 | + console.info(params) | |
| 217 | 219 | this.$refs.loginForm.validate(valid => { |
| 218 | 220 | if (valid) { |
| 219 | 221 | this.loading = true; |
| ... | ... | @@ -229,6 +231,7 @@ export default { |
| 229 | 231 | removeRememberMe() |
| 230 | 232 | removeTenantName() |
| 231 | 233 | } |
| 234 | + this.loginForm.captchaVerification = params.captchaVerification | |
| 232 | 235 | // 发起登陆 |
| 233 | 236 | // console.log("发起登录", this.loginForm); |
| 234 | 237 | this.$store.dispatch(this.loginForm.loginType === "sms" ? "SmsLogin" : "Login", this.loginForm).then(() => { | ... | ... |