From b78378ce446323df8f85f4d71fe9fb86061ea3e9 Mon Sep 17 00:00:00 2001 From: xingyu Date: Wed, 3 Aug 2022 09:48:51 +0800 Subject: [PATCH] =?UTF-8?q?AJ-Captcha=20vue2=20=E5=A2=9E=E5=8A=A0=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E7=A0=81=E4=BA=8C=E6=AC=A1=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-admin/src/api/login.js | 3 ++- yudao-ui-admin/src/store/modules/user.js | 3 ++- yudao-ui-admin/src/views/login.vue | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/yudao-ui-admin/src/api/login.js b/yudao-ui-admin/src/api/login.js index ae260500d..b34d98d29 100644 --- a/yudao-ui-admin/src/api/login.js +++ b/yudao-ui-admin/src/api/login.js @@ -3,10 +3,11 @@ import { getRefreshToken } from '@/utils/auth' import service from '@/utils/request' // 登录方法 -export function login(username, password, socialType, socialCode, socialState) { +export function login(username, password, captchaVerification, socialType, socialCode, socialState) { const data = { username, password, + captchaVerification, // 社交相关 socialType, socialCode, diff --git a/yudao-ui-admin/src/store/modules/user.js b/yudao-ui-admin/src/store/modules/user.js index 7ab122406..7981df71c 100644 --- a/yudao-ui-admin/src/store/modules/user.js +++ b/yudao-ui-admin/src/store/modules/user.js @@ -36,11 +36,12 @@ const user = { Login({ commit }, userInfo) { const username = userInfo.username.trim() const password = userInfo.password + const captchaVerification = userInfo.captchaVerification const socialCode = userInfo.socialCode const socialState = userInfo.socialState const socialType = userInfo.socialType return new Promise((resolve, reject) => { - login(username, password, socialType, socialCode, socialState).then(res => { + login(username, password, captchaVerification, socialType, socialCode, socialState).then(res => { res = res.data; // 设置 token setToken(res) diff --git a/yudao-ui-admin/src/views/login.vue b/yudao-ui-admin/src/views/login.vue index acb986b8c..ec8bb3811 100644 --- a/yudao-ui-admin/src/views/login.vue +++ b/yudao-ui-admin/src/views/login.vue @@ -132,6 +132,7 @@ export default { loginType: "uname", username: "admin", password: "admin123", + captchaVerification: "", mobile: "", mobileCode: "", rememberMe: false, @@ -213,7 +214,8 @@ export default { tenantName: tenantName ? tenantName : this.loginForm.tenantName, }; }, - handleLogin() { + handleLogin(params) { + console.info(params) this.$refs.loginForm.validate(valid => { if (valid) { this.loading = true; @@ -229,6 +231,7 @@ export default { removeRememberMe() removeTenantName() } + this.loginForm.captchaVerification = params.captchaVerification // 发起登陆 // console.log("发起登录", this.loginForm); this.$store.dispatch(this.loginForm.loginType === "sms" ? "SmsLogin" : "Login", this.loginForm).then(() => {