import request from "./index";
|
import qs from "qs";
|
|
// 获取菜单数据
|
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)
|
}
|
}
|
}
|
}
|
// 数组去重-1标识未找到
|
export const findInArr = (n:any, arr:any) => {
|
for (let i = 0; i < arr.length; i++) {
|
if (arr[i] === n) {
|
return i
|
}
|
}
|
return -1
|
}
|
|
// 通过md5获取文件路径
|
export const getFilePath = (query:any) => request({
|
url: `/admin/api-f/file/path?identifier=${query.identifier}&filename=${query.filename}`,
|
method: "get",
|
})
|