1
continuous-integration/drone/push Build is passing Details

uat_us
DESKTOP-6C3NK6N\WXS 2024-09-19 16:49:20 +08:00
parent 14b0a45817
commit 8300cbaccf
3 changed files with 11 additions and 6 deletions

View File

@ -21,7 +21,7 @@ export const Encrypt = {
} else {
let res = await getPublicKey();
if (res.IsSuccess) {
PublicKey = res.Result
PublicKey = decodeURI(res.Result)
sessionStorage.setItem('PublicKey', res.Result)
} else {
return false;

View File

@ -6,8 +6,9 @@ export const encryptConfig = async (config) => {
config.headers['X-Encrypted-Key'] = encryptSecretKey;
}
if (config.data && Object.prototype.toString.call(config.data) === '[object Object]') {
Object.keys(config.data).forEach(key => {
config.data[key] = Crypto.AES.encrypt(config.data[key], secretKey)
Object.keys(config.data).forEach(async key => {
// config.data[key] = Crypto.AES.encrypt(config.data[key], secretKey)
config.data[key] = await Encrypt.encrypt(config.data[key])
})
}
return config;

View File

@ -22,9 +22,13 @@ service.interceptors.request.use(
var language = zzSessionStorage.getItem('lang')
config.headers['Accept-Language'] = language === 'en' ? 'en-US,en;q=0.5' : 'zh-CN,zh;q=0.9'
config.headers['TimeZoneId'] = moment.tz.guess()
if (config.ENCRYPT) {
config = await encryptConfig(config)
}
// if (config.ENCRYPT) {
// try{
// config = await encryptConfig(config)
// }catch(err){
// console.log(err)
// }
// }
if (store.getters.token && !config.clearToken) {
config.headers.Authorization = `Bearer ${store.getters.token}`
}