Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -71,4 +71,19 @@ export function thirdLogin(token,thirdType) {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取RSA公钥
|
||||
* @returns {*}
|
||||
*/
|
||||
export function getRSAPublicKey() {
|
||||
return axios({
|
||||
url: `/sys/getRSAPublicKey`,
|
||||
method: 'get',
|
||||
timeout: 5000,
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8'
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -182,6 +182,9 @@
|
||||
import { ACCESS_TOKEN ,ENCRYPTED_STRING} from "@/store/mutation-types"
|
||||
import { putAction,postAction,getAction } from '@/api/manage'
|
||||
import { USER_INFO } from "@/store/mutation-types"
|
||||
import {getRSAPublicKey} from '@/api/login.js'
|
||||
const Base64 = require('js-base64').Base64
|
||||
import {JSEncrypt} from 'jsencrypt'
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
@@ -211,6 +214,7 @@
|
||||
currdatetime:'',
|
||||
randCodeImage:'',
|
||||
requestCodeSuccess:false,
|
||||
rsaPublicKey:''
|
||||
}
|
||||
},
|
||||
created () {
|
||||
@@ -218,6 +222,7 @@
|
||||
Vue.ls.remove(ACCESS_TOKEN)
|
||||
this.getRouterData();
|
||||
this.handleChangeCheckCode();
|
||||
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['Login', 'Logout', 'PhoneLogin']),
|
||||
@@ -236,14 +241,19 @@
|
||||
that.loginBtn = true;
|
||||
that.form.validateFields([ 'username', 'password','inputCode', 'rememberMe' ], { force: true }, (err, values) => {
|
||||
if (!err) {
|
||||
loginParams.username = values.username
|
||||
loginParams.password = values.password
|
||||
|
||||
loginParams.remember_me = values.rememberMe
|
||||
loginParams.captcha = that.inputCodeContent
|
||||
loginParams.checkKey = that.currdatetime
|
||||
// console.log("登录参数",loginParams)
|
||||
loginParams.rsaPublicKey = that.rsaPublicKey;
|
||||
// 新建JSEncrypt对象
|
||||
let encrypt = new JSEncrypt();
|
||||
encrypt.setPublicKey(loginParams.rsaPublicKey);
|
||||
// 公钥加密
|
||||
loginParams.username = encrypt.encrypt(values.username)
|
||||
loginParams.password = encrypt.encrypt(values.password)
|
||||
//登录
|
||||
that.Login(loginParams).then((res) => {
|
||||
//登录成功
|
||||
this.loginSuccess()
|
||||
}).catch((err) => {
|
||||
if (err.code === 500) {
|
||||
@@ -309,6 +319,14 @@
|
||||
}).catch(()=>{
|
||||
this.requestCodeSuccess=false
|
||||
})
|
||||
this.getPublicKey();
|
||||
},
|
||||
//获取RSA公钥
|
||||
getPublicKey(){
|
||||
// 获取公钥
|
||||
getRSAPublicKey().then(res => {
|
||||
this.rsaPublicKey = res.result
|
||||
})
|
||||
},
|
||||
loginSuccess () {
|
||||
this.$router.push({ path: "/dashboard/analysis" }).catch((res)=>{})
|
||||
|
||||
Reference in New Issue
Block a user