mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
AJ-Captcha vue2 增加验证码二次校验
This commit is contained in:
parent
9b1c465061
commit
55764cbc55
@ -3,10 +3,11 @@ import { getRefreshToken } from '@/utils/auth'
|
|||||||
import service from '@/utils/request'
|
import service from '@/utils/request'
|
||||||
|
|
||||||
// 登录方法
|
// 登录方法
|
||||||
export function login(username, password, socialType, socialCode, socialState) {
|
export function login(username, password, captchaVerification, socialType, socialCode, socialState) {
|
||||||
const data = {
|
const data = {
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
|
captchaVerification,
|
||||||
// 社交相关
|
// 社交相关
|
||||||
socialType,
|
socialType,
|
||||||
socialCode,
|
socialCode,
|
||||||
|
@ -36,11 +36,12 @@ const user = {
|
|||||||
Login({ commit }, userInfo) {
|
Login({ commit }, userInfo) {
|
||||||
const username = userInfo.username.trim()
|
const username = userInfo.username.trim()
|
||||||
const password = userInfo.password
|
const password = userInfo.password
|
||||||
|
const captchaVerification = userInfo.captchaVerification
|
||||||
const socialCode = userInfo.socialCode
|
const socialCode = userInfo.socialCode
|
||||||
const socialState = userInfo.socialState
|
const socialState = userInfo.socialState
|
||||||
const socialType = userInfo.socialType
|
const socialType = userInfo.socialType
|
||||||
return new Promise((resolve, reject) => {
|
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;
|
res = res.data;
|
||||||
// 设置 token
|
// 设置 token
|
||||||
setToken(res)
|
setToken(res)
|
||||||
|
@ -132,6 +132,7 @@ export default {
|
|||||||
loginType: "uname",
|
loginType: "uname",
|
||||||
username: "admin",
|
username: "admin",
|
||||||
password: "admin123",
|
password: "admin123",
|
||||||
|
captchaVerification: "",
|
||||||
mobile: "",
|
mobile: "",
|
||||||
mobileCode: "",
|
mobileCode: "",
|
||||||
rememberMe: false,
|
rememberMe: false,
|
||||||
@ -213,7 +214,8 @@ export default {
|
|||||||
tenantName: tenantName ? tenantName : this.loginForm.tenantName,
|
tenantName: tenantName ? tenantName : this.loginForm.tenantName,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
handleLogin() {
|
handleLogin(params) {
|
||||||
|
console.info(params)
|
||||||
this.$refs.loginForm.validate(valid => {
|
this.$refs.loginForm.validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@ -229,6 +231,7 @@ export default {
|
|||||||
removeRememberMe()
|
removeRememberMe()
|
||||||
removeTenantName()
|
removeTenantName()
|
||||||
}
|
}
|
||||||
|
this.loginForm.captchaVerification = params.captchaVerification
|
||||||
// 发起登陆
|
// 发起登陆
|
||||||
// console.log("发起登录", this.loginForm);
|
// console.log("发起登录", this.loginForm);
|
||||||
this.$store.dispatch(this.loginForm.loginType === "sms" ? "SmsLogin" : "Login", this.loginForm).then(() => {
|
this.$store.dispatch(this.loginForm.loginType === "sms" ? "SmsLogin" : "Login", this.loginForm).then(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user