增加参数解密
parent
57662f6980
commit
810a14d1f7
|
|
@ -22,4 +22,19 @@ const encrypt = (word) => {
|
|||
return encrypted.ciphertext.toString(CryptoJS.enc.Base64);
|
||||
};
|
||||
|
||||
export { encrypt };
|
||||
function decryptAes(params) {
|
||||
try {
|
||||
const key = CryptoJS.enc.Utf8.parse("fa4e0fae59534676"); // 16 bytes key for AES
|
||||
|
||||
const bytes = CryptoJS.AES.decrypt(params.info, key, {
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7,
|
||||
});
|
||||
const decryptedText = bytes.toString(CryptoJS.enc.Utf8);
|
||||
return JSON.parse(decryptedText);
|
||||
} catch (e) {
|
||||
console.info(e);
|
||||
}
|
||||
}
|
||||
|
||||
export { encrypt, decryptAes };
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ export var requestPath = 'https://skqhdg.porthebei.com:9005/regulatory_gwj_2.0/'
|
|||
let videoApiPath = 'https://arqsp.qhdsafety.com:10010'; // 视频平台后台请求地址
|
||||
import dayjs from "dayjs";
|
||||
import { setRefreshToken } from "@/api";
|
||||
import {decryptAes} from "@/utils/aes_secret";
|
||||
// export var requestPath = 'https://skqhdg.porthebei.com:9005/qa-regulatory-gwj/'; // 后台请求地址
|
||||
|
||||
export var requestPath = 'http://192.168.192.201:8992/regulatory_gwj_2.0/';
|
||||
|
|
@ -54,6 +55,7 @@ function post(url, data) {
|
|||
'token': uni.getStorageSync('token') || ''
|
||||
},
|
||||
success: (res) => {
|
||||
res.data = decryptAes(res.data);
|
||||
if (data && data.loading !== false) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
|
|
@ -113,6 +115,7 @@ function upload(url, data) {
|
|||
'token': uni.getStorageSync('token') || ''
|
||||
},
|
||||
success: (res) => {
|
||||
res.data = decryptAes(res.data);
|
||||
uni.hideLoading();
|
||||
const data = JSON.parse(res.data)
|
||||
if (data.result === 'success') {
|
||||
|
|
@ -158,6 +161,7 @@ function uploads(url, data) {
|
|||
'token': uni.getStorageSync('token') || ''
|
||||
},
|
||||
success: (res) => {
|
||||
res.data = decryptAes(res.data);
|
||||
uni.hideLoading();
|
||||
const data = JSON.parse(res.data)
|
||||
if (data.result === 'success') {
|
||||
|
|
@ -244,6 +248,7 @@ function loginRequest(url, data = {}) {
|
|||
},
|
||||
method: "POST",
|
||||
success: (res) => {
|
||||
res.data = decryptAes(res.data);
|
||||
if (data && data.loading !== false) {
|
||||
uni.hideLoading();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue