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
|
// 密钥对生成 http://web.chacuo.net/netrsakeypair
|
||||||
|
|
||||||
@ -16,14 +16,14 @@ const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYour
|
|||||||
|
|
||||||
// 加密
|
// 加密
|
||||||
export function encrypt(txt) {
|
export function encrypt(txt) {
|
||||||
const encryptor = new JSEncrypt()
|
const encryptor = JSEncrypt()
|
||||||
encryptor.setPublicKey(publicKey) // 设置公钥
|
encryptor.setPublicKey(publicKey) // 设置公钥
|
||||||
return encryptor.encrypt(txt) // 对数据进行加密
|
return encryptor.encrypt(txt) // 对数据进行加密
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解密
|
// 解密
|
||||||
export function decrypt(txt) {
|
export function decrypt(txt) {
|
||||||
const encryptor = new JSEncrypt()
|
const encryptor = JSEncrypt()
|
||||||
encryptor.setPrivateKey(privateKey) // 设置私钥
|
encryptor.setPrivateKey(privateKey) // 设置私钥
|
||||||
return encryptor.decrypt(txt) // 对数据进行解密
|
return encryptor.decrypt(txt) // 对数据进行解密
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,6 +47,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import { USERKEY } from "@/store/actionKey"
|
import { USERKEY } from "@/store/actionKey"
|
||||||
import { getSessionLoginInfo, setSessionLoginInfo } from "@/session"
|
import { getSessionLoginInfo, setSessionLoginInfo } from "@/session"
|
||||||
|
import { encrypt } from "@/common/libs/jsencrypt_utils"
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
@ -54,6 +56,7 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
submitParams: {
|
submitParams: {
|
||||||
|
// isEncrypt: true,
|
||||||
username: '',
|
username: '',
|
||||||
password: '',
|
password: '',
|
||||||
remberPassport: []
|
remberPassport: []
|
||||||
@ -77,11 +80,14 @@
|
|||||||
const { submitParams } = this
|
const { submitParams } = this
|
||||||
this.showLoading()
|
this.showLoading()
|
||||||
try{
|
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)
|
await this.$store.dispatch(USERKEY.GETUSERINFO)
|
||||||
setSessionLoginInfo(submitParams)
|
setSessionLoginInfo(submitParams)
|
||||||
this.goto("tabBar/home/home")
|
this.goto("tabBar/home/home")
|
||||||
}catch(e){
|
}catch(e){
|
||||||
|
console.error("USERKEY.LOGIN===catch error:", e)
|
||||||
}
|
}
|
||||||
this.hideLoading()
|
this.hideLoading()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user