+ {context => {
+ const { authList } = context;
+ return {authList[authKey] ? children : '无权限'}
;
+ }}
+
+ );
+ }
+}
+
+export default AuthorityControl;
diff --git a/admin-web/src/layouts/GlobalAuthorityContext.js b/admin-web/src/layouts/GlobalAuthorityContext.js
new file mode 100644
index 000000000..e0ee5ec51
--- /dev/null
+++ b/admin-web/src/layouts/GlobalAuthorityContext.js
@@ -0,0 +1,9 @@
+import React from 'react';
+
+// 创建全局的权限控制 context,方便在所有页面使用
+const GlobalAuthorityContext = React.createContext({
+ theme: 'dark',
+ toggle: () => {},
+});
+
+export default GlobalAuthorityContext;
diff --git a/admin-web/src/pages/Home/Home.js b/admin-web/src/pages/Home/Home.js
new file mode 100644
index 000000000..f334d7ebb
--- /dev/null
+++ b/admin-web/src/pages/Home/Home.js
@@ -0,0 +1,28 @@
+import React, { Component } from 'react';
+import { Button } from 'antd';
+import AuthorityControl from '../../components/AuthorityControl';
+import GlobalAuthority from '../../layouts/GlobalAuthorityContext';
+
+export default class Home extends Component {
+ state = {};
+
+ render() {
+ // 定义认证的属性 TODO
+ const GlobalAuthorityProps = {
+ user: 'admin',
+ login: 'success',
+ authList: {
+ 'auth.button': true,
+ },
+ };
+
+ return (
+