1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import {
- AES,
- mode,
- pad,
- enc
- } from "crypto-js";
- //aes加密
- export function encryptByEnAES(data = '') {
- let Key = "dsadmin";
- let tmpAES = AES.encrypt(data, Key, {
- mode: mode.CBC,
- padding: pad.Pkcs7,
- });
- return tmpAES.toString();
- }
- //aes解密
- export function encryptByDeAES(data = '') {
- let Key = "dsadmin";
- let tmpDeAES = AES.decrypt(data, Key, {
- mode: mode.CBC,
- padding: pad.Pkcs7,
- });
- return tmpDeAES.toString(enc.Utf8);
- }
- // 简单的模拟枚举
- export function createEnum(arr = []) {
- let obj = {}
- arr.forEach(v => {
- obj[obj[v.name] = v.value] = v.name;
- })
- return Object.freeze(obj);
- };
- // 获取页面栈,默认0是当前页面栈
- export function getCurrentPagesSeimin(num = 0) {
- let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
- let curRoute = routes[routes.length - 1 - num].route // 获取当前页面路由,也就是最后一个打开的页面路由
- return curRoute;
- };
|