|
|
@ -1,9 +1,11 @@ |
|
|
|
<template></template> |
|
|
|
<template></template> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import { mapActions, mapMutations } from "vuex"; |
|
|
|
import { mapActions, mapMutations } from 'vuex' |
|
|
|
import Util from '@/libs/util' |
|
|
|
import Util from '@/libs/util' |
|
|
|
import Setting from "@/setting"; |
|
|
|
import Setting from '@/setting' |
|
|
|
|
|
|
|
import CryptoJS from 'crypto-js' |
|
|
|
|
|
|
|
import JSEncrypt from 'jsencrypt' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data: function () { |
|
|
|
data: function () { |
|
|
|
return { |
|
|
|
return { |
|
|
@ -12,6 +14,8 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
mounted () { |
|
|
|
localStorage.removeItem('opened') |
|
|
|
localStorage.removeItem('opened') |
|
|
|
|
|
|
|
localStorage.removeItem('review_token') |
|
|
|
|
|
|
|
localStorage.removeItem('reviewPath') |
|
|
|
this.token ? this.setLogin() : this.$router.replace('/login') |
|
|
|
this.token ? this.setLogin() : this.$router.replace('/login') |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
@ -22,10 +26,9 @@ export default { |
|
|
|
"setCustomerName" |
|
|
|
"setCustomerName" |
|
|
|
]), |
|
|
|
]), |
|
|
|
setLogin () { |
|
|
|
setLogin () { |
|
|
|
localStorage.removeItem('review_token') |
|
|
|
|
|
|
|
localStorage.removeItem('reviewPath') |
|
|
|
|
|
|
|
this.SET_FROM(true) |
|
|
|
this.SET_FROM(true) |
|
|
|
Util.local.set(Setting.tokenKey, window.atob(decodeURI(this.token)), Setting.tokenExpires); |
|
|
|
Util.local.set(Setting.tokenKey, window.atob(decodeURI(this.token)), Setting.tokenExpires); |
|
|
|
|
|
|
|
this.getOss() |
|
|
|
this.getRole() |
|
|
|
this.getRole() |
|
|
|
this.queryCustomer() |
|
|
|
this.queryCustomer() |
|
|
|
}, |
|
|
|
}, |
|
|
@ -43,7 +46,28 @@ export default { |
|
|
|
const list = res.permissionMenu[0].children |
|
|
|
const list = res.permissionMenu[0].children |
|
|
|
this.$router.push(list.find(e => e.path === path) ? path : list[0].path) |
|
|
|
this.$router.push(list.find(e => e.path === path) ? path : list[0].path) |
|
|
|
}).catch(err => { }) |
|
|
|
}).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> |
|
|
|
</script> |
|
|
|