|
@@ -14,7 +14,7 @@
|
|
|
* @param {string} path
|
|
|
* @returns {Boolean}
|
|
|
*/
|
|
|
-export function isExternal (path) {
|
|
|
+export function isExternal(path) {
|
|
|
return /^(https?:|mailto:|tel:)/.test(path)
|
|
|
}
|
|
|
|
|
@@ -22,7 +22,7 @@ export function isExternal (path) {
|
|
|
* @param {string} str
|
|
|
* @returns {Boolean}
|
|
|
*/
|
|
|
-export function validUsername (str) {
|
|
|
+export function validUsername(str) {
|
|
|
const valid_map = ['admin', 'editor']
|
|
|
return valid_map.indexOf(str.trim()) >= 0
|
|
|
}
|
|
@@ -31,13 +31,13 @@ export function validUsername (str) {
|
|
|
* @param {string} str
|
|
|
* @returns {Object}
|
|
|
*/
|
|
|
-export function orgTree (str) {
|
|
|
+export function orgTree(str) {
|
|
|
const valid_map = ['admin', 'editor']
|
|
|
return valid_map.indexOf(str.trim()) >= 0
|
|
|
}
|
|
|
|
|
|
// 岗位树构造
|
|
|
-export function translateDataToTreeAll (data, parentKey, parentIDKey) {
|
|
|
+export function translateDataToTreeAll(data, parentKey, parentIDKey) {
|
|
|
let parent = data.filter((value) => Number(value[parentKey]) <= 0);// 父数据
|
|
|
let children = data.filter((value) => Number(value[parentKey]) > 0);// 子数据
|
|
|
//console.log('--parent', parent)
|
|
@@ -61,7 +61,7 @@ export function translateDataToTreeAll (data, parentKey, parentIDKey) {
|
|
|
return parent;
|
|
|
}
|
|
|
|
|
|
-export function deteleObject (obj) {
|
|
|
+export function deteleObject(obj) {
|
|
|
var uniques = [];
|
|
|
var stringify = {};
|
|
|
for (var i = 0; i < obj.length; i++) {
|
|
@@ -84,12 +84,12 @@ export function deteleObject (obj) {
|
|
|
}
|
|
|
|
|
|
// 随机长度
|
|
|
-function randomNum (start, end) {
|
|
|
+function randomNum(start, end) {
|
|
|
return Math.floor(Math.random() * (Number(end) - Number(start)) + start)
|
|
|
}
|
|
|
|
|
|
//字母随机
|
|
|
-function randomAlp (arr, count) {
|
|
|
+function randomAlp(arr, count) {
|
|
|
let shuffled = arr.slice(0), i = arr.length, min = i - count, temp, index;
|
|
|
while (i-- > min) {
|
|
|
index = Math.floor((i + 1) * Math.random());
|
|
@@ -107,13 +107,13 @@ function randomAlp (arr, count) {
|
|
|
* @returns {Object}
|
|
|
* 4位密码规则 1111 = 大写 小写 特殊字符 数字 都开启
|
|
|
*/
|
|
|
-export function pwdProduce (minLen, maxLen, struc) {
|
|
|
+export function pwdProduce(minLen, maxLen, struc) {
|
|
|
// 密码规则转化
|
|
|
const pwdStruc = typeof (struc) === 'string' ? struc.split('') : `${struc}`.split('')
|
|
|
// 字母
|
|
|
const alphabet = 'abcdefghijklmnopqrstuvwxyz'
|
|
|
// 特殊字符
|
|
|
- const special = ['~', '!', '@', '#', '$', '%', '^', '&', '*', '_', '+', '.']
|
|
|
+ const special = ['!', '%', '&', ',', ';', '=', '?', '$', '@', '#', '$', '*', "'"]
|
|
|
//数字
|
|
|
const numbers = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
|
|
// 密码随机长度
|