ui库合并版本完成
This commit is contained in:
23
ui/lib/js/encryption.js
Normal file
23
ui/lib/js/encryption.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import CryptoJs from "crypto-js";
|
||||
|
||||
/**
|
||||
* 密码加密工具
|
||||
* @param params
|
||||
* @param c 加载尝试计数器
|
||||
* @returns {string}
|
||||
*/
|
||||
export const $encryption = (params, c = 0) => {
|
||||
if (CryptoJs) {
|
||||
const key = "thanks,villcloud"
|
||||
let iv = CryptoJs.enc.Latin1.parse(key)
|
||||
let encrypted = CryptoJs.AES.encrypt(params.password, iv, {
|
||||
iv,
|
||||
mode: CryptoJs.mode.CBC,
|
||||
padding: CryptoJs.pad.ZeroPadding
|
||||
})
|
||||
return encrypted.toString()
|
||||
} else if (c < 10) {
|
||||
setTimeout(() => $encryption(params, ++c), 200)
|
||||
} else console.error("无法加载CryptoJs")
|
||||
}
|
||||
export default $encryption
|
||||
Reference in New Issue
Block a user