You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
837 B
34 lines
837 B
2 years ago
|
// 数据字典转换
|
||
|
export function selectDictValue(datas, value) {
|
||
|
var actions = [];
|
||
|
Object.keys(datas).map((key) => {
|
||
|
if (datas[key].text == (''+ value)) {
|
||
|
actions.push(datas[key].value);
|
||
|
return false;
|
||
|
}
|
||
|
})
|
||
|
return actions.join('');
|
||
|
}
|
||
|
|
||
|
|
||
|
//加密方法
|
||
|
export function encryption(unEncrypted) {
|
||
|
unEncrypted += '/Rick';
|
||
|
let code = '';
|
||
|
let key = 0x75;
|
||
|
for (let i = 0; i < unEncrypted .length; i++) {
|
||
|
code += String.fromCharCode(unEncrypted .charCodeAt(i) ^ key);
|
||
|
}
|
||
|
return code;
|
||
|
}
|
||
|
|
||
|
//解密方法
|
||
|
export function decryption(encrypted) {
|
||
|
let code = '';
|
||
|
let key = 0x75;
|
||
|
for (var i = 0; i < encrypted.length; i++) {
|
||
|
code += (String.fromCharCode(encrypted.charCodeAt(i) ^ key));
|
||
|
}
|
||
|
code = code.replace(/\/Rick/,'')
|
||
|
return code;
|
||
|
}
|