ZZJ
2022-07-27 f358f667a292973618199b51552d61179181cf1d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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",
  })