加密已通

This commit is contained in:
xk_guohonglei
2020-09-01 17:31:42 +08:00
parent fc6ae600a4
commit 39d433998a
6 changed files with 53 additions and 16 deletions

View File

@@ -22,8 +22,8 @@ export default {
decrypt(word) { // 解密
var key = CryptoJS.enc.Utf8.parse(keyStr)
// var srcs = CryptoJS.enc.Utf8.parse(word)
if(word) {
word = word.replace(/[\r\n]/g,"")
if (word) {
word = word.replace(/[\r\n]/g, "")
}
var decrypt = CryptoJS.AES.decrypt(word, key, {
mode: CryptoJS.mode.ECB,
@@ -56,8 +56,13 @@ export default {
// return decrypt.decrypt(secretWord);
// },
md5Salt(str) {
console.log('hahahahaha',str, str + "Do&9hY%l8e", md5(str + 'Do&9hY%l8e'))
return md5(str + 'Do&9hY%l8e')
// console.log('hahahahaha',str, str + "Do&9hY%l8e", md5(str + 'Do&9hY%l8e'))
// str ='fd3fc615-3554-4ff5-8848-364577e8687d'
console.log('hahahahaha', str, str + "kdq*&qflbn1gga?aDq", md5(str + 'kdq*&qflbn1gga?aDq'))
console.log('\n\n------ begin: ------')
console.log("md5(str + 'kdq*&qflbn1gga?aDq')", md5(str + 'kdq*&qflbn1gga?aDq'))
console.log('------ end: ------\n\n')
return md5(str + 'kdq*&qflbn1gga?aDq')
},
md5NoSalt(str) {
return md5(str)
@@ -76,4 +81,4 @@ export default {
return uuid
}
}
}

View File

@@ -62,11 +62,11 @@ service.interceptors.response.use(
// if (env === 'production') {
// 生产环境,进行加密解密,不输出日志
// if (res.encrypt === 1) {
if (res.encrypt === 1) {
// 加密的数据,需要解密
const dataParam = JSON.parse(utils.decrypt(res.data))
res.data = JSON.stringify(dataParam) === '{}' ? null : dataParam
// }
}
// } else {
console.log('请求路径', response.config.url, '返回结果未加密', res)
console.log('-------------------------------------------')