1 Star 0 Fork 0

huangxiaolun/react-admins

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
.eslintcache 20.38 KB
一键复制 编辑 原始数据 按行查看 历史
huangxiaolun 提交于 2021-02-23 14:00 . 权限菜单ui和基本交互完成
[{"E:\\lianxi\\react-admins\\src\\index.js":"1","E:\\lianxi\\react-admins\\src\\App.js":"2","E:\\lianxi\\react-admins\\src\\views\\layout\\Index.js":"3","E:\\lianxi\\react-admins\\src\\views\\account\\index.js":"4","E:\\lianxi\\react-admins\\src\\components\\PrivateRouter\\index.js":"5","E:\\lianxi\\react-admins\\src\\views\\layout\\components\\Aside.js":"6","E:\\lianxi\\react-admins\\src\\views\\layout\\components\\Header.js":"7","E:\\lianxi\\react-admins\\src\\views\\account\\RegisterForm.js":"8","E:\\lianxi\\react-admins\\src\\views\\account\\LoginForm.js":"9","E:\\lianxi\\react-admins\\src\\components\\mainContent\\index.js":"10","E:\\lianxi\\react-admins\\src\\utils\\sesstion.js":"11","E:\\lianxi\\react-admins\\src\\utils\\validate.js":"12","E:\\lianxi\\react-admins\\src\\components\\mainContent\\components.js":"13","E:\\lianxi\\react-admins\\src\\components\\code\\index.js":"14","E:\\lianxi\\react-admins\\src\\api\\account.js":"15","E:\\lianxi\\react-admins\\src\\components\\asideMenu\\index.js":"16","E:\\lianxi\\react-admins\\src\\utils\\request.js":"17","E:\\lianxi\\react-admins\\src\\views\\department\\Add.js":"18","E:\\lianxi\\react-admins\\src\\views\\department\\List.js":"19","E:\\lianxi\\react-admins\\src\\views\\job\\Add.js":"20","E:\\lianxi\\react-admins\\src\\views\\job\\List.js":"21","E:\\lianxi\\react-admins\\src\\views\\staff\\Add.js":"22","E:\\lianxi\\react-admins\\src\\views\\staff\\List.js":"23","E:\\lianxi\\react-admins\\src\\views\\user\\Add.js":"24","E:\\lianxi\\react-admins\\src\\views\\user\\List.js":"25","E:\\lianxi\\react-admins\\src\\router\\index.js":"26","E:\\lianxi\\react-admins\\src\\api\\common.js":"27","E:\\lianxi\\react-admins\\src\\global\\data.js":"28","E:\\lianxi\\react-admins\\src\\components\\tableData\\index.js":"29","E:\\lianxi\\react-admins\\src\\components\\formSearch\\index.js":"30","E:\\lianxi\\react-admins\\src\\components\\form\\index.js":"31","E:\\lianxi\\react-admins\\src\\global\\config.js":"32","E:\\lianxi\\react-admins\\src\\components\\Editor\\Index.js":"33","E:\\lianxi\\react-admins\\src\\components\\upload\\Index.js":"34","E:\\lianxi\\react-admins\\src\\components\\select\\Index.js":"35","E:\\lianxi\\react-admins\\src\\views\\user\\Modal.js":"36","E:\\lianxi\\react-admins\\src\\api\\permission.js":"37","E:\\lianxi\\react-admins\\src\\store\\index.js":"38","E:\\lianxi\\react-admins\\src\\store\\reducer\\index.js":"39","E:\\lianxi\\react-admins\\src\\store\\action-types.js":"40","E:\\lianxi\\react-admins\\src\\store\\reducer\\user.js":"41","E:\\lianxi\\react-admins\\src\\store\\action\\user.js":"42","E:\\lianxi\\react-admins\\src\\store\\action\\index.js":"43","E:\\lianxi\\react-admins\\src\\components\\checkboxAll\\Index.js":"44","E:\\lianxi\\react-admins\\src\\store\\action\\menuPer.js":"45","E:\\lianxi\\react-admins\\src\\store\\reducer\\menuPer.js":"46"},{"size":152,"mtime":1608276466155,"results":"47","hashOfConfig":"48"},{"size":811,"mtime":1613812281437,"results":"49","hashOfConfig":"48"},{"size":1553,"mtime":1613789013314,"results":"50","hashOfConfig":"48"},{"size":677,"mtime":1608286154657,"results":"51","hashOfConfig":"48"},{"size":526,"mtime":1608623527056,"results":"52","hashOfConfig":"48"},{"size":486,"mtime":1608701952272,"results":"53","hashOfConfig":"48"},{"size":1313,"mtime":1613970051534,"results":"54","hashOfConfig":"48"},{"size":3546,"mtime":1608604385915,"results":"55","hashOfConfig":"48"},{"size":4899,"mtime":1613962547220,"results":"56","hashOfConfig":"48"},{"size":1211,"mtime":1608700040024,"results":"57","hashOfConfig":"48"},{"size":560,"mtime":1613790856346,"results":"58","hashOfConfig":"48"},{"size":1210,"mtime":1609300191724,"results":"59","hashOfConfig":"48"},{"size":574,"mtime":1608702048209,"results":"60","hashOfConfig":"48"},{"size":2256,"mtime":1608603409843,"results":"61","hashOfConfig":"48"},{"size":370,"mtime":1608708404479,"results":"62","hashOfConfig":"48"},{"size":4260,"mtime":1613972921686,"results":"63","hashOfConfig":"48"},{"size":4607,"mtime":1608705700650,"results":"64","hashOfConfig":"48"},{"size":2817,"mtime":1608873224231,"results":"65","hashOfConfig":"48"},{"size":5240,"mtime":1609231459973,"results":"66","hashOfConfig":"48"},{"size":2992,"mtime":1609227210732,"results":"67","hashOfConfig":"48"},{"size":5630,"mtime":1609231985106,"results":"68","hashOfConfig":"48"},{"size":10173,"mtime":1611107085253,"results":"69","hashOfConfig":"48"},{"size":5813,"mtime":1611045779214,"results":"70","hashOfConfig":"48"},{"size":217,"mtime":1608622038213,"results":"71","hashOfConfig":"48"},{"size":6691,"mtime":1614057472031,"results":"72","hashOfConfig":"48"},{"size":1368,"mtime":1613813586739,"results":"73","hashOfConfig":"48"},{"size":992,"mtime":1609307854404,"results":"74","hashOfConfig":"48"},{"size":3834,"mtime":1609292580806,"results":"75","hashOfConfig":"48"},{"size":4243,"mtime":1611043586288,"results":"76","hashOfConfig":"48"},{"size":6477,"mtime":1611132960853,"results":"77","hashOfConfig":"48"},{"size":12307,"mtime":1613983089425,"results":"78","hashOfConfig":"48"},{"size":201,"mtime":1608876308697,"results":"79","hashOfConfig":"48"},{"size":2321,"mtime":1609308759732,"results":"80","hashOfConfig":"48"},{"size":3767,"mtime":1611108921127,"results":"81","hashOfConfig":"48"},{"size":2510,"mtime":1609236514740,"results":"82","hashOfConfig":"48"},{"size":7338,"mtime":1614060000449,"results":"83","hashOfConfig":"48"},{"size":196,"mtime":1613971738239,"results":"84","hashOfConfig":"48"},{"size":966,"mtime":1613959481748,"results":"85","hashOfConfig":"48"},{"size":181,"mtime":1614049439130,"results":"86","hashOfConfig":"48"},{"size":137,"mtime":1614046815926,"results":"87","hashOfConfig":"48"},{"size":585,"mtime":1613972846832,"results":"88","hashOfConfig":"48"},{"size":4452,"mtime":1613972844296,"results":"89","hashOfConfig":"48"},{"size":80,"mtime":1613815016915,"results":"90","hashOfConfig":"48"},{"size":3416,"mtime":1614056657201,"results":"91","hashOfConfig":"48"},{"size":209,"mtime":1614059954870,"results":"92","hashOfConfig":"48"},{"size":446,"mtime":1614051939261,"results":"93","hashOfConfig":"48"},{"filePath":"94","messages":"95","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},"b1pxrs",{"filePath":"97","messages":"98","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"99","messages":"100","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"101","messages":"102","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"103","messages":"104","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"105","messages":"106","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"107","messages":"108","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"109","messages":"110","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"111","messages":"112","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"113","messages":"114","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"115","messages":"116","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"117","messages":"118","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"119","messages":"120","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"121","messages":"122","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"123","messages":"124","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"125","messages":"126","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"127","messages":"128","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"129","messages":"130","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"131","messages":"132","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"133","messages":"134","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"135","messages":"136","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"137","messages":"138","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"139","messages":"140","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"141","messages":"142","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"143","messages":"144","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"145","messages":"146","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"147","messages":"148","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"149","messages":"150","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"151","messages":"152","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"153","messages":"154","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"155","messages":"156","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"157","messages":"158","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"159","messages":"160","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"161","messages":"162","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"163","messages":"164","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"165","messages":"166","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"167","messages":"168","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"169","messages":"170","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"171","messages":"172","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"173","messages":"174","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"175","messages":"176","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"177","messages":"178","errorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":"179","usedDeprecatedRules":"96"},{"filePath":"180","messages":"181","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"182","messages":"183","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"184","messages":"185","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"96"},{"filePath":"186","messages":"187","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"E:\\lianxi\\react-admins\\src\\index.js",[],["188","189"],"E:\\lianxi\\react-admins\\src\\App.js",[],"E:\\lianxi\\react-admins\\src\\views\\layout\\Index.js",[],"E:\\lianxi\\react-admins\\src\\views\\account\\index.js",[],"E:\\lianxi\\react-admins\\src\\components\\PrivateRouter\\index.js",[],"E:\\lianxi\\react-admins\\src\\views\\layout\\components\\Aside.js",[],"E:\\lianxi\\react-admins\\src\\views\\layout\\components\\Header.js",[],"E:\\lianxi\\react-admins\\src\\views\\account\\RegisterForm.js",[],"E:\\lianxi\\react-admins\\src\\views\\account\\LoginForm.js",[],"E:\\lianxi\\react-admins\\src\\components\\mainContent\\index.js",[],"E:\\lianxi\\react-admins\\src\\utils\\sesstion.js",[],"E:\\lianxi\\react-admins\\src\\utils\\validate.js",[],"E:\\lianxi\\react-admins\\src\\components\\mainContent\\components.js",[],"E:\\lianxi\\react-admins\\src\\components\\code\\index.js",[],"E:\\lianxi\\react-admins\\src\\api\\account.js",[],"E:\\lianxi\\react-admins\\src\\components\\asideMenu\\index.js",[],"E:\\lianxi\\react-admins\\src\\utils\\request.js",[],"E:\\lianxi\\react-admins\\src\\views\\department\\Add.js",[],"E:\\lianxi\\react-admins\\src\\views\\department\\List.js",[],"E:\\lianxi\\react-admins\\src\\views\\job\\Add.js",[],"E:\\lianxi\\react-admins\\src\\views\\job\\List.js",[],"E:\\lianxi\\react-admins\\src\\views\\staff\\Add.js",[],"E:\\lianxi\\react-admins\\src\\views\\staff\\List.js",[],"E:\\lianxi\\react-admins\\src\\views\\user\\Add.js",[],"E:\\lianxi\\react-admins\\src\\views\\user\\List.js",[],"E:\\lianxi\\react-admins\\src\\router\\index.js",[],"E:\\lianxi\\react-admins\\src\\api\\common.js",[],"E:\\lianxi\\react-admins\\src\\global\\data.js",[],"E:\\lianxi\\react-admins\\src\\components\\tableData\\index.js",[],"E:\\lianxi\\react-admins\\src\\components\\formSearch\\index.js",[],"E:\\lianxi\\react-admins\\src\\components\\form\\index.js",[],"E:\\lianxi\\react-admins\\src\\global\\config.js",[],"E:\\lianxi\\react-admins\\src\\components\\Editor\\Index.js",[],"E:\\lianxi\\react-admins\\src\\components\\upload\\Index.js",[],"E:\\lianxi\\react-admins\\src\\components\\select\\Index.js",[],"E:\\lianxi\\react-admins\\src\\views\\user\\Modal.js",[],"E:\\lianxi\\react-admins\\src\\api\\permission.js",[],"E:\\lianxi\\react-admins\\src\\store\\index.js",[],"E:\\lianxi\\react-admins\\src\\store\\reducer\\index.js",[],"E:\\lianxi\\react-admins\\src\\store\\action-types.js",[],"E:\\lianxi\\react-admins\\src\\store\\reducer\\user.js",[],"E:\\lianxi\\react-admins\\src\\store\\action\\user.js",["190","191","192","193"],"import * as TYPES from '../action-types';\r\nimport { login } from \"@/api/account\";\r\nimport {getUserRole} from '@/api/permission'\r\nimport { setToken,setSession,removeSession,removeToken } from \"@/utils/sesstion\";\r\nimport {message} from 'antd'\r\nimport {push} from 'react-router-redux' // redux里面要进行路由跳转 react-router-redux 还有其他方案吗 ? \r\nimport store from '../index'\r\nimport router from '@/router/index'\r\n\r\nlet actions = {\r\n // redux-promise\r\n // 登录 \r\n toLogin:async (requestData)=>{\r\n return {\r\n type:TYPES.Login,\r\n payload:await login(requestData).then(res=>{\r\n const { resCode, data } = res;\r\n try {\r\n if (resCode === 0) {\r\n setToken(data.token);\r\n setSession('Username',data.username)\r\n setSession('role',data.role) \r\n // 登录成功后跳转到首页\r\n store.dispatch(push('/index')) // this.props.history.push(\"/index\");\r\n }\r\n message.success(res.message);\r\n } catch (error) {\r\n this.setState({ loading: false });\r\n message.warn(\"登录失败\");\r\n }\r\n return data\r\n })\r\n }\r\n },\r\n // redux-thunk\r\n // 注销 \r\n toLogout(){\r\n // 清除缓存\r\n removeSession('Username')\r\n removeToken()\r\n return (dispatch)=>{\r\n dispatch(push('/'))\r\n dispatch({type:TYPES.Logout})\r\n }\r\n },\r\n // 掉接口获取-当前用户的角色权限\r\n getUserRoles:async ()=>{\r\n return {\r\n type:TYPES.RouteAry,\r\n payload: await getUserRole().then(res=>{\r\n return actions.handleRoutes(res.data.role)\r\n })\r\n }\r\n },\r\n\r\n\r\n // 过滤路由 \r\n handleRoute:()=>{\r\n return (dispatch,getState)=>{\r\n // const {userRoute , userData} = getState().user \r\n //可以从userData中取--但是这样不好 角色和用户登录数据没分开---刷新后数据容易丢失 解决办法:本地存储--掉接口\r\n // 从本地取出(存在本地的)当前用户的角色权限有哪些 \r\n let userRole = JSON.parse(sessionStorage.getItem('role')) \r\n userRole =userRole && userRole.split(\",\");\r\n // // 存储路由 \r\n let routers =[] \r\n // // 如果userRole包含admin--超级管理员 就全部展示 \r\n if(userRole.includes('admin')){\r\n routers=router\r\n }else{\r\n // 其它的 过滤\r\n routers = router.filter(item=>{\r\n if(actions.hasPermission(item,userRole)){\r\n // 如果有子级的话\r\n if(item.child && item.child.length>0){\r\n item.child = item.child.filter(child=>{\r\n if(actions.hasPermission(child,userRole)){\r\n return child\r\n }\r\n })\r\n }\r\n return item\r\n }\r\n })\r\n }\r\n dispatch({type:TYPES.RouteAry,payload:routers})\r\n }\r\n },\r\n // 通过接口方式-过滤路由 \r\n handleRoutes:(params)=>{\r\n const userRole =params && params.split(\",\");\r\n // // 存储路由 \r\n let routers =[] \r\n // // 如果userRole包含admin--超级管理员 就全部展示 \r\n if(userRole.includes('admin')){\r\n routers=router\r\n }else{\r\n // 其它的 过滤\r\n routers = router.filter(item=>{\r\n if(actions.hasPermission(item,userRole)){\r\n // 如果有子级的话\r\n if(item.child && item.child.length>0){\r\n item.child = item.child.filter(child=>{\r\n if(actions.hasPermission(child,userRole)){\r\n return child\r\n }\r\n })\r\n }\r\n return item\r\n }\r\n })\r\n }\r\n return routers\r\n },\r\n \r\n \r\n // 方法 \r\n // 过滤函数 -- 便于子级递归过滤 \r\n hasPermission:(item,router)=>{\r\n if(item.role && item.role.length>0){\r\n return router.some(elem=>item.role.indexOf(elem)>=0);\r\n }\r\n }\r\n\r\n \r\n};\r\nexport default actions;","E:\\lianxi\\react-admins\\src\\store\\action\\index.js",[],"E:\\lianxi\\react-admins\\src\\components\\checkboxAll\\Index.js",[],"E:\\lianxi\\react-admins\\src\\store\\action\\menuPer.js",[],"E:\\lianxi\\react-admins\\src\\store\\reducer\\menuPer.js",[],{"ruleId":"194","replacedBy":"195"},{"ruleId":"196","replacedBy":"197"},{"ruleId":"198","severity":1,"message":"199","line":72,"column":46,"nodeType":"200","messageId":"201","endLine":72,"endColumn":48},{"ruleId":"198","severity":1,"message":"199","line":76,"column":57,"nodeType":"200","messageId":"201","endLine":76,"endColumn":59},{"ruleId":"198","severity":1,"message":"199","line":99,"column":38,"nodeType":"200","messageId":"201","endLine":99,"endColumn":40},{"ruleId":"198","severity":1,"message":"199","line":103,"column":49,"nodeType":"200","messageId":"201","endLine":103,"endColumn":51},"no-native-reassign",["202"],"no-negated-in-lhs",["203"],"array-callback-return","Array.prototype.filter() expects a value to be returned at the end of arrow function.","ArrowFunctionExpression","expectedAtEnd","no-global-assign","no-unsafe-negation"]
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/huangxiaolun/react-admins.git
git@gitee.com:huangxiaolun/react-admins.git
huangxiaolun
react-admins
react-admins
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385