Browse Source

加密方法参数修改

yunxing 4 years ago
parent
commit
e4f981a67b
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/utils/crypto.js

+ 6 - 4
src/utils/crypto.js

@@ -4,15 +4,17 @@ import moment from 'moment'
 const secretKey = 'B447B88D5AF5A99A' + moment().format('YYYYMMDD');
 
 //模拟参数
-const url = 'username=wangjintao&plazaId=1000772&time=1611108153087&assead=1231231'
+// const url = `username=wangjintao&plazaId=1000772&time=1611198103138&assead=1231231`
+const url = `username=wangjintao&plazaId=1000772&time=1611198103138`
 
 // 加密
-export  function encrypted (url){
-    const encJson =CryptoJS.AES.encrypt(url).toString();
+export  function encrypted (){
+    const encJson =CryptoJS.AES.encrypt(url,secretKey).toString();
     return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(encJson));
 }
 // 解密
 export function decrypted (url) {
     const decData = CryptoJS.enc.Base64.parse(url).toString(CryptoJS.enc.Utf8)
     return CryptoJS.AES.decrypt(decData, secretKey).toString(CryptoJS.enc.Utf8);
-}
+}
+// window.encrypted = encrypted