uu
This commit is contained in:
parent
006ca5f5b9
commit
a5c5426283
1910
common/libs/jsencrypt.min.js
vendored
1910
common/libs/jsencrypt.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
||||
import JSEncrypt from '@/utils/jsencrypt.min'
|
||||
import JSEncrypt from '@/common/libs/jsencrypt.min'
|
||||
|
||||
// 密钥对生成 http://web.chacuo.net/netrsakeypair
|
||||
|
||||
@ -16,14 +16,14 @@ const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYour
|
||||
|
||||
// 加密
|
||||
export function encrypt(txt) {
|
||||
const encryptor = new JSEncrypt()
|
||||
const encryptor = JSEncrypt()
|
||||
encryptor.setPublicKey(publicKey) // 设置公钥
|
||||
return encryptor.encrypt(txt) // 对数据进行加密
|
||||
}
|
||||
|
||||
// 解密
|
||||
export function decrypt(txt) {
|
||||
const encryptor = new JSEncrypt()
|
||||
const encryptor = JSEncrypt()
|
||||
encryptor.setPrivateKey(privateKey) // 设置私钥
|
||||
return encryptor.decrypt(txt) // 对数据进行解密
|
||||
}
|
||||
|
||||
@ -47,6 +47,8 @@
|
||||
<script>
|
||||
import { USERKEY } from "@/store/actionKey"
|
||||
import { getSessionLoginInfo, setSessionLoginInfo } from "@/session"
|
||||
import { encrypt } from "@/common/libs/jsencrypt_utils"
|
||||
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -54,6 +56,7 @@
|
||||
data() {
|
||||
return {
|
||||
submitParams: {
|
||||
// isEncrypt: true,
|
||||
username: '',
|
||||
password: '',
|
||||
remberPassport: []
|
||||
@ -77,11 +80,14 @@
|
||||
const { submitParams } = this
|
||||
this.showLoading()
|
||||
try{
|
||||
await this.$store.dispatch(USERKEY.LOGIN, submitParams)
|
||||
await this.$store.dispatch(USERKEY.LOGIN, { ...submitParams,
|
||||
// password: encrypt(submitParams.password)
|
||||
})
|
||||
await this.$store.dispatch(USERKEY.GETUSERINFO)
|
||||
setSessionLoginInfo(submitParams)
|
||||
this.goto("tabBar/home/home")
|
||||
}catch(e){
|
||||
console.error("USERKEY.LOGIN===catch error:", e)
|
||||
}
|
||||
this.hideLoading()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user