mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-14 05:03:49 +08:00
更新2.1.2版本,优化部门、角色权限,增加上下级关系;增加登录、系统、短信日志;优化省市区编码
This commit is contained in:
25
web/src/utils/encrypt.ts
Normal file
25
web/src/utils/encrypt.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import CryptoJS from 'crypto-js';
|
||||
|
||||
const defaultKey = 'f080a463654b2279';
|
||||
|
||||
export const aesEcb = {
|
||||
// 加密
|
||||
encrypt(word: string, keyStr: string = defaultKey): string {
|
||||
const key = CryptoJS.enc.Utf8.parse(keyStr);
|
||||
const src = CryptoJS.enc.Utf8.parse(word);
|
||||
const encrypted = CryptoJS.AES.encrypt(src, key, {
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7,
|
||||
});
|
||||
return encrypted.toString();
|
||||
},
|
||||
// 解密
|
||||
decrypt(word: string, keyStr: string = defaultKey): string {
|
||||
const key = CryptoJS.enc.Utf8.parse(keyStr);
|
||||
const decrypt = CryptoJS.AES.decrypt(word, key, {
|
||||
mode: CryptoJS.mode.ECB,
|
||||
padding: CryptoJS.pad.Pkcs7,
|
||||
});
|
||||
return CryptoJS.enc.Utf8.stringify(decrypt).toString();
|
||||
},
|
||||
};
|
||||
@@ -1,10 +1,11 @@
|
||||
import { Ref, UnwrapRef } from '@vue/reactivity';
|
||||
import onerrorImg from '@/assets/images/onerror.png';
|
||||
|
||||
export interface Option {
|
||||
label: string;
|
||||
value: string;
|
||||
key: string;
|
||||
type: string;
|
||||
value: string | number;
|
||||
key: string | number;
|
||||
// type: string;
|
||||
listClass: 'default' | 'error' | 'primary' | 'info' | 'success' | 'warning';
|
||||
}
|
||||
|
||||
@@ -51,3 +52,9 @@ export function adaModalWidth(dialogWidth: Ref<UnwrapRef<string>>) {
|
||||
}
|
||||
return dialogWidth.value;
|
||||
}
|
||||
|
||||
// 图片加载失败显示自定义默认图片(缺省图)
|
||||
export function errorImg(e: any): void {
|
||||
e.target.src = onerrorImg;
|
||||
e.target.onerror = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user