import request from "@/scripts/httpRequest";
|
|
// 获取菜单数据
|
export const getMenuListData = (query: any) => {
|
let token = sessionStorage.getItem('loginedInfo') && JSON.parse(sessionStorage.getItem('loginedInfo')).access_token
|
return request({
|
url: "/data/api-u/sysmenus/me",
|
method: "get",
|
headers: {
|
'Content-Type': 'application/x-www-form-urlencoded',
|
'Authorization': token || ''
|
},
|
params: query
|
});
|
};
|
// 递归获取菜单,获取全部权限
|
/***
|
* arr 菜单数组
|
* fn 回调必用
|
***/
|
export const findButtonAuthoritys = (arr: any, fn: any) => {
|
fn = fn || function () { }
|
if (Array.isArray(arr)) {
|
for (let iteam of arr) {
|
if (iteam.type === 2 && iteam.permission !== '') {
|
fn(iteam.permission)
|
}
|
if (iteam.child) {
|
findButtonAuthoritys(iteam.child, fn)
|
}
|
}
|
}
|
}
|
|
export const pad0 = (val: Number) => {
|
return val < 10 ? "0" + val : val;
|
}
|
|
export const getUrlKey = (name: String) => {
|
return (
|
decodeURIComponent(
|
(new RegExp("[?|&]" + name + "=" + "([^&;]+?)(&|#|;|$)").exec(
|
location.href
|
) || [, ""])[1].replace(/\+/g, "%20")
|
) || null
|
);
|
}
|