// 模块排序库 http://www.sortablejs.com/index.html // 加密解密 // npm 依赖 crypto-es import CryptoES from ‘crypto-es‘ const keyStr = ‘eSEdSfdED==WGDH‘ // 加密 export function encrypt(word:string) { const key = CryptoES .enc.Utf8.parse(keyStr) const srcs = CryptoES .enc.Utf8.parse(word) const encrypted = CryptoES .AES.encrypt(srcs, key, { mode: CryptoES .mode.ECB, padding: CryptoES .pad.Pkcs7 }) return encrypted.toString() } // 解密 export function decrypt(word:string) { const key = CryptoES .enc.Utf8.parse(keyStr) const decryptStr = CryptoES .AES.decrypt(word, key, { mode: CryptoES .mode.ECB, padding: CryptoES .pad.Pkcs7 }) return CryptoES .enc.Utf8.stringify(decryptStr).toString() } export default {encrypt ,decrypt}