/* * @Description: 本地数据加密解密 * @Author: sql * @Date: 2018-11-23 20:38:06 * @LastEditTime: 2018-11-29 16:14:16 */ import CryptoJs from 'crypto-js' class CryptToJS { constructor() { this.crypt = CryptoJs this.secret = 'Believe in yourself.' } // 加密内容, 原文 Encrypt(text) { return this.crypt.AES.encrypt(text, this.secret).toString() } // 解密,加密内容 Decrypt(text) { if (text == null || text.lenth == 0) { return "" } return this.crypt.AES.decrypt(text, this.secret).toString(CryptoJs.enc.Utf8) } } export default new CryptToJS