|
@@ -1,7 +1,7 @@
|
|
|
/**
|
|
/**
|
|
|
* 混入对象,抽取Vue中公共的部分
|
|
* 混入对象,抽取Vue中公共的部分
|
|
|
*/
|
|
*/
|
|
|
-import {getPubkey, getCaptchaCode, getVerifyCode, login, logout, register, forgot } from '@/api/account'
|
|
|
|
|
|
|
+import { getPubkey, getCaptchaCode, getVerifyCode, login, logout, register, forgot } from '@/api/account'
|
|
|
import { setUserToken, removeAll } from '@/utils/auth'
|
|
import { setUserToken, removeAll } from '@/utils/auth'
|
|
|
import { JSEncrypt } from 'jsencrypt'
|
|
import { JSEncrypt } from 'jsencrypt'
|
|
|
import Vue from 'vue'
|
|
import Vue from 'vue'
|
|
@@ -30,7 +30,7 @@ export const userMixin = {
|
|
|
principal: null,
|
|
principal: null,
|
|
|
verifyCode: null,
|
|
verifyCode: null,
|
|
|
newCredential: null,
|
|
newCredential: null,
|
|
|
- captchaCode: null,
|
|
|
|
|
|
|
+ captchaCode: null
|
|
|
},
|
|
},
|
|
|
loginDialog: false,
|
|
loginDialog: false,
|
|
|
registerDialog: false,
|
|
registerDialog: false,
|
|
@@ -161,7 +161,8 @@ export const userMixin = {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- this.userLogin.credential = this.encryptPassword(this.userLogin.credential, this.pubkey, this.pubkeyR)
|
|
|
|
|
|
|
+ const credential = this.userLogin.credential
|
|
|
|
|
+ this.userLogin.credential = this.encryptPassword(credential, this.pubkey, this.pubkeyR)
|
|
|
// 显示加载效果
|
|
// 显示加载效果
|
|
|
this.isLoading = true
|
|
this.isLoading = true
|
|
|
login(this.userLogin).then(resp => {
|
|
login(this.userLogin).then(resp => {
|
|
@@ -173,25 +174,25 @@ export const userMixin = {
|
|
|
setUserToken(userToken)
|
|
setUserToken(userToken)
|
|
|
this.$store.commit('UPDATE_USER_INFO', userInfo)
|
|
this.$store.commit('UPDATE_USER_INFO', userInfo)
|
|
|
|
|
|
|
|
- // 关闭弹窗并刷新页面
|
|
|
|
|
- this.dialogVisible = false
|
|
|
|
|
|
|
+ // 刷新当前页面
|
|
|
this.$router.go(0)
|
|
this.$router.go(0)
|
|
|
|
|
+ this.userLogin = {
|
|
|
|
|
+ principal: null,
|
|
|
|
|
+ credential: null,
|
|
|
|
|
+ captchaCode: null,
|
|
|
|
|
+ loginType: 2,
|
|
|
|
|
+ plat: 1
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
// 登录失败
|
|
// 登录失败
|
|
|
this.$message.warning(resp.msg)
|
|
this.$message.warning(resp.msg)
|
|
|
|
|
+ this.userLogin.credential = credential
|
|
|
}
|
|
}
|
|
|
}).catch(error => {
|
|
}).catch(error => {
|
|
|
// 登录请求错误
|
|
// 登录请求错误
|
|
|
this.$message.error(error)
|
|
this.$message.error(error)
|
|
|
}).finally(() => {
|
|
}).finally(() => {
|
|
|
this.isLoading = false
|
|
this.isLoading = false
|
|
|
- this.userLogin = {
|
|
|
|
|
- principal: null,
|
|
|
|
|
- credential: null,
|
|
|
|
|
- captchaCode: null,
|
|
|
|
|
- loginType: 2,
|
|
|
|
|
- plat: 1
|
|
|
|
|
- }
|
|
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
registerBtn() {
|
|
registerBtn() {
|