|
|
@@ -124,7 +124,8 @@ export default {
|
|
|
let userInfo = {
|
|
|
account: this.loginForm.account,
|
|
|
password: this.loginForm.password,
|
|
|
- captcha: this.loginForm.captcha.toLowerCase()
|
|
|
+ captcha: this.loginForm.captcha.toLowerCase(),
|
|
|
+ captchaId:this.loginForm.captchaId
|
|
|
}
|
|
|
|
|
|
// this.$store.dispatch('login', userInfo)
|
|
|
@@ -144,14 +145,19 @@ export default {
|
|
|
// this.loading = false
|
|
|
// })
|
|
|
|
|
|
- this.$api.login.login(userInfo).then((res) => {
|
|
|
+ this.$api.login.login2(userInfo).then((res) => {
|
|
|
if (res.code != 200) {
|
|
|
this.$message({
|
|
|
message: res.msg,
|
|
|
type: 'error',
|
|
|
duration: 2000
|
|
|
})
|
|
|
- } else {
|
|
|
+ if(res.code==500&&res.msg=='验证码不正确'){
|
|
|
+ this.refreshCaptcha()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+
|
|
|
if (this.rememberPassword) { //是否保存密码
|
|
|
Cookies.set('accountInfo', { 'account': this.loginForm.account, 'password': this.loginForm.password, })
|
|
|
} else {
|
|
|
@@ -238,8 +244,10 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
refreshCaptcha() {
|
|
|
- // this.loginForm.src = this.global.baseUrl + "/captcha.jpg?t=" + new Date().getTime();
|
|
|
- this.loginForm.src = process.env.BASE_URL + "/captcha.jpg?t=" + new Date().getTime();
|
|
|
+ let randnum =Math.floor(Math.random() * (1000000 - 1 + 1) ) + 1
|
|
|
+ this.loginForm.src = process.env.BASE_URL + "/captchaById?t=" + new Date().getTime()+'&captchaId='+randnum;
|
|
|
+ this.loginForm.captchaId=randnum
|
|
|
+
|
|
|
},
|
|
|
reset() {
|
|
|
this.$refs.loginForm.resetFields()
|