access.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * @Author: your name
  3. * @Date: 2021-09-03 14:28:27
  4. * @LastEditTime: 2021-10-09 09:40:42
  5. * @LastEditors: Please set LastEditors
  6. * @Description: In User Settings Edit
  7. * @FilePath: /MedicalWisdomCheckSys/src/access.ts
  8. */
  9. /**
  10. * @see https://umijs.org/zh-CN/plugins/plugin-access
  11. * */
  12. type menuDataItemType = {
  13. path: string,
  14. name: string,
  15. icon: any,
  16. component: string,
  17. children?: menuDataItemType[]
  18. }
  19. export default function access(initialState: { currentUser?: API.CurrentUser | undefined,menu: menuDataItemType[],isDev: boolean}) {
  20. // const { currentUser,menu,isDev } = initialState || {};
  21. return {
  22. // canAdmin: currentUser && currentUser.access === 'admin',
  23. // normalRouteFilter:(route: any)=>{
  24. // const routePathArr = menu.map(t=>(t.path));
  25. // // console.log({routePathArr,route});
  26. // // console.log(routePathArr.includes(route.path));
  27. // //开发环境无视菜单权限
  28. // return isDev?true:routePathArr.includes(route.path)
  29. // }
  30. canAdmin: true,
  31. normalRouteFilter:(route: any)=>{
  32. return true;
  33. }
  34. };
  35. }