12345678910111213141516171819202122232425262728293031323334353637 |
- import CryptoJS from './crypto-js/crypto-js.js'
- const key = CryptoJS.enc.Utf8.parse('e56cs11a8480cd82');
- const iv = CryptoJS.enc.Utf8.parse('6e891d191fcv8eec');
- export default {
- Encrypt(text) {
- let srcs = CryptoJS.enc.Utf8.parse(text);
- let encrypted = CryptoJS.AES.encrypt(srcs, key, {
- iv: iv,
- mode: CryptoJS.mode.CBC,
- padding: CryptoJS.pad.Pkcs7 //ZeroPadding
- });
- return encrypted.toString();
- },
- user_skey() {
- try {
- const value = uni.getStorageSync('gxdd_story_v1');
- if (value) {
- // console.log(value);
- return value;
- }
- } catch (e) {
- // error
- }
- // uni.navigateTo({
- // url: '/pages/ucenter/login'
- // })
- return null;
- },
- user_skey_set(skey) {
- try {
- uni.setStorageSync('gxdd_story_v1', skey);
- } catch (e) {
- // error
- }
- }
- }
|