|
|
|
@ -1,9 +1,11 @@ |
|
|
|
|
<template></template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import { mapActions, mapMutations } from "vuex"; |
|
|
|
|
import { mapActions, mapMutations } from 'vuex' |
|
|
|
|
import Util from '@/libs/util' |
|
|
|
|
import Setting from "@/setting"; |
|
|
|
|
import Setting from '@/setting' |
|
|
|
|
import CryptoJS from 'crypto-js' |
|
|
|
|
import JSEncrypt from 'jsencrypt' |
|
|
|
|
export default { |
|
|
|
|
data: function () { |
|
|
|
|
return { |
|
|
|
@ -12,6 +14,8 @@ export default { |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
|
localStorage.removeItem('opened') |
|
|
|
|
localStorage.removeItem('review_token') |
|
|
|
|
localStorage.removeItem('reviewPath') |
|
|
|
|
this.token ? this.setLogin() : this.$router.replace('/login') |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
@ -22,10 +26,9 @@ export default { |
|
|
|
|
"setCustomerName" |
|
|
|
|
]), |
|
|
|
|
setLogin () { |
|
|
|
|
localStorage.removeItem('review_token') |
|
|
|
|
localStorage.removeItem('reviewPath') |
|
|
|
|
this.SET_FROM(true) |
|
|
|
|
Util.local.set(Setting.tokenKey, window.atob(decodeURI(this.token)), Setting.tokenExpires); |
|
|
|
|
this.getOss() |
|
|
|
|
this.getRole() |
|
|
|
|
this.queryCustomer() |
|
|
|
|
}, |
|
|
|
@ -43,7 +46,28 @@ export default { |
|
|
|
|
const list = res.permissionMenu[0].children |
|
|
|
|
this.$router.push(list.find(e => e.path === path) ? path : list[0].path) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
async getOss () { |
|
|
|
|
const A = (key, encryptedData) => { |
|
|
|
|
const keyHex = CryptoJS.enc.Base64.parse(key) |
|
|
|
|
const decrypted = CryptoJS.AES.decrypt(encryptedData, keyHex, { |
|
|
|
|
mode: CryptoJS.mode.ECB, |
|
|
|
|
padding: CryptoJS.pad.Pkcs7 |
|
|
|
|
}) |
|
|
|
|
return decrypted.toString(CryptoJS.enc.Utf8) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const R = (encryptedKey, privateKey) => { |
|
|
|
|
const decrypt = new JSEncrypt() |
|
|
|
|
decrypt.setPrivateKey(privateKey) |
|
|
|
|
const decryptedKey = decrypt.decrypt(encryptedKey) |
|
|
|
|
return decryptedKey |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const res = await this.$get(this.api.encrypt) |
|
|
|
|
const RE = A(R(res.encryptedKey, res.privateKey), res.encryptedData).split('/') |
|
|
|
|
localStorage.setItem('osc', JSON.stringify(RE)) |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|