Compare commits

..
401 Commits
Author SHA1 Message Date
baorong ccaf67076e bump version: 6.0.0 2026-03-14 14:20:35 +08:00
baorong 8f7dd82e40 refactor: umi v4 support 2026-03-13 23:07:16 +08:00
baorong 9989aa4de5 bump version: 5.5.0 2026-02-19 22:06:42 +08:00
baorong f983533d59 chore dep: use puppeteer-core because npm install easy to fail 2026-02-19 22:03:32 +08:00
baorong 2182759d47 chore dep: little mistake 2026-02-19 21:43:23 +08:00
baorong 4d1851ddd2 chore deps: upgrade axios to 1.x 2026-02-19 21:30:25 +08:00
baorong 0d82eca735 chore lint: code sth. 2026-02-19 21:28:07 +08:00
baorong cfb6b271ee chore code: clear some warnings and remove MapChart & AirportCoord 2026-02-19 21:19:40 +08:00
baorong 0b97964457 fix i18n: lingui not work 2026-02-18 19:28:50 +08:00
baorong edfbfcf5db chore(code): adapt code to antd v6 2026-02-18 19:28:00 +08:00
baorong e5172432df chore dep: use highcharts-react-official 2026-02-18 19:04:53 +08:00
baorong 741b04f120 chore deps: upgrade lingui to v5 2026-02-18 15:53:34 +08:00
baorong 83f2cc1344 chore dep: upgrade antd v6 2026-02-13 17:56:40 +08:00
baorong 152556d582 chore dep: upgrade to lingui v4 2026-02-13 17:39:53 +08:00
Baorong Li 67fc31a008 Merge pull request #1165 from baocang/codex/find-and-fix-two-bugs
fix: correct typos in build config and demo
2025-05-29 22:23:18 +08:00
Baocang Nie 23eace8350 fix: correct typos in build config and demo 2025-05-28 11:13:32 +08:00
Baorong 93817e4840 fix: dep mis with pnpm 2024-04-13 12:50:58 +08:00
Baorong bb97d982e4 fix: npm run start not work #1152 2024-04-13 12:49:16 +08:00
Baorong Li 700f58015d Merge pull request #1156 from XyanZhang/master
fix: clicking on the sidebar collapse button results in a blank screen.
2023-06-14 15:17:56 +08:00
XyanZhang 872ce3a825 fix: can't scroll when the media is mobile 2023-06-14 14:47:06 +08:00
XyanZhang 385b31e7bb fix: clicking on the sidebar collapse button results in a blank screen. 2023-06-14 14:16:33 +08:00
Baorong Li 3d66a616ff chore readme: change documentation url 2023-02-21 10:36:16 +08:00
superlbr b7e18a1214 fix locale: change locale filepath due to antd5 #1146 2023-01-22 20:44:28 +08:00
Baorong Li 3b0bae9c70 chore umirc: set antd to false since v5 2022-12-22 10:14:27 +08:00
Baorong Li 8b9343a320 Merge pull request #1142 from vagusX/feat/upgrade-antd-v5
feat: upgrade antd v5
2022-11-27 17:32:40 +08:00
vagusx 8618c75459 feat: replace moment to dayjs 2022-11-27 16:29:42 +08:00
vagusx 711d2077e2 feat: import BackTop from FloatButton 2022-11-27 16:17:07 +08:00
vagusx b25646b033 feat: rename modal open 2022-11-27 15:54:25 +08:00
vagusx 02bf7784b1 feat: upgrade antd v5 2022-11-26 22:15:15 +08:00
Baorong Li c164d60643 Merge pull request #1132 from SuperRay3/master
fix: 修复 antd 组件无法国际化的问题
2022-05-23 15:59:15 +08:00
leijialiang 1bd4cfe73c fix: 修复 antd 组件无法国际化的问题 2022-05-23 14:43:09 +08:00
superlbr f4e1eeb21c fix login: form mis password 2021-12-24 15:19:15 +08:00
superlbr 4b5fe62014 fix i18n: t not work use Trans instead 2021-12-23 20:09:35 +08:00
superlbr 36c2be61ae chore readme: add account/password desc. 2021-11-16 16:08:26 +08:00
superlbr e9206a9448 fix dev: loading chunk mf-dep_async failed 2021-08-03 18:31:03 +08:00
superlbr 0bf28879c4 chore umi: enable mfsu 2021-08-03 17:47:27 +08:00
superlbr 7c936712b9 fix dev: #1108 #1109 2021-07-15 08:15:51 +08:00
Baorong Li e32a19fe3b chore dep: normal 2021-03-26 22:22:33 +08:00
Baorong Li c6382c6221 chore umi: use default targets no ie support 2021-03-26 22:20:53 +08:00
Baorong Li 02280fbed9 Merge pull request #1091 from jaywhen/patch-1
fix garbled characters in README-zh_CN.md
2021-03-17 17:46:29 +08:00
zainchen d897eb205d fix: adding babel preset to fixing extract command 2021-03-17 17:44:38 +08:00
Baorong Li b1f290ea32 upgrade dep: echarts@5.x 2021-03-17 17:28:05 +08:00
Baorong Li 0e36b6b7a0 fix utils: remove params to close #1067 in request 2021-03-17 17:03:14 +08:00
Baorong Li d92f121cf4 upgrade lingui: 3.x 2021-03-17 16:50:49 +08:00
Xiang Jaywhen 0a73ba0f12 fix garbled characters in README-zh_CN.md 2021-02-19 23:19:51 +08:00
Baorong Li 9e4e0efbab Merge pull request #1082 from AmagiDDmxh/master
Fix en layout doc typo, same as before #1081
2020-12-21 23:27:57 -06:00
amagiddmxh 524dff07d2 Fix en layout doc typo 2020-12-21 16:05:47 +08:00
Baorong Li 8b3e5c08f7 Merge pull request #1081 from AmagiDDmxh/master
There were some type in the API-config doc, https://doc.antd-admin.zuiidea.com/#/API-configuration
2020-12-21 00:23:22 -06:00
amagiddmxh c17444f5d6 Fix API config uppercase typo 2020-12-21 12:55:26 +08:00
Baorong Li df85ecdfff Merge pull request #1080 from karlhorky/patch-1
Fix typo
2020-12-15 08:24:21 -06:00
Karl Horky b8824141d6 Fix typo 2020-12-15 15:21:29 +01:00
Karl Horky aedd2ec3db Fix typo 2020-12-15 15:20:49 +01:00
zuiidea 5abad21082 ✨ Optimization Split Chunks, Antd Icon, CI. 2020-08-20 14:16:32 +08:00
Baorong Li 1ae41c7ae5 Merge pull request #1060 from mlboy/patch-1
Update README.md
2020-06-03 14:46:44 +08:00
mlboy e41671dbf9 Update README.md
调整antd版本
2020-05-13 07:42:01 +08:00
Baorong Li eaeb9092e4 bump antd-admin@5.3.0 2020-05-10 21:05:23 +08:00
Baorong Li 2f3ca0a006 Merge branch 'develop' 2020-05-10 21:04:40 +08:00
Baorong Li 1b65351be4 upgrade umi@3 fin. 2020-03-24 15:17:57 +08:00
Baorong Li 0422f6d51e upgrade umi@3 partly 2020-03-24 12:12:20 +08:00
Baorong Li 8d050d4040 fix pathToRegexp not work 2020-03-20 11:59:04 +08:00
zuiidea 82b3a4b384 ⚡️ Exclude node_modules by babel-loader. 2020-03-19 22:26:55 +08:00
Baorong Li d2f391a881 upgrade umi@3 partly 2020-03-19 17:06:31 +08:00
Baorong Li 9e778487d9 upgrade umi@3 partly 2020-03-19 12:50:12 +08:00
Baorong Li 7938d71f2f upgrade umi@3 partly 2020-03-19 00:05:44 +08:00
Baorong Li 422a6fed30 upgrade umi@3 partly 2020-03-18 16:17:25 +08:00
Baorong Li c6ea0454b3 upgrade umi@3 partly 2020-03-15 08:24:05 +08:00
Baorong Li 467767a6c5 upgrade umi@3 partly 2020-03-05 23:22:02 +08:00
Baorong Li cf795c512a bump antd-admin@5.2.0 2020-03-05 20:21:22 +08:00
Baorong Li 18b499030d upgrade antd@4.0.0 2020-02-29 22:47:45 +08:00
zuiidea d800d6f3ce Merge branch 'master' into develop 2020-01-08 09:31:45 +08:00
zuiidea 185f706107 💚 Fixing now config. 2020-01-07 17:17:57 +08:00
zuiidea 5a4661cdad Merge branch 'develop' of https://github.com/zuiidea/antd-admin into develop 2020-01-07 16:02:51 +08:00
zuiidea 7abdd94a0e 🚀 Optimize deployment configuration. 2020-01-07 16:02:33 +08:00
Baorong Li 22f0684ab0 chore: docs normal 2020-01-07 15:58:48 +08:00
Baorong Li 80b2c63693 Merge pull request #1040 from vagusX/feat/migrate-antd-v4
feat: migrate to antd v4
2019-12-02 22:07:08 -06:00
vagusX 4b2a553bda feat: add antd v4 dependencies 2019-12-03 10:19:54 +08:00
vagusX ad30e73b10 feat: migrate to antd v4 2019-12-03 09:58:49 +08:00
Baorong Li 15b62e302d bump antd-admin@5.1.3 2019-10-22 10:38:52 +08:00
Baorong Li 9d5ec20f20 Merge branch 'develop' 2019-10-22 10:37:43 +08:00
Baorong Li c878425fd0 upgrade antd@3.24.x 2019-10-22 10:30:04 +08:00
Baorong Li 90e80dda64 Merge pull request #1022 from rioarray/feature/inline-conditional-rendering
inline conditional rendering in some components
2019-10-17 16:32:30 +08:00
rioarray 1db5bfeab5 inline conditional rendering in some components 2019-10-17 14:45:30 +07:00
zuiidea b2b3fcd4a3 ✨ Support disable i18n. 2019-10-09 20:20:11 +08:00
Baorong Li 9cf97375c7 fix 404 when path = '/' 2019-08-01 23:12:42 +08:00
Baorong Li 7839b6affb Merge pull request #1007 from Louis-7/master
[fix] add notification popup to #primaryLayout instead of #layoutHeader
2019-07-25 08:26:35 -05:00
Louis 597064a07d [fix] add notification popup to #primaryLayout instead of #layoutHeader 2019-07-25 11:47:32 +08:00
Baorong Li 0ea57d14c9 fix #980 cannot read property 'map' of null 2019-07-07 23:01:20 +08:00
Baorong Li afd736d615 bump antd-admin@5.1.2 2019-07-07 22:48:34 +08:00
Baorong Li ce9b8c376f Merge pull request #996 from tuantvk/master
🐛 fix bug sub menu Charts when collapsed
2019-07-07 08:03:31 -05:00
tuantv 79776e6752 🐛 fix bug sub menu Charts when collapsed 2019-07-07 11:56:52 +07:00
zuiidea a2432022a1 ✨ Updating manifest logo and adding portugal flag image. 2019-07-02 17:47:16 +08:00
zuiidea ea5ee96bdc 🎨 Improving format of the code. 2019-07-06 11:02:56 +08:00
zuiidea fe954092a4 🐛 Fixing dva history.listen multiple triggers. 2019-07-06 10:50:50 +08:00
zuiidea 5e148fec92 Merge branch 'develop' of https://github.com/zuiidea/antd-admin into develop 2019-07-06 09:43:30 +08:00
Baorong Li 5daa2a9548 add moment locale setting 2019-07-05 22:26:29 +08:00
Baorong Li f1913f7b18 add pt_BR locale-provider in layout 2019-07-05 22:16:54 +08:00
zuiidea 65a453553e ✨ Updating mock avatar image. 2019-07-05 19:52:37 +08:00
Baorong Li 29da8f24da Merge pull request #989 from tuantvk/master
🐛 fix remove and update user error handleRefresh
2019-06-29 09:57:46 -05:00
tuantv 3443ad9968 🐛 fix edit and update user error handleRefresh 2019-06-29 21:19:57 +07:00
Baorong Li 838dc93eff bump antd-admin@5.1.1 2019-06-29 10:56:03 +08:00
Baorong Li 07ef68ec1f Merge remote-tracking branch 'origin/develop' 2019-06-29 10:54:10 +08:00
Baorong Li 3cb7f86086 fix login jump to /enundefined 2019-06-29 10:49:11 +08:00
Baorong Li fc9565c157 add a flag to detect refresh saving query times in model/app.js 2019-06-24 20:50:09 +08:00
Baorong Li 557f6022f3 bump antd-admin@5.1.0 2019-06-24 16:05:28 +08:00
Baorong Li d0a56169e3 revert dispatch query in model/app.js 2019-06-24 15:40:44 +08:00
Baorong Li f7d6e2b4ed Merge pull request #984 from lovemegowin/master
refactor user,menu,permission storage strategy
2019-06-24 15:26:06 +08:00
lovemegowin df82ee42fd fix #985 , close #985 2019-06-24 15:20:25 +08:00
lovemegowin a29d761483 refactor user, menu, permission storage strategy then make full loader unnecessary 2019-06-21 15:26:06 +08:00
lovemegowin 713a86b9d6 add null point assert 2019-06-21 15:23:19 +08:00
lovemegowin d6250f16b0 fullScreen loader is not always necessary refactor default spinning to false 2019-06-21 14:12:15 +08:00
Baorong Li 1c5d5c3788 upgrade umi@2.8.x 2019-06-20 16:31:00 +08:00
Baorong Li 699e9d9ff1 fix warning inlineCollapsed not control Menu under Sider 2019-06-04 15:47:35 +08:00
Baorong Li fad0cb931a use options instead of option in react-perfect-scrollbar 2019-06-04 15:34:45 +08:00
Baorong Li 5d7ff55869 upgrade dependency 2019-06-04 15:09:51 +08:00
Baorong Li 642ccb5b82 Merge pull request #975 from deepred5/master
fix: 关闭弹窗时有动画效果
2019-05-27 23:59:48 -05:00
深红 51a7ce0827 update: 关闭弹窗时销毁子元素,保证initialValue更新并且关闭弹窗时有动画效果 2019-05-28 10:27:27 +08:00
Baorong Li 157a54b11d Merge pull request #969 from ccyanxyz/patch-1
fix markdown code block in docs/layout.md
2019-05-04 18:32:34 -05:00
cyan be083d81fc fix markdown code block 2019-05-05 00:38:43 +08:00
zuiidea f6c869ad47 Merge pull request #965 from zuiidea/develop
✏️  Fixing typos, exlude => exclude.
2019-04-18 10:10:14 +08:00
zuiidea bef5b26509 ✏️ Fixing typos, exlude => exclude. 2019-04-18 09:58:16 +08:00
Baorong Li 59cfe24178 Merge branch 'develop'
# Conflicts:
#	package.json
2019-04-10 07:27:25 +08:00
Baorong Li 87d0d58ae8 Merge commit '0ac4839e948f7b1d34c90d33f4ece483bd9d2f48' 2019-04-10 07:24:20 +08:00
Baorong Li de8b6c972d bump antd-admin@5.0.6 2019-04-10 07:24:06 +08:00
Baorong Li 0ac4839e94 upgrade umi@2.6.x 2019-04-10 07:22:53 +08:00
Baorong Li 565bce6d8b refix #958 by reset form in componentDidUpdate 2019-04-05 09:02:25 +08:00
Baorong Li b278b028cf fix #958 redux form initialValues not updating with state 2019-04-04 16:45:28 +08:00
Baorong Li 33abd9369e fix #957 an flaw ignored 2019-03-19 10:59:37 +08:00
Baorong Li e6b2f7f271 fix #950 modify z-index in header 2019-03-13 16:59:12 +08:00
Baorong Li 0bd1e9cf59 fix #947 misspelled word cancel 2019-03-06 12:11:42 +08:00
Baorong Li 693625bf2c bump antd-admin@5.0.5 2019-03-05 16:23:16 +08:00
Baorong Li 3a6c587569 upgrade antd@3.14 2019-03-05 16:17:12 +08:00
Baorong Li bd85eaf0a0 fix less is not a command in prettier 2019-03-05 16:15:33 +08:00
Baorong Li 29aa0f416e fix Cannot read property 'addEventListener' of null #946 2019-03-05 16:15:02 +08:00
Baorong Li 5b32607911 bump antd-admin@5.0.4 2019-02-19 22:00:36 +08:00
Baorong Li 76e5359752 upgrade umi@2.5.0 2019-02-19 21:46:01 +08:00
Baorong Li 5ec4efbb6e reset default lang to en 2019-02-07 09:19:39 +08:00
Baorong Li f8bb7b421a remove description about support IE9/IE10 that not working well 2019-02-07 08:52:40 +08:00
Baorong Li 887c169aa8 upgrade and lock antd@3.13.0 2019-02-07 08:36:53 +08:00
Baorong Li 8c10dcc6c2 Merge pull request #939 from rrfaria/feature/pt-br
added pt-br language and some improvements to language control to route mocks
2019-02-07 08:08:01 +08:00
Rafael Faria 671da6b5fa added pt-br and some improvements to language control 2019-02-06 14:39:02 -02:00
Baorong Li 7fdb2f4ea8 bump antd-admin@5.0.3 2019-01-11 18:43:48 +08:00
Baorong Li 67388b31f5 enable umi treeShaking 2019-01-11 18:40:39 +08:00
Baorong Li 2379cca765 upgrade umi@2.4.0 & antd@3.12.x 2019-01-11 18:39:19 +08:00
Baorong Li 34be6651e5 fix #935 root path / will be not found after login 2019-01-10 17:36:23 +08:00
Baorong Li 10f8e3e8ef fix mix require / module.exports and import / export #934 2019-01-08 23:30:18 +08:00
Baorong Li 0c6ea8eb5c fix cannot read property 'hash' of undefined by turn off hardSource 2019-01-08 22:56:23 +08:00
Baorong Li 6e69b06e61 Publish antd-admin@5.0.2 2018-12-28 14:01:51 +08:00
Baorong Li 98ba383a68 upgrade umi@2.3 antd@3.11 2018-12-28 11:42:44 +08:00
Baorong Li 4e6d81a9bf Merge pull request #928 from luckcoding/fix-bread-link
fix bread route has no matching lang
2018-12-13 22:35:56 +08:00
Baorong Li 0e2c206023 Merge branch 'develop' into fix-bread-link 2018-12-13 22:35:47 +08:00
luckcoding 285f06d1e7 fix bread route has no matching lang 2018-12-13 16:57:49 +08:00
Baorong Li d03787a871 Publish antd-admin@5.0.1 2018-12-12 13:48:34 +08:00
zuiidea 6aead03f3e 🐛 Fix style error when menu is collapsed. 2018-12-12 11:35:44 +08:00
Baorong Li 0949a298c9 fix #924 404 Not Found after router change 2018-12-12 06:53:26 +08:00
Baorong Li 94c8e2168f fix #926 createUser api in services 2018-12-12 06:17:30 +08:00
Baorong Li 358134f417 fallback umi to 2.2.8 to fix #923 2018-12-09 23:07:16 +08:00
Baorong Li 7eb9e06452 upgrade antd@3.10.9, umi@2.3.0-beta.3 2018-12-01 11:29:09 +08:00
zuiidea fab06d5005 fix: 🐛 CI fails when pull request 2018-11-29 10:00:11 +08:00
Baorong Li 7483572b1d Merge pull request #921 from francolaiuppa/patch-1
Mini typo fixes for English docs, Configuration section.
2018-11-29 09:45:38 +08:00
Franco Laiuppa d1ce8e0739 Mini typo fixes
Hi! Great project!

I was reading the docs and noticed some typos regarding the layout names and the `exclude` parameter, so I've decided to fix it.
I'm new to this repo so I hope this is a valid edit if not please let me know and I'll change it.

Thanks!
2018-11-28 16:53:25 +01:00
zuiidea 16860f93ad Merge pull request #920 from alexxyzeng/alex
fix: show vertical centered modal in ie
2018-11-28 10:18:22 +08:00
xiayao 6ba45d5bc3 fix: show vertical centered modal in ie 2018-11-28 00:44:21 +08:00
zuiidea f230429ddd Merge branch 'develop' of https://github.com/zuiidea/antd-admin into develop 2018-11-21 10:36:51 +08:00
zuiidea 78c3b6d597 📝 Add some comments image to document. 2018-11-20 21:30:22 +08:00
Baorong Li cdbc2782ff chore: remove beta tag in version from package.json 2018-11-20 17:50:20 +08:00
zuiidea 108aca99b9 📝 Add documentation for Add Layout. 2018-11-18 23:08:12 +08:00
Baorong Li 7dd5dfb1bf fix: icons' format not right in manifest.json 2018-11-15 14:11:47 +08:00
zuiidea ee7a0fffc2 ⚡ Update manifest.json. 2018-11-15 00:11:17 +08:00
zuiidea 6999871860 📝 Add documentation for Add Luanguage. 2018-11-14 23:46:59 +08:00
zuiidea 6742207c77 🐛 Fix cannot translate fields with variables. 2018-11-14 22:44:46 +08:00
Baorong Li d71c29ee2e feat: enable pwa 2018-11-14 13:37:34 +08:00
zuiidea 6917d6b89a Merge branch 'develop' of https://github.com/zuiidea/antd-admin into develop 2018-11-12 23:31:11 +08:00
zuiidea c3f369f0b3 📝 Add documentation for API configuration. 2018-11-12 23:30:56 +08:00
Baorong Li 01abc5ca38 upgrade antd@3.10.5 2018-11-10 09:50:20 +08:00
Baorong Li 08a348090c upgrade umi@2.3.0-beta.1 2018-11-09 23:16:42 +08:00
Baorong Li 63b1ecf79f Upgrade umi@2.2.5 2018-11-09 11:26:19 +08:00
Baorong Li efe7e74375 fix #913 handleMenuClick is not defined 2018-11-07 16:23:36 +08:00
Baorong Li 6d552d22d9 add doc about custom http header #829 2018-11-05 11:23:43 +08:00
zuiidea 017af0ddfc 📝 Update docs. 2018-11-04 22:55:50 +08:00
zuiidea c2161ceca9 📝 Update README.md and package.json. 2018-11-04 21:08:43 +08:00
Baorong Li 140af31bec adjust user mock 2018-11-03 09:39:37 +08:00
zuiidea 1199e7e618 👷 Update travis.yml. 2018-11-02 19:27:55 +08:00
zuiidea 3fa24d00fa 📝 👷 Add some English docs, Update travis.yml. 2018-11-02 19:21:22 +08:00
zuiidea 5d23c77100 📝 Add some Chinese documentations. 2018-11-02 18:13:43 +08:00
zuiidea 286178fc5e 📝 Update README.md and Add README-zh_CN.md. 2018-11-02 18:08:29 +08:00
zuiidea f6621572df ⚡ Improving performance. 2018-11-02 18:06:28 +08:00
zuiidea d32b09d802 🔧 Change configuration file 2018-11-01 19:37:09 +08:00
zuiidea dbe86ec0a8 🐛 💄 Fix can't scroll on the table, Update the UI in the dashbord page. 2018-11-01 19:34:36 +08:00
zuiidea 5f8141148a :lipstick:Update logo and favicon. 2018-11-01 09:41:34 +08:00
zuiidea c7c24983cc :memo:Write the documentation of getting started. 2018-10-31 23:33:49 +08:00
zuiidea f80b6d366f :memo:Rewrite the documentation of app structure. 2018-10-30 22:32:59 +08:00
zuiidea 0b360eeebb fix some style, remove svg config. 2018-10-28 22:34:24 +08:00
zuiidea c92a1e1342 remove pwa config. 2018-10-28 20:44:19 +08:00
zuiidea c0963cbcd9 change umi version. 2018-10-27 14:09:35 +08:00
Baorong Li 4979d5cbc4 Upgrade umi@2.2.x 2018-10-26 17:17:55 +08:00
zuiidea ff85c1447b Upgrade umi@2.2.0-beta.8 2018-10-25 13:34:34 +08:00
Baorong Li df608b2dc1 remove yarn.lock 2018-10-25 09:29:49 +08:00
Baorong Li f38e0ce7e2 upgrade antd@3.10.x 2018-10-25 08:47:35 +08:00
zuiidea 0499b70218 Translation user and post page. 2018-10-24 18:52:56 +08:00
zuiidea f654b277fa Remove table animation. 2018-10-23 22:08:47 +08:00
zuiidea 95eeebb09e Add configuration for sticky primary layout header. 2018-10-23 16:29:35 +08:00
zuiidea bb61d7f7dc Optimize the Request page. 2018-10-20 17:03:26 +08:00
zuiidea d821a7cf59 Add automatic translation commend. 2018-10-18 23:13:55 +08:00
zuiidea 9db8827d4a Add automatic translation scripts. 2018-10-17 23:51:39 +08:00
zuiidea 0b17931c62 Menu supports multiple languages. 2018-10-16 16:20:48 +08:00
zuiidea c1df88c25f Added notification component on the Header. 2018-10-16 14:44:35 +08:00
zuiidea f6454e71f0 Added language switching drop-down menu. 2018-10-15 15:08:48 +08:00
zuiidea 66a6e55191 Added Scrollbar. 2018-10-12 22:05:16 +08:00
zuiidea 0a3fac2e72 Added component Scrollbar, Added avatar 2018-10-11 22:50:42 +08:00
zuiidea 2f928329d1 fix style. 2018-10-10 22:06:13 +08:00
zuiidea 9a5ff4aa98 mobile device supports drawer menu. 2018-10-09 11:46:19 +08:00
Baorong Li dd3c191139 upgrade umi@2.1 2018-09-28 14:17:23 +08:00
Baorong Li 9a702fb774 try to optimize city.js 2018-09-26 18:15:47 +08:00
Baorong Li d0c2713f20 fix login with wrong path 2018-09-22 18:31:20 +08:00
Baorong Li a6bf4286dc add favicon 2018-09-22 18:29:31 +08:00
zuiidea 08f40efd2b Optimization: cancel the request of the current page when the page jumps. 2018-09-20 19:55:32 +08:00
zuiidea 4e7795ec7c Optimization and rewriting PrimaryLayout. 2018-09-18 22:04:30 +08:00
zuiidea 5aa187334a Optimize mock related files and variable names. 2018-09-17 20:54:06 +08:00
zuiidea abfcf2460e Added new logo. 2018-09-17 17:22:29 +08:00
zuiidea bcd6248833 Merge branch 'develop' of https://github.com/zuiidea/antd-admin into develop 2018-09-17 10:52:33 +08:00
zuiidea baa5869fe5 doc:Initialize 2018-09-16 23:38:17 +08:00
Baorong Li 58f62d8145 add a simple e2e test and enable pwa 2018-09-16 12:32:54 +08:00
zuiidea 2044beb7f1 fix:Menu and breadcrumbs cannot be highlighted with the path. 2018-09-15 21:34:18 +08:00
zuiidea 5f8a298ece fix:change language after switching language login. 2018-09-15 18:06:24 +08:00
zuiidea 487b39f97c Merge branch 'develop' of https://github.com/zuiidea/antd-admin into develop 2018-09-15 17:50:48 +08:00
zuiidea c5724f208a Adjust the router to automatically add the current language prefix before the pathname in push and replace.
Added `pathMatchRegexp` to match routes and regexp if the route prefix is ignored
2018-09-15 17:50:15 +08:00
Baorong Li 03a23bab9a use dva-immer 2018-09-15 17:32:26 +08:00
zuiidea d58b6ce948 Merge branch 'develop' of https://github.com/zuiidea/antd-admin into develop 2018-09-15 12:28:34 +08:00
zuiidea 7c83c80d5d Support for dynamically loading language packs.
Load the `lodash` function as needed.
Added i18n related configuration.
2018-09-15 12:26:22 +08:00
Baorong Li 0801d83856 add github icon in GlobalFooter 2018-09-15 11:02:27 +08:00
zuiidea 8aa55330b4 Support antd-design-pro,Added language switching on login page. 2018-09-14 22:35:49 +08:00
Baorong Li ee10965f43 fix first page jump to login fail 2018-09-14 11:32:28 +08:00
zuiidea 755e19ed12 Use jslingui as the i18n solution. 2018-09-13 23:52:08 +08:00
zuiidea 40d3914b3c Optimize layout configuration to make it simpler and more flexible. 2018-09-13 20:20:25 +08:00
zuiidea 47fd515944 Using the decorator syntax, Fixed user page filter data by address. 2018-09-12 19:44:34 +08:00
zuiidea ba426defdd Optimize the utils function and add JSdoc
Change the variable color to Color.
Add package loadsh.isempty.
2018-09-12 18:10:09 +08:00
zuiidea a8bd1a587a Added eslint rule 'no-conole', Fixed request page and post page,Replace utils/enums.js to utils/contant.js 2018-09-12 16:00:36 +08:00
zuiidea 237efb4e72 Optimize the way to import api, Removed some configuration in utils/config.js. 2018-09-12 14:05:20 +08:00
zuiidea 0de24b8251 Merge branch 'develop' of https://github.com/zuiidea/antd-admin into develop 2018-09-11 22:00:29 +08:00
zuiidea 7077ef15f3 Added CI for document. 2018-09-11 22:00:18 +08:00
Baorong Li b3d5d11539 try add a simple test 2018-09-11 18:09:06 +08:00
Baorong Li 2522b971f1 clean README.md 2018-09-11 17:52:44 +08:00
Baorong Li c6be37ca09 fix login page miss 2018-09-11 17:52:16 +08:00
zuiidea ae8ac62938 Added docsify and update umi config. 2018-09-11 17:28:51 +08:00
zuiidea 349eb3216d Optimize .travis.yml. 2018-09-10 22:14:35 +08:00
zuiidea d1d559b1d6 Added travis. 2018-09-10 18:01:26 +08:00
zuiidea 7d5ad95cff Optimize file 'request.js',and remove code about cross domin. 2018-09-09 23:25:12 +08:00
zuiidea e09c22fc18 Merge branch 'develop' of https://github.com/zuiidea/antd-admin into develop
# Conflicts:
#	package.json
#	src/pages/dashboard/components/cpu.js
#	src/pages/dashboard/components/user.js
#	yarn.lock
2018-09-09 14:23:00 +08:00
zuiidea a7e84edad3 Added lint-staged and husky to unify code style. 2018-09-09 14:18:22 +08:00
zuiidea 0f466b2abe Added lint-statged and husky to unify code style. 2018-09-09 14:02:46 +08:00
Baorong Li 0ccdcdbc92 upgrade dep 2018-09-09 09:06:56 +08:00
Baorong Li 3d3f8e70dd remove MoonComponent in ECharts 2018-09-09 08:57:25 +08:00
Baorong Li 417215cfcc remove useless mock 2018-09-09 08:53:06 +08:00
Baorong Li ae8aba68f2 remove iconfont component related svg 2018-09-09 08:22:06 +08:00
zuiidea cd53b36e76 Deprecated component layer、Search、DataTable、Iconfont,because there are exist similar component in antd. 2018-09-08 23:39:49 +08:00
Baorong Li a44f5795fd remove iconfont component @part 2018-09-08 18:26:42 +08:00
zuiidea 556169871a Support Stylelint.
Added Prettierrc.
Optimize the configuration file .umirc.js, and Added annotations.
Replace eslint-plugin-umi to eslint-plugin-react-app as eslint bese plugin.
And so on.
2018-09-08 17:10:57 +08:00
zuiidea 261fbb8428 Support Stylelint.
Added Prettierrc.
Optimize the configuration file .umirc.js, and Added annotations.
Replace eslint-plugin-umi to eslint-plugin-react-app as eslint bese plugin.
And so on.
2018-09-08 17:10:20 +08:00
Baorong Li f02d39ace0 Merge pull request #891 from Louis-7/bugfix/motion-switch
Bugfix/motion switch
2018-09-04 15:58:00 +08:00
Louis-7 4d32829445 fix motion switch style on Users page 2018-09-04 15:06:48 +08:00
Baorong Li 5438e04fc5 Merge pull request #888 from Louis-7/bugfix/chart-shake
Bugfix/chart shake
2018-09-03 15:38:35 +08:00
Baorong Li 54bbe4d70a 🎉🎉 upgrade umi@2.0.0 2018-09-03 15:38:03 +08:00
Louis 78ece0c9fb Merge pull request #2 from Louis-7/bugfix/chart-shake
fix move mouse into chart will cause chart shake issue.
2018-09-03 15:26:48 +08:00
Louis-7 3407f9a0c1 fix move mouse into chart will cause chart shake issue. 2018-09-03 15:24:15 +08:00
Louis f1b78e8d1f Merge pull request #1 from Louis-7/bugfix/sidebar-shake
Bugfix/sidebar shake
2018-09-03 15:15:40 +08:00
Baorong Li df2fc9c32e Merge pull request #886 from Louis-7/bugfix/sidebar-shake
Bugfix/sidebar shake
2018-09-03 15:11:15 +08:00
Louis-7 cc5c319332 remove useless rule
Signed-off-by: Louis-7 <louisgh.cn@gmail.com>
2018-09-03 14:58:56 +08:00
Louis-7 43ef09dfed Revert "restrict rule"
This reverts commit 843bd1a088.
2018-09-03 14:57:04 +08:00
Louis-7 0c95751b8d restrict rule
Signed-off-by: Louis-7 <louisgh.cn@gmail.com>
2018-09-03 14:56:06 +08:00
Louis-7 843bd1a088 restrict rule
Signed-off-by: Louis-7 <louisgh.cn@gmail.com>
2018-09-03 14:54:20 +08:00
Louis-7 a0db71e571 Revert "fix sidebar shake once mouse over it"
This reverts commit 7fc14eddd9.
2018-09-03 13:28:13 +08:00
Louis-7 7fc14eddd9 fix sidebar shake once mouse over it
Signed-off-by: Louis-7 <louisgh.cn@gmail.com>
2018-09-03 13:18:46 +08:00
Baorong Li 7f2fdc383b upgrade query-string@6 2018-08-22 15:58:12 +08:00
Baorong Li ff2caecb3a Merge pull request #877 from sorrycc/refact/migrate-to-umi-2
[WIP] refact: migrate to umi@2
2018-08-22 15:32:08 +08:00
sorrycc d01df1ef13 refact: migrate to umi@2 2018-08-22 15:12:01 +08:00
Baorong Li cd55df3a15 upgrade antd@3.8.0 2018-08-05 22:46:55 +08:00
Baorong Li ce59f3e7b2 Update README.md 2018-08-02 17:25:18 +08:00
Baorong Li 4d722f103a Update README.md 2018-08-02 17:20:02 +08:00
Baorong Li c1bc6f27b1 upgrade antd@3.7.3 2018-08-02 16:50:34 +08:00
Baorong Li ed88c087bf forgot to remove css part in dashboard/user 2018-07-21 13:15:16 +08:00
Baorong Li 4e337caa07 remove unuse png 2018-07-21 12:49:56 +08:00
Baorong Li ea3929b4c2 cut project size 2018-07-21 12:43:10 +08:00
Baorong Li 9eff4ca129 modify mock method in users delete, fix #859 2018-07-20 11:48:33 +08:00
Baorong Li d6d94e2121 upgrade antd@3.7.0 2018-07-20 11:18:42 +08:00
Baorong Li 737c0236d6 Merge pull request #844 from JChord/master
refactor:修改父ID取值逻辑
2018-06-25 12:42:14 +08:00
DosLin 69571f2916 refactor:修改父ID取值逻辑 2018-06-25 10:53:10 +08:00
Baorong Li 6dffa7378c Merge pull request #842 from JChord/master
fix:进入动态路由下的二级页面菜单栏无法选中问题
2018-06-22 17:02:08 +08:00
DosLin c2a7bc7106 fix:进入动态路由下的二级页面菜单栏无法选中问题 2018-06-22 16:50:58 +08:00
Baorong Li e752750c9e update doc, fix #839 2018-06-20 09:07:52 +08:00
Baorong Li 32bde8f69e Merge pull request #834 from codeif/master
Rename variable name  domin  to domain
2018-06-08 10:26:44 +08:00
codeif b5f9ef51f1 Rename variable name domin
to domain
2018-06-07 21:53:54 +08:00
Baorong Li 8c10be6ee6 upgrade umi@1.3.5 => fix #723 2018-06-01 15:56:37 +08:00
zuiidea c1e3872792 Fix README conflic 2018-05-25 17:37:23 +08:00
zuiidea c3eef53e4d Merge develop and update to 5.0.0-beta 2018-05-25 17:20:20 +08:00
zuiidea a1b9c0c33d Fix the files under the 'public' dicrectoy can't visit after build 2018-05-25 17:13:30 +08:00
Baorong Li c49b0edbe9 update umi@1.3.4 & antd@3.5.3 [use MOCK=none for production] 2018-05-25 13:49:13 +08:00
Baorong Li 0fd8824ad7 fix logout not work #826, #669 2018-05-25 11:52:39 +08:00
Baorong Li 973199135f update umi@1.3.3 antd@3.5.2 [no production for this commit] 2018-05-17 18:32:33 +08:00
Baorong Li 43b7b21ad3 update umi@1.3.1 [no production for this commit] 2018-05-15 22:04:42 +08:00
Baorong Li ba96ebb874 update dep 2018-05-12 14:34:00 +08:00
Baorong Li c66f086f42 fix #372 update navOpenKeys when copy link open 2018-05-05 12:11:03 +08:00
Baorong Li 07b2175e92 upgrade dep antd@3.5.0, umi@1.2.6 2018-05-05 12:05:07 +08:00
Baorong Li d245a1eabc upgrade umi@1.2.1 2018-04-24 23:00:31 +08:00
Baorong Li f1e2fd3b18 fix: alias 2018-04-24 22:51:12 +08:00
Baorong Li a6b3dba92e cut moment locale/lodash size & revert d06ee20 2018-04-13 18:19:22 +08:00
Baorong Li 9fd0abe6ea update dep 2018-04-12 15:21:03 +08:00
Baorong Li d06ee20c47 remove dep highcharts-more/highcharts-exporting 2018-04-12 12:02:59 +08:00
Baorong Li 2ef1fa0367 upgrade dep umi 2018-04-12 12:00:35 +08:00
Baorong Li 9d459106c1 Update README.md 2018-04-10 17:27:19 +08:00
Baorong Li cd5a52a8fc Merge pull request #793 from iversonwool/add_leehow
comfirmLoding
2018-04-10 09:09:40 +08:00
李浩 d89320f578 comfirmLoding 2018-04-10 08:59:16 +08:00
Baorong Li df5ce2991e improve by github.com/sorrycc/blog/issues/66 2018-03-31 15:36:26 +08:00
Baorong Li 668c9c7dfe upgrade umi@1.1.4 (support dll gzip & cache) 2018-03-30 15:25:39 +08:00
Baorong Li 9bd13055c0 5.0.0-beta coming 2018-03-29 11:26:30 +08:00
Baorong Li 9f3adda59d upgrade dependencies 2018-03-29 11:16:11 +08:00
Baorong Li bfa7aaecb8 Merge pull request #770 from umijs/refact/migrate-to-umi
Refact/migrate to umi
2018-03-29 10:17:07 +08:00
Baorong Li 9d4310d8e0 Merge branch 'develop' into refact/migrate-to-umi 2018-03-29 10:16:31 +08:00
Baorong Li b3555b01f3 Merge branch 'master' into develop 2018-03-29 10:08:50 +08:00
chencheng 74895fbb0d fix: uglifyjs problem, use query-string@5 2018-03-26 17:59:22 +08:00
chencheng 5f04d19d2d add lost dep query-string 2018-03-26 17:18:43 +08:00
chencheng 0fef06e0c6 use umi-plugin-dll to enable dll 2018-03-26 17:15:27 +08:00
chencheng 89d22451c5 fix: svg don't work 2018-03-24 18:08:16 +08:00
chencheng fb49056c73 make login work 2018-03-24 14:39:54 +08:00
chencheng a3071819c4 eslint 2018-03-24 09:07:36 +08:00
chencheng d4e10ad5c2 refact the directory structure 2018-03-23 23:31:09 +08:00
chencheng 59e9a1053e refact config files and package.json 2018-03-23 22:51:41 +08:00
Baorong Li 308fc09b33 Merge pull request #767 from iversonwool/add_leehow
refresh bug in router/user
2018-03-16 14:30:42 +08:00
李浩 99ec9facd3 refresh bug 2018-03-16 10:29:32 +08:00
Baorong Li 2a96d7a5f6 Merge pull request #749 from nazarlitvin/remove-async
remove unnecessary async functions
2018-03-10 11:43:00 +08:00
Baorong Li 195e1d17f8 Merge pull request #755 from LizPeng/patch-1
Update Echarts version
2018-03-09 14:00:03 +08:00
Baorong Li 580ff59b3d Create issue_template.md 2018-03-09 11:18:39 +08:00
Baorong Li cfa5aae5da fix #754 add set port guide 2018-03-09 10:58:54 +08:00
Baorong Li 761125735a fix #572, move cross-env to devDependencies 2018-03-08 17:53:12 +08:00
zuiidea d1b12ff0e1 Fix issue resulting User page showing wrong content when delete alll items in last page. 2018-03-01 17:45:34 +08:00
zuiidea a47176a4e5 fix user table 2018-02-27 19:17:59 +08:00
Dustin bc3d7fb39a Update Echarts version
require Echarts  ^4.0.0
2018-02-27 19:02:53 +08:00
zuiidea 458548150c fix popup position 2018-02-26 20:02:46 +08:00
zuiidea f6e11bb464 eslint fix 2018-02-26 19:35:58 +08:00
zuiidea 479fc647c3 Merge branch 'Maple-Ro-master' into develop 2018-02-26 19:19:56 +08:00
zuiidea 9a4c63390d locale example 2018-02-26 19:19:42 +08:00
zuiidea 42cd1221fa logo text fadeIn 2018-02-26 19:13:43 +08:00
zuiidea 98b773fdc3 logo text fadeIn 2018-02-26 19:13:12 +08:00
zuiidea cd54fcbf52 Merge branch 'hiooyUI-master' into develop 2018-02-26 10:58:30 +08:00
nazarlitvin bd68f8c631 remove unnecessary async functions 2018-02-19 22:16:33 +02:00
liutsing 3fde5aaa3c 1、本地化
2、解决侧边栏收起时菜单图标悬浮下无菜单文字显示的问题
2018-02-16 01:22:44 +08:00
Nelson Kuang 2f34de5602 修复左侧菜单合拢时mouseover提示空白视觉bug
当一级菜单没子菜单时,mouseover会弹出tooltips,但提示空白无内容
2018-02-07 17:25:16 +08:00
zuiidea 2de1e81661 Merge pull request #711 from zuiidea/develop
Develop
2017-12-27 15:41:00 +08:00
zuiidea cea60c5683 update Readme 2017-12-27 15:39:45 +08:00
zuiidea f16e104f73 fix all echarts example 2017-12-26 14:14:52 +08:00
zuiidea c397f552c3 fix some style 2017-12-26 11:31:05 +08:00
zuiidea 11c4ac803e fix users pagination 2017-12-25 20:39:48 +08:00
zuiidea 09b9a100de fix header style 2017-12-25 19:54:48 +08:00
zuiidea 0e59df39ee Compatibility upgrade 2017-12-25 18:08:25 +08:00
zuiidea 30254a2ec7 upgrade package 2017-12-25 10:51:36 +08:00
zuiidea cd796a6db9 fix Search style 2017-11-24 11:27:00 +08:00
zuiidea 6ba75de576 add backTop 2017-11-24 11:02:52 +08:00
zuiidea a3637b3a99 user search 2017-11-24 10:32:12 +08:00
zuiidea 85ec09ec9a Merge branch 'weishijun14-patch-1' into develop 2017-11-24 10:28:25 +08:00
zuiidea eb683b98e7 Merge branch 'patch-1' of https://github.com/weishijun14/antd-admin into weishijun14-patch-1 2017-11-24 10:28:17 +08:00
zuiidea 9221173309 Merge branch 'silentred-master' into develop 2017-11-24 10:26:15 +08:00
zuiidea 55a96f41c6 Merge branch 'master' of https://github.com/silentred/antd-admin into silentred-master 2017-11-24 10:25:42 +08:00
zuiidea ce510e79c7 Merge branch 'nazarlitvin-pagination' into develop 2017-11-24 10:24:56 +08:00
zuiidea 3d4f2a8814 Merge branch 'pagination' of https://github.com/nazarlitvin/antd-admin into nazarlitvin-pagination 2017-11-24 10:24:22 +08:00
nazarlitvin 38e24edd7b fix incorrect pagination property 2017-11-22 16:01:49 +02:00
Jason W 841c987a1a Update package.json
update package.json
2017-11-03 04:21:16 -05:00
shijun Wei dc26f7d25e update query to search
history 的 location 属性上不再包含 query。
2017-11-02 13:19:09 +08:00
zuiidea bc754e683e assets 2017-10-30 14:07:09 +08:00
zuiidea c7acc8db4b Merge pull request #649 from zuiidea/develop
Develop
2017-10-30 11:56:42 +08:00
zuiidea 057acc514f Merge branch 'smackgg-master' into develop 2017-10-30 11:52:52 +08:00
zuiidea 53ce7d08fb Merge branch 'xx1595140265-patch-1' into develop 2017-10-30 11:51:27 +08:00
zuiidea 8ffd68a4e2 Merge branch 'dkvirus-patch-1' into develop 2017-10-30 11:50:18 +08:00
zuiidea 766653ee7a merge #640 2017-10-30 11:49:27 +08:00
zuiidea 9dedcc68c3 Merge branch 'the-wang-master' into develop 2017-10-30 11:28:23 +08:00
zuiidea 5ea2b3c9b8 extend chart 2017-10-30 11:25:53 +08:00
汪亚辉 d2ac91839a 面包屑导航支持多级参数
例:
当前router为/:appkey/:packageId
父级router为/:appkey
当前pathname为/com.mock.ly/58

可以看出appkey=com.mock.ly, packageId=58
目前这种场景下,面包屑中父级连接直接展示为/:appkey,没有解析

本次commit支持根据当前多param去填充面包屑中父级页面连接
2017-10-24 18:55:06 +08:00
the-wang bfca2746d8 Merge pull request #1 from zuiidea/master
up
2017-10-24 18:54:10 +08:00
dkvirus b417065ac3 Update Menu.js
在 Slider.js 中调用 Menu 组件,并没有传入 handleClickNavMenu 属性的值,代码优化。
2017-10-12 16:27:52 +08:00
xuxue abdc97f087 Update index.js
取错值,修正
2017-10-10 04:23:34 -05:00
smackxu 07016c6c26 Fixed dark theme menu bug 2017-09-12 16:27:22 +08:00
zuiidea b8162060cd Merge pull request #581 from zuiidea/develop
Develop
2017-09-11 10:27:01 +08:00
zuiidea 36fb5d293c delete extra code 2017-09-11 10:19:43 +08:00
zuiidea 429280a97a Merge branch 'DiroKate-master' into develop 2017-09-11 10:18:37 +08:00
zuiidea 7ac36c779e merge #332 2017-09-11 10:18:20 +08:00
zuiidea d2e7b464e3 megre #563 2017-09-11 10:00:25 +08:00
zuiidea 25839ea99f Merge branch 'akliyiping-develop' into develop 2017-09-11 09:55:27 +08:00
zuiidea 9c99581aa6 Merge branch 'develop' of https://github.com/akliyiping/antd-admin into akliyiping-develop 2017-09-11 09:55:05 +08:00
zuiidea e42c21f0eb fix #574 2017-09-11 09:53:22 +08:00
zuiidea 782bf214e5 Merge branch 'dong894-master' into develop 2017-09-11 09:47:45 +08:00
zuiidea a8a4496c7a Merge branch 'master' of https://github.com/dong894/antd-admin into dong894-master 2017-09-11 09:47:29 +08:00
zuiidea f5f013ff23 Merge branch 'develop' 2017-09-11 09:35:39 +08:00
zuiidea 8cff3af897 Merge branch 'master' of https://github.com/zuiidea/antd-admin 2017-09-11 09:35:32 +08:00
zuiidea 322d5a6d0e merge #576 2017-09-11 09:35:09 +08:00
zuiidea 2ee26f51a7 Merge branch 'yangbin1994-bug575' into develop 2017-09-11 09:27:00 +08:00
zuiidea e670ed2f96 Merge branch 'bug575' of https://github.com/yangbin1994/antd-admin into yangbin1994-bug575 2017-09-11 09:26:36 +08:00
杨斌 601a03b5b4 fix bug#575 2017-09-10 02:26:27 +08:00
dongyulei 00582e70ff 修复 4.3.5 中用户画面翻页无效的问题 2017-09-10 00:02:10 +08:00
zuiidea 6d17b5b876 Merge branch 'yangbin1994-dva2.0' 2017-09-08 14:51:51 +08:00
eric 6077d74f10 .gitignore 增加排除项 2017-09-07 11:00:00 +08:00
diro 38637ef167 Example for the ”custom className iconfont” 2017-06-06 21:10:45 +08:00
diro fe8527e72e enable the custom ClassName 2017-06-06 21:08:42 +08:00
diro da64cac414 fix the wrong iconName 2017-06-06 20:45:56 +08:00
280 changed files with 7758 additions and 13137 deletions
-16
View File
@@ -1,16 +0,0 @@
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
+10 -2
View File
@@ -1,2 +1,10 @@
src/**/*-test.js
src/public
node_modules
dist
.umi
build
public
coverage
*.config.js
# ignore umi generated files under src
src/.umi
-53
View File
@@ -1,53 +0,0 @@
{
"extends": "airbnb",
"rules": {
"semi": [2, "never"],
"no-console": 0,
"comma-dangle": [2, "always-multiline"],
"max-len": 0,
"react/jsx-first-prop-new-line": 0,
"react/jsx-filename-extension": 0,
"space-before-function-paren": [2, "always"],
"no-unused-expressions": [0, {
"allowShortCircuit": true,
"allowTernary": true
}],
"arrow-body-style": [0, "never"],
"func-names": 0,
"prefer-const": 0,
"no-extend-native": 0,
"no-param-reassign": 0,
"no-restricted-syntax": 0,
"no-eval": 0,
"no-continue": 0,
"react/jsx-no-bind": 0,
"no-unused-vars": [2, { "ignoreRestSiblings": true }],
"no-underscore-dangle": 0,
"global-require": 0,
"import/no-unresolved": 0,
"import/extensions": 0,
"jsx-a11y/href-no-hash": 0,
"react/no-array-index-key": 0,
"react/require-default-props": 0,
"react/forbid-prop-types": 0,
"react/no-string-refs": 0,
"react/no-find-dom-node": 0,
"react/prefer-stateless-function": 0,
"import/no-extraneous-dependencies": 0,
"import/prefer-default-export": 0,
"react/no-danger": 0,
"jsx-a11y/no-static-element-interactions": 0,
},
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 8,
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
}
},
"settings": {
"import/resolver": "node"
}
}
+61
View File
@@ -0,0 +1,61 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: { jsx: true },
},
plugins: [
'@typescript-eslint',
'react',
'react-hooks',
'unused-imports',
'prettier',
'import',
'jsx-a11y',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:prettier/recommended',
],
settings: {
react: { version: 'detect' },
'import/resolver': {
typescript: {},
},
},
env: {
browser: true,
node: true,
es6: true,
},
rules: {
'prettier/prettier': 'error',
'react/react-in-jsx-scope': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
'@typescript-eslint/no-explicit-any': 'off',
'unused-imports/no-unused-imports': 'warn',
'no-console': [
'warn',
{
allow: ['warn', 'error', 'info'],
},
],
'import/order': 'off',
},
overrides: [
{
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
},
],
};
+76
View File
@@ -0,0 +1,76 @@
++ name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Enable corepack (pnpm)
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Cache pnpm store
uses: actions/cache@v4
with:
path: |
~/.pnpm-store
~/.cache/pnpm
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install dependencies
run: pnpm install
- name: Test (if present)
run: pnpm test --if-present
- name: Lint
run: pnpm run lint
- name: Build
run: pnpm run build
- name: Upload build (artifact)
if: success()
uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist
publish:
name: Publish to GitHub Pages
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./dist
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
+14 -4
View File
@@ -1,4 +1,14 @@
dist
node_modules
yarn.lock
npm-debug.log
/node_modules
/.env.local
/.umirc.local.ts
/config/config.local.ts
/src/.umi
/src/.umi-production
/src/.umi-test
/dist
.swc
.turbopack
pnpm-lock.yaml
yarn.lock
npm-lock.json
+2
View File
@@ -0,0 +1,2 @@
registry=https://registry.npmjs.com/
+9
View File
@@ -0,0 +1,9 @@
node_modules
dist
.umi
build
coverage
public
node_modules
.umi
.umi-production
+8
View File
@@ -0,0 +1,8 @@
{
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all",
"proseWrap": "never",
"overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }],
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson"]
}
-57
View File
@@ -1,57 +0,0 @@
const path = require('path')
const { version } = require('./package.json')
const svgSpriteDirs = [
path.resolve(__dirname, 'src/svg/'),
require.resolve('antd').replace(/index\.js$/, '')
]
export default {
entry: 'src/index.js',
svgSpriteLoaderDirs: svgSpriteDirs,
theme: "./theme.config.js",
publicPath: `/${version}/`,
outputPath: `./dist/${version}`,
// 接口代理示例
proxy: {
"/api/v1/weather": {
"target": "https://api.seniverse.com/",
"changeOrigin": true,
"pathRewrite": { "^/api/v1/weather": "/v3/weather" }
},
// "/api/v2": {
// "target": "http://192.168.0.110",
// "changeOrigin": true,
// "pathRewrite": { "^/api/v2" : "/api/v2" }
// }
},
env: {
development: {
extraBabelPlugins: [
"dva-hmr",
"transform-runtime",
[
"import", {
"libraryName": "antd",
"style": true
}
]
]
},
production: {
extraBabelPlugins: [
"transform-runtime",
[
"import", {
"libraryName": "antd",
"style": true
}
]
]
}
},
dllPlugin: {
exclude: ["babel-runtime", "roadhog", "cross-env"],
include: ["dva/router", "dva/saga", "dva/fetch"]
}
}
-5
View File
@@ -1,5 +0,0 @@
const mock = {}
require('fs').readdirSync(require('path').join(__dirname + '/src/mock')).forEach(function(file) {
Object.assign(mock, require('./src/mock/' + file))
})
module.exports = mock
+15
View File
@@ -0,0 +1,15 @@
import { defineConfig } from 'umi';
export default defineConfig({
plugins: ['@umijs/plugins/dist/antd', '@umijs/plugins/dist/locale'],
esbuildMinifyIIFE: true,
locale: {
antd: true,
default: 'zh-CN',
baseNavigator: true,
useLocalStorage: true,
baseSeparator: '-',
title: true,
},
npmClient: 'pnpm',
});
+109
View File
@@ -0,0 +1,109 @@
<p align="center">
<a href="http://github.com/zuiidea/antd-admin" target="_blank">
<img alt="antd-admin-logo" height="80" src="./public/logo.svg">
</a>
</p>
<h1 align="center">AntD Admin</h1>
<div align="center">
基于 Ant Design 6、Umi 4 与 TypeScript 构建的企业级前端解决方案。
</div>
---
## 📖 项目简介
**AntD Admin** 是一个轻量、高性能的管理后台模板,旨在为构建企业级应用提供干净、可扩展的起点。项目使用 **Ant Design 6**、**Umi 4** 与 **TypeScript** 的最新特性,减轻样板代码,提升开发体验。
无论您要构建仪表盘、管理系统,还是集成 AI 功能的工具,本项目都能提供必要的基础。
## ✨ 主要特性
- 🚀 **现代栈**:基于 **Ant Design 6** + **Umi 4** + **TypeScript**。
- 🎨 **清晰架构**:使用 `zustand` 进行轻量状态管理。
- 🛠 **良好的开发体验**:内置本地 mock 服务器(`mock/index.js`),无需后端即可开发前端功能。
- 📦 **丰富示例页面**:包含可直接使用的页面示例:
- 📊 **仪表盘**:数据可视化概览。
- 👥 **用户管理**:CRUD 操作示例。
- 🧩 **菜单管理**:动态路由配置示例。
- 🤖 **AI 聊天示例**:大模型(LLM)接口集成示例。
- ✅ **CI/CD 支持**:预配置的 GitHub Actions 工作流,用于 lint 和构建。
## 🚀 快速开始
建议使用 **pnpm** 进行包管理。
```bash
# 1. 克隆仓库
git clone https://github.com/zuiidea/antd-admin.git -b master --depth=1
cd antd-admin
# 2. 安装依赖
pnpm install
# 3. 启动本地开发(含 mock 数据)
npm run dev
# 4. 构建生产包
npm run build
# 5. 代码质量检查
npm run lint
npm run format
```
🔌 开发说明
#### Mock 服务
项目包含位于 `mock/index.js` 的内置 mock 服务,方便在没有后端的情况下独立开发前端功能。
如需关闭 mock 或切换到真实 API,请修改项目的代理配置(例如 Umi 项目可能的配置文件 `config/proxy.ts`、`.umirc.ts` 或 `config/config.ts`),以匹配您的实际项目结构。
#### 常用路由
| 路由 | 说明 |
| --- | --- |
| `/` 或 `/dashboard` | 主仪表盘 |
| `/users` | 用户列表与管理 |
| `/sys/menu` | 系统菜单配置 |
| `/ai/chat` | AI 聊天示例界面 |
#### 定制化
- **API 集成:** 在 `src/services` 中更新 API 接口以对接真实后端。
- **组件扩展:** 在 `src/components` 中复用或扩展现有组件(例如 `DropOption`、`StandardTable`)。
- **主题:** 在主题配置中自定义 Ant Design 变量以匹配品牌视觉。
#### GitHub Actions(CI)
仓库包含预配置的 GitHub Actions 工作流(见 `.github/workflows/ci.yml`),用于保证代码质量:
- 使用 `pnpm` 安装依赖。
- 运行 lint 检查。
- 构建生产包。
- **工作流位置:** `.github/workflows/ci.yml`
- **提示:** 若要在 CI 中加入自动化测试,请在 `package.json` 中添加测试脚本并更新 workflow YAML。
## 🤝 贡献
欢迎各类贡献:修复 bug、添加新示例页面或组件、完善类型定义与 lint 规则、改进国际化等。
常见贡献流程:
1. Fork 仓库。
2. 新建分支:`git checkout -b feature/AmazingFeature`。
3. 提交变更:`git commit -m 'Add some AmazingFeature'`。
4. 推送分支:`git push origin feature/AmazingFeature`。
5. 提交 Pull Request。
## 📄 许可证
本项目采用 MIT 许可证。
由 zuiidea 与贡献者共同维护,Made with ❤️。
+80 -122
View File
@@ -1,156 +1,114 @@
# Antd Admin
<p align="center">
<a href="http://github.com/zuiidea/antd-admin" target="_blank">
<img alt="antd-admin-logo" height="80" src="./public/logo.svg">
</a>
</p>
[![React](https://img.shields.io/badge/react-^15.6.1-brightgreen.svg?style=flat-square)](https://github.com/facebook/react)
[![Ant Design](https://img.shields.io/badge/ant--design-^2.11.2-yellowgreen.svg?style=flat-square)](https://github.com/ant-design/ant-design)
[![dva](https://img.shields.io/badge/dva-^2.0.1-orange.svg?style=flat-square)](https://github.com/dvajs/dva)
<h1 align="center">AntD Admin</h1>
[![GitHub issues](https://img.shields.io/github/issues/zuiidea/antd-admin.svg?style=flat-square)](https://github.com/zuiidea/antd-admin)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/zuiidea/antd-admin/pulls)
[![MIT](https://img.shields.io/dub/l/vibe-d.svg?style=flat-square)](http://opensource.org/licenses/MIT)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com)
<div align="center">
演示地址 <http://antd-admin.zuiidea.com>
An excellent enterprise-grade front-end solution built with Ant Design 6, Umi 4, and TypeScript.
## 特性
[![antd](https://img.shields.io/badge/AntD-^6.0.0-1890ff?style=flat-square&logo=ant-design)](https://github.com/ant-design/ant-design)
[![umi](https://img.shields.io/badge/Umi-^4.0.0-ff9900?style=flat-square&logo=umijs)](https://github.com/umijs/umi)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178c6?style=flat-square&logo=typescript)](https://www.typescriptlang.org/)
[![GitHub issues](https://img.shields.io/github/issues/zuiidea/antd-admin?style=flat-square)](https://github.com/zuiidea/antd-admin/issues)
[![GitHub stars](https://img.shields.io/github/stars/zuiidea/antd-admin?style=flat-square)](https://github.com/zuiidea/antd-admin/stargazers)
[![License](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](http://opensource.org/licenses/MIT)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?style=flat-square)](https://github.com/zuiidea/antd-admin/pulls)
- 基于[react](https://github.com/facebook/react),[ant-design](https://github.com/ant-design/ant-design),[dva](https://github.com/dvajs/dva),[Mock](https://github.com/nuysoft/Mock) 企业级后台管理系统最佳实践。
- 基于Antd UI 设计语言,提供后台管理系统常见使用场景。
- 基于[dva](https://github.com/dvajs/dva)动态加载 Model 和路由,按需加载。
- 使用[roadhog](https://github.com/sorrycc/roadhog)本地调试和构建,其中Mock功能实现脱离后端独立开发。
- 浅度响应式设计。
</div>
## 更新日志
---
## 📖 Introduction
### 4.3.5
**AntD Admin** is a lightweight, high-performance admin template designed to provide a clean and extensible starting point for building enterprise applications. It leverages the latest features of **Ant Design 6**, **Umi 4**, and **TypeScript**, offering a modern development experience with minimal boilerplate.
`2017-09-04`
Whether you are building a dashboard, a management system, or an AI-powered tool, this project provides the essential foundation you need.
-   更新[dva](https://github.com/dvajs/dva)至`2.0.1`,感谢[@yangbin1994](https://github.com/yangbin1994)的[PR](https://github.com/zuiidea/antd-admin/pull/567)。
## ✨ Key Features
### 4.3.4
- 🚀 **Modern Stack**: Built on **Ant Design 6** + **Umi 4** + **TypeScript**.
- 🎨 **Clean Architecture**: Lightweight state management using `zustand`.
- 🛠 **Dev Experience**: Integrated local mock server (`mock/index.js`) for seamless frontend development without backend dependency.
- 📦 **Rich Examples**: Includes ready-to-use pages:
- 📊 **Dashboard**: Data visualization overview.
- 👥 **User Management**: CRUD operations example.
- 🧩 **Menu Management**: Dynamic routing configuration.
- 🤖 **AI Chat Demo**: Integration example for LLM interfaces.
- ✅ **CI/CD Ready**: Pre-configured GitHub Actions for linting and building.
`2017-09-04`
## 🚀 Quick Start
-   更新[roadhog](https://github.com/sorrycc/roadhog)至`1.2.1`,修复闪屏问题。
-   修复build css未压缩[#529](https://github.com/zuiidea/antd-admin/issues/529),classname未Hash[#477](https://github.com/zuiidea/antd-admin/issues/477)。
-   更新登录成功使用router跳转[#479](https://github.com/zuiidea/antd-admin/issues/479)。
### 4.3.0
`2017-07-30`
-   更新[roadhog](https://github.com/sorrycc/roadhog)至`1.0.0-beta.7`,得益于`webpack@3.4`,编译速度不减。
-   基于使用roadhog的dll插件,开发时编译耗时减半。
-   新增打包时按项目版本号生成文件目录。[#449](https://github.com/zuiidea/antd-admin/issues/449)
-   更新`eslint`,并适当修改了`.eslintrc`。
[More Change Log](https://github.com/zuiidea/antd-admin/wiki/Change-Log)
## 开发构建
### 目录结构
We recommend using **pnpm** for package management.
```bash
├── /dist/ # 项目输出目录
├── /src/ # 项目源码目录
│ ├── /public/ # 公共文件,编译时copy至dist目录
│ ├── /components/ # UI组件及UI相关方法
│ │ ├── skin.less # 全局样式
│ │ └── vars.less # 全局样式变量
│ ├── /routes/ # 路由组件
│ │ └── app.js # 路由入口
│ ├── /models/ # 数据模型
│ ├── /services/ # 数据接口
│ ├── /themes/ # 项目样式
│ ├── /mock/ # 数据mock
│ ├── /utils/ # 工具函数
│ │ ├── config.js # 项目常规配置
│ │ ├── menu.js # 菜单及面包屑配置
│ │ ├── config.js # 项目常规配置
│ │ ├── request.js # 异步请求函数
│ │ └── theme.js # 项目需要在js中使用到样式变量
│ ├── route.js # 路由配置
│ ├── index.js # 入口文件
│ └── index.html
├── package.json # 项目信息
├── .eslintrc # Eslint配置
└── .roadhogrc.js # roadhog配置
```
# 1. Clone the repository
git clone https://github.com/zuiidea/antd-admin.git -b master --depth=1
cd antd-admin
文件夹命名说明:
# 2. Install dependencies
pnpm install
- components:组件(方法)为单位以文件夹保存,文件夹名组件首字母大写(如`DataTable`),方法首字母小写(如`layer`),文件夹内主文件与文件夹同名,多文件以`index.js`导出对象(如`./src/components/Layout`)。
- routes:页面为单位以文件夹保存,文件夹名首字母小写(特殊除外,如`UIElement`),文件夹内主文件以`index.js`导出,多文件时可建立`components`文件夹(如`./src/routes/dashboard`),如果有子路由,依次按照路由层次建立文件夹(如`./src/routes/UIElement`)。
### 快速开始
克隆项目文件:
```bash
git clone https://github.com/zuiidea/antd-admin.git
```
进入目录安装依赖:
```bash
#开始前请确保没有安装roadhog、webpack到NPM全局目录
npm i 或者 yarn install
```
开发:
```bash
npm run build:dll #第一次npm run dev时需运行此命令,使开发时编译更快
# 3. Start local development server (with mock data)
npm run dev
打开 http://localhost:8000
```
构建:
[详情](https://github.com/zuiidea/antd-admin/issues/269)
```bash
# 4. Build for production
npm run build
将会打包至dist/{version}目录 #package.json里version字段
npm run build:new
将会打包至dist/{version增加1}目录 #package.json里version字段
```
代码检测:
```bash
# 5. Code quality checks
npm run lint
npm run format
```
## FAQ
🔌 **Development Notes**
- 项目打包后如何部署? [#269](https://github.com/zuiidea/antd-admin/issues/269)
- 如何做权限管理? [#384](https://github.com/zuiidea/antd-admin/issues/384)
- 如何使用mock.js模拟接口,怎么使用线上接口? [#348](https://github.com/zuiidea/antd-admin/issues/348)
- 如何使用Iconfont,如何使用本地的svg图标? [#270](https://github.com/zuiidea/antd-admin/issues/270)
- 怎么按版本打包,上线时不影响正在访问的用户? [#449](https://github.com/zuiidea/antd-admin/issues/449)
- windows处理CRLF?[参考](http://blog.csdn.net/lysc_forever/article/details/42835203)
#### Mock Server
```bash
git config --global core.autocrlf false
```
The project includes a built-in mock server defined in `mock/index.js`. This allows you to develop frontend features independently of the backend.
## 参考
To disable mocks or switch to a real API, modify the proxy settings in your configuration file (for example, `config/proxy.ts` or `.umirc.ts`).
用户列表:<https://github.com/dvajs/dva/tree/master/examples/user-dashboard>
#### Common Routes
dashboard设计稿:<https://dribbble.com/shots/3108122-Dashboard-Admin> (已征得作者同意)
| Route | Description |
| --- | --- |
| `/` or `/dashboard` | Main Dashboard |
| `/users` | User List & Management |
| `/sys/menu` | System Menu Configuration |
| `/ai/chat` | AI Chat Interface Demo |
## 截屏
#### Customization
web
- **API Integration:** Update API endpoints in `src/services` to connect to your real backend.
- **Component Extension:** Reuse or extend existing components in `src/components` (for example, `DropOption`, `StandardTable`).
- **Theme:** Customize Ant Design tokens in the theme configuration to match your brand identity.
![](assets/4.2.1-demo-1.gif)
#### GitHub Actions CI
移动
This repository includes a pre-configured GitHub Actions workflow to ensure code quality:
![](assets/4.2.1-demo-2.gif)
- Installs dependencies using `pnpm`.
- Runs linting checks.
- Builds the project for production.
- **Workflow location:** `.github/workflows/ci.yml`
- **Tip:** To add automated tests to the CI pipeline, add a test script to `package.json` and update the workflow YAML accordingly.
🤝 Contributing
Contributions are always welcome! Whether it's fixing a bug, adding a new feature, or improving documentation, please feel free to submit an Issue or a Pull Request.
Typical contributions include:
🐛 Bug fixes
🧩 New example pages or components
📝 Type definitions and linting improvements
🌍 Internationalization (i18n) updates
How to contribute:
Fork the repository.
Create your feature branch (git checkout -b feature/AmazingFeature).
Commit your changes (git commit -m 'Add some AmazingFeature').
Push to the branch (git push origin feature/AmazingFeature).
Open a Pull Request.
📄 License
This project is licensed under the MIT License.
Made with ❤️ by zuiidea and contributors.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 KiB

-35
View File
@@ -1,35 +0,0 @@
### 开发环境
- OS:Windows
- 编辑器:Atom
- cmd:Cmder
### Atom 插件
- [atom-beautify](https://atom.io/packages/atom-beautify)
#### Less
- [x] Beautify On Save
#### Javascript
- [ ] Disable Beautifying Language
#### Markdown
- [x] Beautify On Save
- [x] Default Beautifier:Remark
#### HTML
- [x] Beautify On Save
- [linter](https://atom.io/packages/linter)
- [ ] Lint on Change
- [linter-eslint](https://atom.io/packages/linter-eslint)
- [x] Fix errors on save
### Cmder 主题
- [Panda-Theme-Cmder](https://github.com/HamidFaraji/Panda-Theme-Cmder)
+36
View File
@@ -0,0 +1,36 @@
# API configuration
This project uses explicit per-feature service modules (TypeScript) under `src/services/` that call a shared HTTP helper `src/utils/request.ts` (exported as the default `api` function).
Why this pattern?
- Clear function boundaries per domain (users, admin, menu, dashboard).
- Type-safe signatures in TypeScript for inputs/outputs (`src/types`).
- Centralized request handling (query params, JSON body, auth header, unified response format) in `src/utils/request.ts`.
Example service (from `src/services/user.ts`):
```ts
import type { PagedResponse, User } from '@/types/user';
import api from '../utils/request';
export async function listUsers(
params?: Record<string, string | number | boolean>,
): Promise<PagedResponse<User>> {
return api<PagedResponse<User>>('/users', { method: 'GET', params });
}
export async function createUser(values: Record<string, unknown>): Promise<User> {
return api('/user', { method: 'POST', body: values });
}
```
Usage:
- Import named functions from the service module: `import { listUsers } from '@/services/user'`.
- The helper `api(path, options)` returns the parsed `data` payload from responses that follow the `{ success, message, data }` convention.
Notes about `src/utils/request.ts`:
- Combines `config.apiPrefix` with the provided `path`.
- Supports `params` (query), `body` (JSON or FormData), and sets `Authorization` header from local storage when available.
- Throws errors and shows UI messages for non-success responses.
If you are migrating older code that used an API mapping, prefer creating small service modules with clear function names and types as shown above.
+57
View File
@@ -0,0 +1,57 @@
<p align="center">
<a href="http://github.com/zuiidea/antd-admin">
<img alt="antd-admin" height="64" src="./_media/logo.svg">
</a>
</p>
<h1 align="center">AntD Admin</h1>
<div align="center">
An enterprise-grade front-end starter built with Ant Design 6, Umi 4 and TypeScript.
[![antd](https://img.shields.io/badge/AntD-^6.0.0-1890ff?style=flat-square&logo=ant-design)](https://github.com/ant-design/ant-design)
[![umi](https://img.shields.io/badge/Umi-^4.0.0-ff9900?style=flat-square&logo=umijs)](https://github.com/umijs/umi)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-3178c6?style=flat-square&logo=typescript)](https://www.typescriptlang.org/)
[![License](https://img.shields.io/badge/License-MIT-blue?style=flat-square)](http://opensource.org/licenses/MIT)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?style=flat-square)](https://github.com/zuiidea/antd-admin/pulls)
</div>
- Documentation source for this project is under `docs/`.
## Quick start
This repository uses `pnpm` in examples and CI; `npm` or `yarn` also work but `pnpm` is recommended.
```bash
# clone
git clone https://github.com/zuiidea/antd-admin.git
cd antd-admin
# install
pnpm install
# start dev server (includes local mock server)
npm run dev
# build
npm run build
# lint & format
npm run lint
npm run format
```
Notes:
- Mock data live in `mock/index.js` and the project can run without a backend during development.
- CI workflow is available at `.github/workflows/ci.yml` (uses pnpm, lint, build).
- Update API endpoints under `src/services` to integrate a real backend.
For detailed documentation see the other pages in this `docs/` folder.
## Contributing
Contributions welcome — file issues or open a PR as usual on GitHub.
Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

+24
View File
@@ -0,0 +1,24 @@
<svg width="169px" height="141px" viewBox="0 0 169 141" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 51.3 (57544) - http://www.bohemiancoding.com/sketch -->
<desc>Created with Sketch.</desc>
<defs>
<linearGradient x1="54.0428975%" y1="4.39752391%" x2="54.0428975%" y2="108.456714%" id="linearGradient-1">
<stop stop-color="#29CDFF" offset="0%"></stop>
<stop stop-color="#148EFF" offset="62.3089445%"></stop>
<stop stop-color="#0A60FF" offset="100%"></stop>
</linearGradient>
<linearGradient x1="50%" y1="14.2201464%" x2="50%" y2="113.263844%" id="linearGradient-2">
<stop stop-color="#FA816E" offset="0%"></stop>
<stop stop-color="#F74A5C" offset="65.9092442%"></stop>
<stop stop-color="#F51D2C" offset="100%"></stop>
</linearGradient>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group" transform="translate(0.000000, -5.000000)">
<rect id="Rectangle" fill="url(#linearGradient-1)" transform="translate(83.718923, 75.312358) rotate(-24.000000) translate(-83.718923, -75.312358) " x="68.7189234" y="0.312357954" width="30" height="150" rx="15"></rect>
<rect id="Rectangle" fill="url(#linearGradient-1)" transform="translate(129.009910, 75.580213) rotate(-24.000000) translate(-129.009910, -75.580213) " x="114.00991" y="0.580212739" width="30" height="150" rx="15"></rect>
<circle id="Oval" fill="url(#linearGradient-2)" cx="25" cy="120" r="25"></circle>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 194 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 118 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 199 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 124 KiB

+12
View File
@@ -0,0 +1,12 @@
- Getting started
- [Quick Start](getting-started.md)
- Customization
- [Configuration](configuration.md)
- [API Configuration](API-configuration.md)
- [I18n](i18n.md)
- [Layout](layout.md)
- [Request](request.md)
- Guide
- [Deploy](deploy.md)
- [Change Log](change-log.md)
- [FAQ](faq.md)
+26
View File
@@ -0,0 +1,26 @@
## 6.0.0
This project was modernized and migrated to a modern front-end stack. Key highlights of the current version:
### Modern stack
- Upgraded to Ant Design 6, Umi 4 and TypeScript 5.
- React has been updated to the current major line used in the repo (see `package.json`).
### Architecture & DX
- Services are implemented as TypeScript modules under `src/services/` and use a centralized HTTP helper `src/utils/request.ts`.
- Lightweight local state management using `zustand` replacing older `dva` patterns.
- Local mock server using `mock/index.js` with `mockjs` for frontend development without backend dependency.
### Tooling & CI
- Dev workflows use `pnpm` by default; scripts are defined in `package.json` (e.g. `pnpm run dev`, `pnpm run build`).
- Tests use `jest` and related tooling; CI is implemented with GitHub Actions (`.github/workflows/ci.yml`) which installs via `pnpm`, lints and builds the project.
### Quality and types
- TypeScript types are added/expanded under `src/types/` for safer APIs and components.
- Prettier / ESLint configuration added to enforce code style.
### Other
- Documentation is maintained under `docs/` (this site) and updated to reflect the new stack and commands.
- Removed old custom components that duplicate Ant Design functionality and simplified the codebase accordingly.
If you want a more detailed, commit-level changelog for each migration step, I can generate one from git history or help draft a migration guide.
+33
View File
@@ -0,0 +1,33 @@
# Configuration
You can do some custom configuration in `/src/utils/config.js`:
## siteName
- Type `String`
Configure the site name, apply it to the login box, and display the title text at the top of the sidebar.
## copyright
- Type: `String`
Configure the copyright notice to apply to the login page, at the bottom of the `Primary` layout.
## logoPath
- Type: `String`
Configure the site logo to apply to the login box and the Logo display at the top of the sidebar.
## apiPrefix
- Type: `String`
Configure the prefix of the interface in the project. The interface related documents can be viewed [API configuration](API-configuration.md)
## fixedHeader
- Type: `String`
Under the `Primary` layout, whether the top of the page is fixed when scrolling。
+113
View File
@@ -0,0 +1,113 @@
# Deploy
After the development is completed and verified in the development environment, it needs to be deployed to our users.
![i18n](./_media/term_build.svg)
## Build
First execute the following command,
```bash
npm run build
```
After a few seconds, the output should look like this:
```bash
> antd-admin@5.0.0-beta build /Users/zuiidea/web/antd-admin
> umi build
[21:13:17] webpack compiled in 43s 868ms
DONE Compiled successfully in 43877ms 21:13:17
File sizes after gzip:
1.3 MB dist/vendors.async.js
308.21 KB dist/umi.js
45.49 KB dist/vendors.chunk.css
36.08 KB dist/p__chart__highCharts__index.async.js
33.53 KB dist/p__user__index.async.js
22.36 KB dist/p__chart__ECharts__index.async.js
4.21 KB dist/p__dashboard__index.async.js
4.06 KB dist/umi.css
...
```
The `build` command will package all resources, including JavaScript, CSS, web fonts, images, html, and more. You can find these files in the `dist/` directory.
> If you have requirements for using HashHistory , deploying html to non-root directories, statics, etc., check out [Umi Deployment] (https://umijs.org/en/guide/deploy.html).
## Local verification
Local verification can be done via `serve` before publishing.
```
$ yarn global add serve
$ serve ./dist
Serving!
- Local: http://localhost:5000
- On Your Network: http://{Your IP}:5000
Copied local address to clipboard!
```
Access [http://localhost:5000](http://localhost:5000), under normal circumstances, it should be consistent with `npm start` (The API may not get the correct data).
## Deploy
Next, we can upload the static file to the server. If you use Nginx as the Web server, you can configure it in `ngnix.conf`:
```
server
{
listen 80;
# Specify an accessible domain name
server_name antd-admin.zuiidea.com;
# The directory where the compiled files are stored
root /home/www/antd-admin/dist;
# Proxy server interface to avoid cross-domain
location /api {
proxy_pass http://localhost:7000/api;
}
Because the front end uses BrowserHistory, it will route backback to index.html
location / {
index index.html;
try_files $uri $uri/ /index.html;
}
}
```
Restart the web server and access [http://antd-admin.zuiidea.com](http://antd-admin.zuiidea.com) , You will see the correct page.
```bash
nginx -s reload
```
Similarly, if you use Caddy as a web server, you can do this in `Caddyfile`:
```
antd-admin.zuiidea.com {
gzip
root /home/www/antd-admin/dist
proxy /api http://localhost:7000
rewrite {
if {path} not_match ^/api
to {path} {path}/ /
}
}
antd-admin.zuiidea.com/public {
gzip
root /home/www/antd-admin/dist/static/public
}
```
+9
View File
@@ -0,0 +1,9 @@
# FAQ
Most asked
## create new page
1. just copy a page in /src/pages (route here auto generated by [umi](https://umijs.org/guide/router.html#basic-routing))
2. modify namespace/pathToRegexp in model.js
3. modify mock route.js to add a route
+75
View File
@@ -0,0 +1,75 @@
# Quick Start
> Before delving into Ant Design React, a good knowledge base of [React](http://facebook.github.io/react/) 、 [ES2015+](http://es6.ruanyifeng.com/) 、 [Antd Design](https://ant.design/docs/react/introduce-cn). Learn about [UmiJS](https://umijs.org/). Ensure you have [Node.js](https://nodejs.org/) (v18+ recommended) and [Git](https://git-scm.com/) installed.
## Installation
```bash
git clone https://github.com/zuiidea/antd-admin.git my-project
cd my-project
```
## Scaffolding
The project layout is as follows:
```bash
├── dist/ # Default build output directory
├── mock/ # Mock files
├── public/ # Static resource
├── src/ # Source code
│ ├── components/ # Components
│ ├── e2e/ # Integrated Test Case
│ ├── layouts/ # Common Layouts
│ ├── locales/ # i18n resources
│ ├── models/ # Global dva Model
│ ├── pages/ # Sub-pages and templates
│ ├── services/ # Backend Services
│ │ ├── api.js # API configuration
│ │ └── index.js # API export
│ ├── themes/ # Themes
│ │ ├── default.less # Less variable
│ │ ├── index.less # Global style
│ │ ├── mixin.less # Less mixin
│ │ └── vars.less # Less variable and mixin
│ ├── utils/ # Utility
│ │ ├── config.js # Application configuration
│ │ ├── constant.js # Static constant
│ │ ├── index.js # Utility methods
│ │ ├── request.js # Request function(axios)
│ │ └── theme.js # Style variables used in js
├── .editorconfig
├── .env
├── .eslintrc
├── .gitignore
├── .prettierignore
├── .prettierrc
├── .stylelintrc.json
├── .travis.yml
└── .umirc.js
└── package.json
```
## Development
1. Install dependencies (recommended: `pnpm`).
```bash
pnpm install
```
Or with other package managers:
```bash
npm install
# or
yarn install
```
2. Start local development server.
```bash
npm run dev
```
3. After startup, open the app in a browser (see dev server output for the actual URL/port).
+121
View File
@@ -0,0 +1,121 @@
# Internationalization (i18n) Guide
This project uses Umi's `plugin-locale` (based on `react-intl`) to manage localization. Translation resources live in `src/locales` (for example `en-US.json`, `zh-CN.json`). Below are instructions for: adding a language, adding a translation entry, switching languages, and disabling i18n. Examples use Japanese `ja-JP`.
## 1. Add a new language (persistent)
1. Create a new translation file under `src/locales/` with the language id as the file name, for example: `src/locales/ja-JP.json`.
2. The file should contain a JSON object of translation keys and values (nesting allowed):
```json
{
"welcome": "ようこそ",
"login": {
"username": "ユーザー名",
"password": "パスワード",
"submit": "ログイン"
}
}
```
3. If you want Ant Design components to use the same locale (dates, component text), add the AntD locale import and mapping in `src/app.tsx`'s `pick` function, e.g.:
```ts
import jaJP from 'antd/locale/ja_JP';
// ...
if (l === 'ja-JP') return jaJP;
```
4. Add the language to the language selector (for example in `src/components/TopbarControls.tsx`):
```ts
{ key: 'ja-JP', label: '日本語' }
```
5. Restart the dev server:
```bash
pnpm run dev
```
Umi collects files in `src/locales` into `localeInfo` at build/dev time so the new language becomes available. If you prefer not to restart, see the runtime registration option below.
## 2. Add a translation entry
1. Add the same key to each language JSON (keep `en-US.json` and `zh-CN.json` up to date alongside the new language):
`src/locales/en-US.json`
```json
"my.feature.greeting": "Hello from feature"
```
`src/locales/zh-CN.json`
```json
"my.feature.greeting": "来自功能的问候"
```
2. In a component use `useIntl()` and `formatMessage`:
```ts
import { useIntl } from 'umi';
const intl = useIntl();
const text = intl.formatMessage({ id: 'my.feature.greeting', defaultMessage: 'Hello' });
```
Use `useIntl()` (or `injectIntl`) so the component updates automatically when the locale changes.
## 3. Runtime switching and registering
- Switch locale (writes `umi_locale` to localStorage and either reloads or triggers an update):
```ts
import { setLocale } from 'umi';
// switch and reload
setLocale('ja-JP', true);
// switch without reload (emit update event)
setLocale('zh-CN', false);
```
- Register a locale at runtime (no server restart required):
```ts
import { addLocale, setLocale } from 'umi';
import jaMessages from '@/locales/ja-JP.json';
import jaAntd from 'antd/locale/ja_JP';
addLocale('ja-JP', jaMessages, { antd: jaAntd, momentLocale: 'ja' });
setLocale('ja-JP', false);
```
`addLocale` merges messages into the internal `localeInfo`. You can pass extra data (like AntD locale and moment locale) so components using AntD/moment behave correctly.
## 4. Disable i18n (turn off multi-language)
To permanently disable multi-language support:
1. In `src/app.tsx`'s `LocaleWrapper`, return a fixed AntD locale (ignore `localStorage` `umi_locale`):
```ts
const pick = (l: string | null) => {
return zhCN; // force Chinese
};
```
2. Remove or hide the language switcher (for example, remove language menu items in `src/components/TopbarControls.tsx`).
3. Optionally remove other JSON files in `src/locales` except the single target language to reduce build size.
If you only want to temporarily prevent user switching, hide the switcher (step 2) and keep files intact for easy re-enable.
## 5. Debugging & common issues
- New language not appearing: restart dev server or use `addLocale`; ensure AntD locale mapping exists in `app.tsx`.
- Missing translations: check all `src/locales/*.json` contain the key, and the `formatMessage` id is correct.
- Want automated extraction of message ids: this repo does not include extraction scripts; consider integrating `lingui`, `babel-plugin-react-intl`, or other tooling and adding scripts to `package.json`.
If you want, I can:
- create an initial `src/locales/ja-JP.json` and update `TopbarControls`/`app.tsx` mappings; or
- add a small example component that demonstrates runtime registration using `addLocale`. Tell me which one you prefer.
+55
View File
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>antd-admin - An admin dashboard application demo built upon Ant Design and UmiJS</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="An admin dashboard application demo built upon Ant Design and UmiJS">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<link rel="icon" href="/_media/favicon.ico" />
</head>
<body>
<nav data-cloak class="app-nav">
<a href="/">En</a>
<a href="#/zh-cn/">中文</a>
</nav>
<div id="app">Loading...</div>
<script>
window.$docsify = {
name: 'AntD Admin',
loadSidebar: true,
maxLevel: 3,
subMaxLevel: 3,
auto2top: true,
autoHeader: true,
repo: 'zuiidea/antd-admin',
themeColor: '#1890ff',
search: {
paths: 'auto',
placeholder: {
'/zh-cn/': '搜索',
'/': 'Type to search'
},
noData: {
'/zh-cn/': '找不到结果',
'/': 'No Results'
}
}
}
// if (typeof navigator.serviceWorker !== 'undefined') {
// navigator.serviceWorker.register('sw.js')
// }
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/zoom-image.min.js"></script>
<script src="//unpkg.com/docsify-copy-code"></script>
</body>
</html>
+60
View File
@@ -0,0 +1,60 @@
# Layout
## Add a new layout
Take a new layout named `secondary` as an example to make the route starting with `secondary` use this layout.
1. Add related configuration in `src/utils/config.js`. For details, please refer to [layouts](/configuration?id=layouts).
```javascript
   layouts: [
           {
               name: 'primary',
               include: [/.*/],
               exclude: [/(\/(en|zh))*\/login/, /(\/(en|zh))*\/secondary\/(.*)/],
           },
           {
               name: 'secondary',
               include: [/(\/(en|zh))*\/secondary\/(.*)/],
           },
   ],
```
2. Add the `secondary` layout component to the `src/layouts/BaseLayout.js` file.
```javascript
   import SecondaryLayout from './SecondaryLayout'
   const LayoutMap = {
     primary: PrimaryLayout,
     public: PublicLayout,
     secondary: SecondaryLayout,
   }
```
3. Add the `SecondaryLayout.js` file to the `src/layouts/` directory.
```javascript
   import React from 'react'
   export default ({ children }) => {
     return (
       <div>
         <h1>Secondary</h1>
         {children}
       </div>
     )
   }
```
4. Add a `secondary/index.js` file to the `src/pages/` directory.
```javascript
   import React from 'react'
   export default ({ children }) => {
     Return <div>Secondary page Content</div>
   }
```
5. Finally, start the development mode with `npm run dev`, then open the layout page in your browser (see dev server output for the actual URL), e.g. `/secondary/`.
+33
View File
@@ -0,0 +1,33 @@
# HTTP requests
This project uses a small fetch-based HTTP helper implemented at `src/utils/request.ts` (export default `api`). The helper centralizes:
- Prefixing paths with `config.apiPrefix`.
- Handling `params` (query string) and `body` (JSON or FormData).
- Injecting an `Authorization` header from local storage when available.
- Unified response parsing and error handling (expects backend responses in the form `{ success, message, data }`).
Key behaviors
- `api(path, options)` merges `config.apiPrefix` + `path` to build the URL.
- If `options.params` is provided it's serialized and appended as query string.
- `options.body` handling:
- FormData is sent as-is (do not set Content-Type manually).
- Strings and Blobs are sent directly.
- Plain objects are JSON.stringified and Content-Type defaults to `application/json`.
- If a token exists in local storage (key `app-auth-token`), the helper injects an `Authorization: Bearer <token>` header unless one is already provided.
- Responses are expected to be JSON with `{ success: boolean, message?: string, data: T }`. Non-success responses throw an Error and show a UI message (uses `antd`'s `message`).
Usage (TypeScript-friendly):
```ts
import api from '@/utils/request';
// GET with query params
const page = await api('/users', { method: 'GET', params: { page: 1, pageSize: 10 } });
// POST with JSON body
const created = await api('/user', { method: 'POST', body: { name: 'Alice' } });
```
The helper returns the `data` field from successful responses. Check `src/utils/request.ts` for exact typings and behavior.
+83
View File
@@ -0,0 +1,83 @@
/* ===========================================================
* docsify sw.js
* ===========================================================
* Copyright 2016 @huxpro
* Licensed under Apache 2.0
* Register service worker.
* ========================================================== */
const RUNTIME = 'docsify'
const HOSTNAME_WHITELIST = [
self.location.hostname,
'fonts.gstatic.com',
'fonts.googleapis.com',
'unpkg.com'
]
// The Util Function to hack URLs of intercepted requests
const getFixedUrl = (req) => {
var now = Date.now()
var url = new URL(req.url)
// 1. fixed http URL
// Just keep syncing with location.protocol
// fetch(httpURL) belongs to active mixed content.
// And fetch(httpRequest) is not supported yet.
url.protocol = self.location.protocol
// 2. add query for caching-busting.
// Github Pages served with Cache-Control: max-age=600
// max-age on mutable content is error-prone, with SW life of bugs can even extend.
// Until cache mode of Fetch API landed, we have to workaround cache-busting with query string.
// Cache-Control-Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=453190
if (url.hostname === self.location.hostname) {
url.search += (url.search ? '&' : '?') + 'cache-bust=' + now
}
return url.href
}
/**
* @Lifecycle Activate
* New one activated when old isnt being used.
*
* waitUntil(): activating ====> activated
*/
self.addEventListener('activate', event => {
event.waitUntil(self.clients.claim())
})
/**
* @Functional Fetch
* All network requests are being intercepted here.
*
* void respondWith(Promise<Response> r)
*/
self.addEventListener('fetch', event => {
// Skip some of cross-origin requests, like those for Google Analytics.
if (HOSTNAME_WHITELIST.indexOf(new URL(event.request.url).hostname) > -1) {
// Stale-while-revalidate
// similar to HTTP's stale-while-revalidate: https://www.mnot.net/blog/2007/12/12/stale
// Upgrade from Jake's to Surma's: https://gist.github.com/surma/eb441223daaedf880801ad80006389f1
const cached = caches.match(event.request)
const fixedUrl = getFixedUrl(event.request)
const fetched = fetch(fixedUrl, { cache: 'no-store' })
const fetchedCopy = fetched.then(resp => resp.clone())
// Call respondWith() with whatever we get first.
// If the fetch fails (e.g disconnected), wait for the cache.
// If there’s nothing in cache, wait for the fetch.
// If neither yields a response, return offline pages.
event.respondWith(
Promise.race([fetched.catch(_ => cached), cached])
.then(resp => resp || fetched)
.catch(_ => { /* eat any errors */ })
)
// Update the cache with the version we fetched (only for ok status)
event.waitUntil(
Promise.all([fetchedCopy, caches.open(RUNTIME)])
.then(([response, cache]) => response.ok && cache.put(event.request, response))
.catch(_ => { /* eat any errors */ })
)
}
})
+35
View File
@@ -0,0 +1,35 @@
# 接口配置
本项目使用基于 TypeScript 的按功能分割服务模块,位于 `src/services/`,所有服务通过共享的 HTTP 封装 `src/utils/request.ts`(默认导出为 `api` 函数)发起请求。
为什么采用此模式?
- 每个领域(user/admin/menu/dashboard)有独立函数,职责清晰。
- 使用 TypeScript 提供输入/输出类型定义,便于维护(参见 `src/types`)。
- 请求处理集中化(查询参数、JSON body、鉴权 header、统一响应格式等)在 `src/utils/request.ts`。
示例(来自 `src/services/user.ts`):
```ts
import type { PagedResponse, User } from '@/types/user';
import api from '../utils/request';
export async function listUsers(
params?: Record<string, string | number | boolean>,
): Promise<PagedResponse<User>> {
return api<PagedResponse<User>>('/users', { method: 'GET', params });
}
export async function createUser(values: Record<string, unknown>): Promise<User> {
return api('/user', { method: 'POST', body: values });
}
```
使用方式:
- 通过 `import { listUsers } from '@/services/user'` 导入命名函数。
- `api(path, options)` 返回后端约定格式 `{ success, message, data }` 中的 `data` 字段。
关于 `src/utils/request.ts`:
- 会将 `config.apiPrefix` 与 `path` 拼接;支持 `params`(查询)、`body`(JSON 或 FormData);若存在本地 token 则自动注入 `Authorization`。
- 对非成功响应会抛出异常并在界面上显示消息(使用 `antd` 的 `message`)。
如果你在迁移旧的 API 映射实现,建议按当前结构将功能拆分为小型服务模块并补充类型定义。
+53
View File
@@ -0,0 +1,53 @@
<p align="center">
<a href="http://github.com/zuiidea/antd-admin">
<img alt="antd-admin" height="64" src="../_media/logo.svg">
</a>
</p>
<h1 align="center">AntD Admin</h1>
<div align="center">
基于 Ant Design 6、Umi 4 与 TypeScript 的企业级前端起手模版。
[![antd](https://img.shields.io/badge/AntD-^6.0.0-1890ff?style=flat-square&logo=ant-design)](https://github.com/ant-design/ant-design)
[![umi](https://img.shields.io/badge/Umi-^4.0.0-ff9900?style=flat-square&logo=umijs)](https://github.com/umijs/umi)
</div>
- 文档源文件位于 `docs/` 目录。
## 快速开始
本仓库示例与 CI 使用 `pnpm`,你也可以使用 `npm` 或 `yarn`,但推荐 `pnpm`。
```bash
# 克隆
git clone https://github.com/zuiidea/antd-admin.git
cd antd-admin
# 安装依赖
pnpm install
# 启动开发(含本地 mock)
npm run dev
# 构建
npm run build
# lint 与格式化
npm run lint
npm run format
```
说明:
- 本地 mock 实现在 `mock/index.js`,便于在无后端时开发。
- CI 工作流位于 `.github/workflows/ci.yml`(使用 pnpm、lint、build)。
- 若需对接真实后端,请修改 `src/services` 下的 API。
更多详细文档请查看 `docs/` 目录下的其他页面。
## 参与贡献
欢迎提交 Issue 或 PR 改进项目文档或代码。
+11
View File
@@ -0,0 +1,11 @@
- 入门
- [快速上手](zh-cn/getting-started.md)
- 定制化
- [配置项](zh-cn/configuration.md)
- [接口配置](zh-cn/API-configuration.md)
- [国际化](zh-cn/i18n.md)
- [布局](zh-cn/layout.md)
- [http 请求](zh-cn/request.md)
- 指南
- [部署](zh-cn/deploy.md)
- [更新日志](zh-cn/change-log.md)
+52
View File
@@ -0,0 +1,52 @@
## 5.0.0
#### 优化
- 尽量使用修饰器,简化代码编写,提高代码可读性。
- API 配置化,简化获取数据方式。
- `utils` 内文件拆分,各司其职。
- 简化`utils/request`文件,不做特殊处理。
#### 规范
- 函数添加描述、参数、返回值等注释,含糊不清的代码增加注释,规范参考 [Google JavaScript Style Guide](https://google.github.io/styleguide/jsguide.html#appendices-jsdoc-tag-reference)。
- 语义化版本号,规范参加 [语义化版本 2.0.0](https://semver.org/lang/zh-CN/)。
- 静态代码检查,统一代码风格,代码提交前将会使用 `prettier`、`stylelint`、`eslint` 规范代码。
- Git 提交信息规范化,[git-commit-emoji-cn](https://github.com/liuchengxu/git-commit-emoji-cn)。
- 基于 `Umi` 的约定式路由,无需再写路由配置文件。
- 使用 `React 16` 新特性,如 `Fragment`、`Context`、 `PureComponent`等。
#### 功能
- 支持国际化,源码中抽离翻译字段,按需加载语言包,自动在线翻译。
- 支持按需引入 `lodash` 函数。
- 支持多布局,可根据规则规定哪些路由使用哪种布局。
- 支持 Antd Admin 在 Travis 上自动编译和部署。
- 使用 `Docsify` 生成文档网站。
#### 样式
- 新增 Antd Admin 独立 Logo。
- 重写整体布局组件,优化菜单、面包屑导航自动高亮,菜单自动展开等逻辑。
- 移动端菜单更改为抽屉式。
#### 其他
- 废弃 `IconFont`、 `Search`、`DataTable`等组件,因为在 `Antd` 中有很好的支持和可替代的。
+33
View File
@@ -0,0 +1,33 @@
# 配置项
你可以在 `/src/utils/config.js` 里做一些自定义配置:
## siteName
- 类型: `String`
配置站点名称,应用到登录框,侧边栏顶部的标题文字显示。
## copyright
- 类型: `String`
配置版权声明,应用到登录页、`Primay`布局底部。
## logoPath
- 类型: `String`
配置站点 Logo,应用到登录框,侧边栏顶部的 Logo 显示。
## apiPrefix
- 类型: `String`
配置项目中接口的前缀,接口相关文档可查看 [接口配置](API-configuration.md)
## fixedHeader
- 类型: `String`
在`Primary`布局下,页面滚动时是否固定顶部。
+114
View File
@@ -0,0 +1,114 @@
# 部署
完成开发并且在开发环境验证之后,就需要部署给我们的用户了。
![i18n](../_media/term_build.svg)
## 构建
先执行下面的命令,
```bash
npm run build
```
几秒后,输出应该如下:
```bash
> antd-admin@5.0.0-beta build /Users/zuiidea/web/antd-admin
> umi build
[21:13:17] webpack compiled in 43s 868ms
DONE Compiled successfully in 43877ms 21:13:17
File sizes after gzip:
1.3 MB dist/vendors.async.js
308.21 KB dist/umi.js
45.49 KB dist/vendors.chunk.css
36.08 KB dist/p__chart__highCharts__index.async.js
33.53 KB dist/p__user__index.async.js
22.36 KB dist/p__chart__ECharts__index.async.js
4.21 KB dist/p__dashboard__index.async.js
4.06 KB dist/umi.css
...
```
`build` 命令会打包所有的资源,包含 JavaScript, CSS, web fonts, images, html 等。你可以在 `dist/` 目录下找到这些文件。
> 如果有使用 HashHistory 、 部署 html 到非根目录、静态化等需求,请查看[Umi 部署](https://umijs.org/zh/guide/deploy.html)。
## 本地验证
发布之前,可以通过 `serve` 做本地验证,
```
$ yarn global add serve
$ serve ./dist
Serving!
- Local: http://localhost:5000
- On Your Network: http://{Your IP}:5000
Copied local address to clipboard!
```
访问 [http://localhost:5000](http://localhost:5000),正常情况下法应该是和 `npm start` 一致的(接口可能无法获取到正确数据)。
## 部署
接下来,我们可以把静态文件上传到服务器,如果使用 Nginx 作为 Web server,你可以在 `ngnix.conf` 中这样配置:
```
server
{
listen 80;
# 指定可访问的域名
server_name antd-admin.zuiidea.com;
# 编译后的文件存放的目录
root /home/www/antd-admin/dist;
# 代理服务端接口,避免跨域
location /api {
proxy_pass http://localhost:7000/api;
}
# 因为前端使用了BrowserHistory,所以将路由 fallback 到 index.html
location / {
index index.html;
try_files $uri $uri/ /index.html;
}
}
```
重启 Web server,访问 [http://antd-admin.zuiidea.com](http://antd-admin.zuiidea.com) ,你将看到正确的页面。
```bash
nginx -s reload
```
类似的,如果你使用 Caddy 作为 Web server,你可以在 `Caddyfile` 中这样配置:
```
antd-admin.zuiidea.com {
gzip
root /home/www/antd-admin/dist
proxy /api http://localhost:7000
rewrite {
if {path} not_match ^/api
to {path} {path}/ /
}
}
antd-admin.zuiidea.com/public {
gzip
root /home/www/antd-admin/dist/static/public
}
```
+7
View File
@@ -0,0 +1,7 @@
# 问题集锦
## 新建页面
1. 直接从/src/pages复制一个page (会自动创建路由[umi](https://umijs.org/zh/guide/router.html#%E7%BA%A6%E5%AE%9A%E5%BC%8F%E8%B7%AF%E7%94%B1))
2. 修改 namespace/pathToRegexp 在 model.js
3. 修改 mock中route.js增加一条route
+69
View File
@@ -0,0 +1,69 @@
# 快速上手
> 在开始之前,推荐先学习 [React](http://facebook.github.io/react/) 、 [ES2015+](http://es6.ruanyifeng.com/) 、 [Antd Design](https://ant.design/docs/react/introduce-cn) , 了解 [UmiJS](https://umijs.org/) 、[Dva](http://github.com/dvajs/dva) ,并正确安装和配置了 [Node.js](https://nodejs.org/) v8 或以上 、[Git](https://git-scm.com/)。提前了解和学习这些知识会非常有帮助。
## 安装
```bash
git clone https://github.com/zuiidea/antd-admin.git my-project
cd my-project
```
1. 克隆项目并安装依赖(推荐使用 `pnpm`)。
```bash
git clone https://github.com/zuiidea/antd-admin.git my-project
cd my-project
pnpm install
```
或使用其它包管理器:
```bash
npm install
# 或
yarn install
```
2. 启动开发模式:
```bash
npm run dev
```
3. 启动完成后在浏览器打开项目(查看开发服务器输出以获取实际 URL/端口)。
│ │ ├── index.js # 工具函数
│ │ ├── request.js # 异步请求函数(axios)
│ │ └── theme.js # 项目需要在js中使用到样式变量
├── .editorconfig # 编辑器配置
├── .env # 环境变量
├── .eslintrc # ESlint配置
├── .gitignore # Git忽略文件配置
├── .prettierignore # Prettier忽略文件配置
├── .prettierrc # Prettier配置
├── .stylelintrc.json # Stylelint配置
├── .travis.yml # Travis配置
└── .umirc.js # Umi配置
└── package.json # 项目信息
```
## 本地开发
项目推荐使用 `pnpm` 进行依赖管理:
```bash
pnpm install
npm run dev
```
也可以使用 `npm` 或 `yarn`:
```bash
npm install
# 或
yarn install
# 然后使用对应的启动命令,例如 `npm run dev` 或 `yarn dev`(若 package.json 中配置了),
# 本仓库默认开发脚本为 `npm run dev`。
```
启动后在浏览器打开项目(查看开发服务器输出以获取实际 URL/端口)。
+123
View File
@@ -0,0 +1,123 @@
# 国际化(i18n)使用说明
本项目通过 Umi 的 `plugin-locale`(基于 `react-intl`)管理多语言,翻译资源位于 `src/locales`(例如 `en-US.json`、`zh-CN.json`)。下面说明如何:新增语言、增加翻译条目、切换语言与关闭多语言。示例以新增日语 `ja-JP` 为例。
## 1. 新增一种语言(长期支持)
1. 在 `src/locales/` 下创建新的翻译文件,文件名为语言标识,例如:`src/locales/ja-JP.json`。
2. 文件内容为 JSON 格式的翻译对象(可嵌套):
```json
{
"welcome": "ようこそ",
"login": {
"username": "ユーザー名",
"password": "パスワード",
"submit": "ログイン"
}
}
```
3. 若希望 Ant Design 组件也使用对应的本地化(日期/组件文案),在 `src/app.tsx` 的 `pick` 函数中添加对应的 AntD locale 引入与映射,例如:
```ts
import jaJP from 'antd/locale/ja_JP';
// ...
if (l === 'ja-JP') return jaJP;
```
4. 在语言选择列表(例如 `src/components/TopbarControls.tsx` 的 `localeMenuItems`)中加入新语言项:
```ts
{ key: 'ja-JP', label: '日本語' }
```
5. 重启开发服务器:
```bash
pnpm run dev
```
Umi 会在构建时将 `src/locales` 下的文件编入 `localeInfo`,页面即可使用新语言。
提示:如不想重启或想动态注册翻译,可使用运行时 API `addLocale(name, messages, extraLocales)`(见下一节)。
## 2. 增加一条多语言文本(翻译条目)
1. 在所有语言的 JSON 文件中添加相同的 id(推荐同时维护 `en-US.json` 与 `zh-CN.json`,新语言也应添加):
`src/locales/en-US.json`
```json
"my.feature.greeting": "Hello from feature"
```
`src/locales/zh-CN.json`
```json
"my.feature.greeting": "来自功能的问候"
```
2. 在组件中使用 `useIntl()` 获取 `intl`,并调用 `formatMessage`:
```ts
import { useIntl } from 'umi';
const intl = useIntl();
const text = intl.formatMessage({ id: 'my.feature.greeting', defaultMessage: 'Hello' });
```
建议使用 `useIntl()`(或 `injectIntl`)以保证语言切换时组件可自动刷新并显示新文本。
## 3. 运行时切换或注册语言
- 切换语言(会写入 `localStorage` 并触发刷新或事件):
```ts
import { setLocale } from 'umi';
// 切换并刷新页面
setLocale('ja-JP', true);
// 切换但不刷新(触发事件更新)
setLocale('zh-CN', false);
```
- 运行时注册(无需重启):
```ts
import { addLocale, setLocale } from 'umi';
import jaMessages from '@/locales/ja-JP.json';
import jaAntd from 'antd/locale/ja_JP';
addLocale('ja-JP', jaMessages, { antd: jaAntd, momentLocale: 'ja' });
setLocale('ja-JP', false);
```
`addLocale` 会把翻译合并到内部 `localeInfo`,并可同时提供 AntD 与(可选的)moment 本地化配置。
## 4. 关闭多语言(禁用 i18n)
若想永久关闭多语言功能:
1. 在 `src/app.tsx` 的 `LocaleWrapper` 中,直接返回固定的 AntD locale(忽略 `localStorage` 中的 `umi_locale`):
```ts
const pick = (l: string | null) => {
return zhCN; // 强制使用中文
};
```
2. 移除或隐藏语言切换控件(例如删除 `src/components/TopbarControls.tsx` 中的语言菜单项或 Dropdown)。
3. 可选:删除 `src/locales` 中其它语言文件,仅保留目标语言文件以减少构建体积。
如果只是临时禁止用户切换,建议仅执行第 2 步(隐藏切换),以便未来快速恢复多语言支持。
## 5. 调试与常见问题
- 新增语言后无显示:确认已重启 dev server(或使用 `addLocale` 动态注册),并在 `app.tsx` 中为该语言提供 AntD locale。
- 翻译未生效或缺失:检查 `src/locales/*.json` 是否包含对应 id,且 `formatMessage` 中的 id 拼写正确。
- 想自动抽取翻译 id:仓库未内置抽取脚本,建议按需集成 `lingui`、`babel-plugin-react-intl` 或其他工具并在 `package.json` 中添加相应脚本。
如果你需要,我可以:
- 为你创建一个 `src/locales/ja-JP.json` 的初始翻译并更新 `TopbarControls` 与 `app.tsx` 映射;或
- 添加一个示例组件,演示如何在运行时通过 `addLocale` 注册新语言。请告诉我你更希望我执行哪项。
+60
View File
@@ -0,0 +1,60 @@
# 布局
## 新增布局
以新增名为 `secondary` 的布局为例,使以 `secondary` 开头的路由都使用该布局。
1. 在 `src/utils/config.js` 新增相关配置,参数详细请查看 [layouts](/zh-cn/configuration?id=layouts)。
```javascript
layouts: [
{
name: 'primary',
include: [/.*/],
exclude: [/(\/(en|zh))*\/login/, /(\/(en|zh))*\/secondary\/(.*)/],
},
{
name: 'secondary',
include: [/(\/(en|zh))*\/secondary\/(.*)/],
},
],
```
2. 在`src/layouts/BaseLayout.js` 文件中新增 `secondary` 布局组件。
```javascript
import SecondaryLayout from './SecondaryLayout'
const LayoutMap = {
primary: PrimaryLayout,
public: PublicLayout,
secondary: SecondaryLayout,
}
```
3. 在`src/layouts/` 目录中新增 `SecondaryLayout.js` 文件。
```javascript
import React from 'react'
export default ({ children }) => {
return (
<div>
<h1>Secondary</h1>
{children}
</div>
)
}
```
4. 在`src/pages/` 目录中新增 `secondary/index.js` 文件。
```javascript
import React from 'react'
export default ({ children }) => {
return <div>Secondary page Content</div>
}
```
5. 最后,使用 `npm run dev` 启动开发模式,然后在浏览器中打开该布局页面(查看开发服务器输出以获取实际 URL),例如 `/secondary/`。
+33
View File
@@ -0,0 +1,33 @@
# HTTP 请求
本项目使用位于 `src/utils/request.ts` 的轻量封装(基于 `fetch`),默认导出为 `api`。该封装负责:
- 将 `config.apiPrefix` 与请求 `path` 拼接为最终 URL。
- 处理 `params`(查询字符串)与 `body`(JSON 或 FormData)。
- 在本地有 token 时自动注入 `Authorization` 头(本项目使用 localStorage 键 `app-auth-token`)。
- 统一解析后端返回(后端需遵循 `{ success, message, data }` 约定)并在非成功时抛出错误并显示 UI 提示(使用 `antd` 的 `message`)。
主要行为说明
- `api(path, options)` 会把 `config.apiPrefix` 与 `path` 拼接。
- 当传入 `options.params` 时,会序列化为查询字符串并追加到 URL。
- `options.body` 的处理策略:
- 若为 FormData,直接发送(不要手动设置 Content-Type)。
- 若为字符串或 Blob,直接发送。
- 其余对象会被 `JSON.stringify`,默认设置 `Content-Type: application/json`(除非已在 headers 中指定)。
- 若 localStorage 中有 token 且未在 headers 中显式提供 Authorization,将自动设置 `Authorization: Bearer <token>`。
- 成功响应返回后端 `data` 字段;响应格式不符合约定或后端返回失败时会抛出异常。
使用示例(TypeScript):
```ts
import api from '@/utils/request';
// 带查询参数的 GET
const page = await api('/users', { method: 'GET', params: { page: 1, pageSize: 10 } });
// 发送 JSON 请求体的 POST
const created = await api('/user', { method: 'POST', body: { name: 'Alice' } });
```
详细实现请参阅 `src/utils/request.ts`,文档中仅列出使用建议与约定。
+5
View File
@@ -0,0 +1,5 @@
# 路由
本项目中采用约定式路由
参考[umi 路由](https://umijs.org/zh/guide/router.html)
+15
View File
@@ -0,0 +1,15 @@
import { Config, configUmiAlias, createConfig } from 'umi/test';
export default async () => {
return (
(await configUmiAlias({
...createConfig({
target: 'browser',
jsTransformer: 'esbuild',
jsTransformerOpts: { jsx: 'automatic' },
}),
// you can override umi default jest config here
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
})) as Config.InitialOptions
);
};
+53
View File
@@ -0,0 +1,53 @@
import * as adminSvc from '../../src/services/admin';
/**
* Skill 元数据与封装 — Admin
* 目的:为自动化代理或 LLM 提供明确的能力描述与可直接调用的包装函数。
*/
export const meta = {
id: 'admin:manage',
name: 'Admin Management',
description: '登录/登出、获取当前管理员、管理管理员列表(增删改查)',
inputs: {
login: { adminname: 'string', password: 'string' },
getAdmin: { id: 'string' },
createAdmin: { values: 'object' },
updateAdmin: { id: 'string', values: 'object' },
deleteAdmin: { id: 'string' },
deleteAdmins: { ids: 'string[]' },
listAdmins: { params: 'object | undefined' },
},
outputs: 'JSON (see src/types/admin.ts for schema)',
};
export const actions = {
async login(payload: { adminname: string; password: string }) {
return adminSvc.login(payload);
},
async logout() {
return adminSvc.logout();
},
async currentAdmin() {
return adminSvc.currentAdmin();
},
async listAdmins(params?: Record<string, string | number | boolean>) {
return adminSvc.listAdmins(params as any);
},
async createAdmin(values: Record<string, unknown>) {
return adminSvc.createAdmin(values);
},
async getAdmin(id: string) {
return adminSvc.getAdmin(id);
},
async updateAdmin(id: string, values: Record<string, unknown>) {
return adminSvc.updateAdmin(id, values);
},
async deleteAdmin(id: string) {
return adminSvc.deleteAdmin(id);
},
async deleteAdmins(ids: string[]) {
return adminSvc.deleteAdmins(ids);
},
};
export default { meta, actions };
+17
View File
@@ -0,0 +1,17 @@
import * as dashSvc from '../../src/services/dashboard';
export const meta = {
id: 'dashboard:view',
name: 'Dashboard View',
description: '获取仪表盘汇总数据',
inputs: {},
outputs: 'JSON summary data from /dashboard',
};
export const actions = {
async getDashboard() {
return dashSvc.getDashboard();
},
};
export default { meta, actions };
+32
View File
@@ -0,0 +1,32 @@
/**
* Skills registry
*
* 目的:集中导出 llm/skills 下的 skill 模块,便于运行时自动发现或静态引入。
* 导出:
* - `skills`:按短名映射的 skill 模块集合。
* - `listSkills()`:返回所有 skill 的 meta 数组,便于展示或自动选择。
* - `getSkillById(id)`:基于 meta.id 查找对应 skill 模块。
*/
import admin from './admin.skill';
import dashboard from './dashboard.skill';
import menu from './menu.skill';
import user from './user.skill';
const skills: Record<string, any> = {
admin,
menu,
user,
dashboard,
};
export function listSkills() {
return Object.values(skills).map((s) => s.meta);
}
export function getSkillById(id: string) {
return Object.values(skills).find((s) => s.meta && s.meta.id === id);
}
export { skills };
export default skills;
+35
View File
@@ -0,0 +1,35 @@
import * as menuSvc from '../../src/services/menu';
export const meta = {
id: 'menu:manage',
name: 'Menu Management',
description: '列出、创建、更新、删除与排序菜单项',
inputs: {
listMenus: {},
createMenu: { values: 'MenuFormValues' },
updateMenu: { id: 'number | string', values: 'Partial<MenuFormValues>' },
deleteMenu: { id: 'number | string' },
sortMenus: { order: 'Array<number | string>' },
},
outputs: 'JSON (see src/types/menu.ts for schema)',
};
export const actions = {
async listMenus() {
return menuSvc.listMenus();
},
async createMenu(values: any) {
return menuSvc.createMenu(values);
},
async updateMenu(id: number | string, values: any) {
return menuSvc.updateMenu(id, values);
},
async deleteMenu(id: number | string) {
return menuSvc.deleteMenu(id);
},
async sortMenus(order: Array<number | string>) {
return menuSvc.sortMenus(order);
},
};
export default { meta, actions };
+39
View File
@@ -0,0 +1,39 @@
import * as userSvc from '../../src/services/user';
export const meta = {
id: 'user:manage',
name: 'User Management',
description: '用户列表/分页、创建、获取、更新、删除与批量删除',
inputs: {
listUsers: { params: 'object | undefined' },
createUser: { values: 'object' },
getUser: { id: 'string' },
updateUser: { id: 'string', values: 'object' },
deleteUser: { id: 'string' },
deleteUsers: { ids: 'string[]' },
},
outputs: 'JSON (see src/types/user.ts for schema)',
};
export const actions = {
async listUsers(params?: Record<string, string | number | boolean>) {
return userSvc.listUsers(params as any);
},
async createUser(values: Record<string, unknown>) {
return userSvc.createUser(values);
},
async getUser(id: string) {
return userSvc.getUser(id);
},
async updateUser(id: string, values: Record<string, unknown>) {
return userSvc.updateUser(id, values);
},
async deleteUser(id: string) {
return userSvc.deleteUser(id);
},
async deleteUsers(ids: string[]) {
return userSvc.deleteUsers(ids);
},
};
export default { meta, actions };
+36
View File
@@ -0,0 +1,36 @@
项目:antd-admin_next
目标:将仓库中的关键信息写成对大模型(LLM)友好的简短说明,便于自动化理解、代码导航和提示生成。
概览:
- 技术栈:React + Ant Design + TypeScript(前端单页/多页面结构),源码位于 `src/`。
- 路由/页面:页面文件放在 `src/pages/` 目录;布局在 `src/layouts/`;组件在 `src/components/`。
- 重要工具:`src/utils/request.ts` 为 HTTP 请求封装,使用 `fetch`,默认 API 前缀由 `src/utils/config.ts` 提供。
API 与约定:
- 全局 API 前缀:`/api/v1`(见 `src/utils/config.ts`)。
- 请求函数 `api(path, options)`:
- 自动把 `options.params` 转为查询字符串。
- 对对象 body 自动 JSON 序列化并设置 `Content-Type: application/json`(FormData 会被保留)。
- 当响应状态为 `204` 返回空对象;当 `res.ok` 为 false 时抛出 Error,错误信息优先使用响应体中的 `message` 字段。
如何使用(对模型说明):
- 若要调用后端资源,请调用 `api('/resource', { method: 'GET' | 'POST', params, body })`。
- 成功响应应为 JSON,失败会抛出 Error。处理调用时应捕获异常并展示 `error.message`。
本文件用途:
- 作为 LLM 的快速上下文:当模型在代码中自动生成、补全或审阅代码时,可引用此文件以获得仓库结构、关键约定和请求行为的摘要。
快速运行(可能依赖 package manager):
- 常用:`npm run dev` 或 `pnpm dev` 启动开发服务器。
如需更详细的接口契约或后端响应示例,请查看对应的 `src/services/` 目录下的 API 封装文件。
Agent Skills:
- 为方便自动化代理(Agent/LLM)调用,项目在 `llm/skills/` 下提供了若干能力描述与包装:
- `llm/skills/admin.skill.ts`:管理员管理相关操作(login、logout、list/create/update/delete)
- `llm/skills/menu.skill.ts`:菜单管理操作(list/create/update/delete/sort)
- `llm/skills/user.skill.ts`:用户管理操作(list/create/get/update/delete/batch)
- `llm/skills/dashboard.skill.ts`:获取仪表盘数据的读取操作
这些 skill 文件导出 `meta`(能力描述)和 `actions`(可直接调用的异步函数),便于代理在运行时发现并调用对应后端逻辑。
+36
View File
@@ -0,0 +1,36 @@
{
"name": "Antd-Admin",
"start_url": ".",
"display": "standalone",
"background_color": "#fff",
"description": "A front-end solution for enterprise applications built upon Ant Design and UmiJS",
"icons": [{
"src": "logo/logo@96.png",
"sizes": "72x72"
},
{
"src": "logo/logo@128.png",
"sizes": "128x128"
},
{
"src": "logo/logo@144.png",
"sizes": "144x144"
},
{
"src": "logo/logo@152.png",
"sizes": "152x152"
},
{
"src": "logo/logo@192.png",
"sizes": "192x192"
},
{
"src": "logo/logo@384.png",
"sizes": "384x384"
},
{
"src": "logo/logo@512.png",
"sizes": "512x512"
}
]
}
+373
View File
@@ -0,0 +1,373 @@
// Consolidated mock server for development (simplified)
const Mock = require('mockjs');
const qs = require('qs');
const ApiPrefix = '/api/v1';
// simple in-memory admin users with richer mock fields
const adminList = [
{
id: 1,
username: 'admin',
password: 'admin',
real_name: '李四',
nick_name: '超级管理员',
mobile: '13800000000',
avatar: Mock.Random.image('100x100', '#4096ff', '#fff', 'png', 'A'),
role: '管理员',
department: '运维部',
permissions: '*',
status: 1,
remark: '拥有所有权限',
lastLogin: Mock.Random.datetime(),
createdBy: 'system',
},
{
id: 2,
username: 'guest',
password: 'guest',
real_name: '访客',
nick_name: '访客',
mobile: '15100000000',
avatar: Mock.Random.image('100x100', '#ff7f50', '#fff', 'png', 'G'),
role: '访客',
department: '外部',
permissions: '/dashboard,/users,/users/list',
status: 1,
remark: '',
lastLogin: Mock.Random.datetime(),
createdBy: 'system',
},
];
// users list
let users = Mock.mock({
'data|20-30': [
{
id: '@id',
name: '@name',
nickName: '@last',
phone: /^1[34578]\d{9}$/,
'age|18-60': 1,
address: '@county(true)',
isMale: '@boolean',
email: '@email',
createTime: '@datetime',
avatar() {
return Mock.Random.image(
'100x100',
'#4096ff',
'#757575',
'png',
this.nickName ? this.nickName.substr(0, 1) : '',
);
},
},
],
}).data;
// routes database (source of truth)
const ROUTES_DB = [
{ id: '1', name: '仪表盘', icon: 'home', route: '/dashboard' },
{ id: '2', name: 'Ai会话', icon: 'robot', route: '/ai/chat' },
{ id: '3', name: '用户管理', icon: 'user', route: '/users' },
{
id: '4',
breadcrumbParentId: '3',
name: '用户列表',
icon: 'team',
route: '/users/list',
},
{
id: '5',
menuParentId: '-1',
breadcrumbParentId: '4',
name: '用户详情',
route: '/users/:id',
},
{ id: '6', name: '系统设置', icon: 'settings', route: '/sys' },
{
id: '7',
breadcrumbParentId: '6',
name: '成员列表',
icon: 'team',
route: '/admin/list',
},
{
id: '8',
menuParentId: '-1',
breadcrumbParentId: '6',
name: '成员详情',
icon: 'user',
route: '/admin/:id',
},
{
id: '9',
breadcrumbParentId: '6',
name: '菜单设置',
icon: 'tool',
route: '/sys/menu',
},
{ id: '10', name: '项目介绍', icon: 'info-c', route: '/guide' },
];
// convert routes DB into menus tree used by UI
function buildMenusFromRoutes(db) {
const items = db
// exclude routes that should not appear in menu (explicit menuParentId === '-1')
.filter((r) => !(r.menuParentId === '-1' || r.menuParentId === -1))
.map((r, idx) => {
const id = Number(r.id) || r.id;
// prefer explicit menuParentId, fall back to breadcrumbParentId
const parentIdRaw = r.breadcrumbParentId ?? null;
const parentId =
parentIdRaw === undefined || parentIdRaw === null
? null
: parentIdRaw === '-1'
? null
: Number(parentIdRaw);
return {
id,
title: r.name,
icon: r.icon,
route: r.route,
parentId,
status: 1,
sort: idx + 1,
children: [],
};
});
const map = new Map();
items.forEach((it) => map.set(it.id, it));
const roots = [];
items.forEach((it) => {
if (it.parentId == null || !map.has(it.parentId)) {
roots.push(it);
} else {
map.get(it.parentId).children.push(it);
}
});
// sort recursively by sort
const sortRec = (arr) => {
arr.sort((a, b) => (a.sort || 0) - (b.sort || 0));
arr.forEach((c) => {
if (c.children && c.children.length) sortRec(c.children);
});
};
sortRec(roots);
return roots;
}
const menus = buildMenusFromRoutes(ROUTES_DB);
// dashboard
const Dashboard = Mock.mock({
'sales|6': [
{
'name|+1': 2008,
'Clothes|200-500': 1,
'Food|180-400': 1,
'Electronics|300-550': 1,
},
],
cpu: { 'usage|50-600': 1, space: 825, 'cpu|40-90': 1 },
browser: [
{ name: 'Google Chrome', percent: 43.3, status: 1 },
{ name: 'Mozilla Firefox', percent: 33.4, status: 2 },
],
});
// simple helper to read cookie token
function parseTokenFromCookie(headers) {
const cookie = headers.cookie || '';
const cookies = qs.parse(cookie.replace(/\s/g, ''), { delimiter: ';' });
if (!cookies.token) return null;
try {
return JSON.parse(cookies.token);
} catch (e) {
return null;
}
}
module.exports = {
[`GET ${ApiPrefix}/dashboard`](req, res) {
res.json({ success: true, data: Dashboard });
},
[`GET ${ApiPrefix}/menus`](req, res) {
res.json({ success: true, data: menus });
},
[`POST ${ApiPrefix}/admin/login`](req, res) {
const { username, password } = req.body || {};
const admin = adminList.find(
(u) => u.username === username && u.password === password,
);
if (admin) {
const now = new Date();
now.setDate(now.getDate() + 1);
res.cookie(
'token',
JSON.stringify({ id: admin.id, deadline: now.getTime() }),
{ maxAge: 24 * 3600 * 1000, httpOnly: true },
);
res.json({ success: true, message: 'Ok', data: null });
} else {
res
.status(400)
.json({ success: false, message: 'Invalid credentials', data: null });
}
},
[`GET ${ApiPrefix}/admin/logout`](req, res) {
res.clearCookie('token');
res.json({ success: true, data: null });
},
[`GET ${ApiPrefix}/admin`](req, res) {
const token = parseTokenFromCookie(req.headers);
const response = {};
let admin = {};
if (!token) {
res
.status(200)
.json({ success: false, message: 'Not Login', data: null });
return;
}
response.success = token.deadline > new Date().getTime();
if (response.success) {
const adminItem = adminList.find((u) => u.id === token.id);
if (adminItem) {
const { password, ...other } = adminItem;
admin = other;
}
}
res.json({ success: response.success, data: admin || null });
},
[`GET ${ApiPrefix}/users`](req, res) {
const { query } = req;
let { pageSize, page, ...other } = query || {};
pageSize = Number(pageSize) || 10;
page = Number(page) || 1;
let newData = users.slice();
for (const key in other) {
if (Object.prototype.hasOwnProperty.call(other, key)) {
newData = newData.filter(
(item) => String(item[key]).indexOf(String(other[key])) > -1,
);
}
}
res.status(200).json({
success: true,
data: {
data: newData.slice((page - 1) * pageSize, page * pageSize),
total: newData.length,
},
});
},
[`GET ${ApiPrefix}/user/:id`](req, res) {
const { id } = req.params || {};
let item = users.find((u) => String(u.id) === String(id));
// 如果找不到用户,则生成一个带有相同 id 的 mock 用户,避免 404
if (!item) {
item = Mock.mock({
id: String(id),
name: '@name',
nickName: '@last',
phone: /^1[34578]\d{9}$/,
'age|18-60': 1,
address: '@county(true)',
isMale: '@boolean',
email: '@email',
createTime: '@datetime',
avatar() {
return Mock.Random.image(
'100x100',
'#4096ff',
'#757575',
'png',
this.nickName ? this.nickName.substr(0, 1) : '',
);
},
});
}
// enrich with some additional mock fields: phone model and browsing history
const enriched = {
...item,
// ensure lastLogin exists for user detail view (used by UI)
lastLogin: item.lastLogin || Mock.Random.datetime(),
phoneModel: Mock.Random.pick([
'iPhone 13',
'iPhone 14 Pro',
'Samsung S22',
'Huawei P50',
'Xiaomi 12',
]),
browsingHistory: Mock.mock({
'data|3-6': [
{
url: '@url',
title: '@title',
time: '@datetime',
},
],
}).data,
};
const { ...other } = enriched;
res.status(200).json({ success: true, data: other });
},
[`GET ${ApiPrefix}/routes`](req, res) {
res.status(200).json({ success: true, data: ROUTES_DB });
},
// admin accounts CRUD
[`GET ${ApiPrefix}/admins`](req, res) {
res.status(200).json({
success: true,
data: { data: adminList, total: adminList.length },
});
},
[`GET ${ApiPrefix}/admin/:id`](req, res) {
const { id } = req.params || {};
const item = adminList.find((u) => String(u.id) === String(id));
if (!item)
return res
.status(404)
.json({ success: false, message: 'Not found', data: null });
const { password, ...other } = item;
res.status(200).json({ success: true, data: other });
},
[`POST ${ApiPrefix}/admin`](req, res) {
const body = req.body || {};
const id = adminList.length
? Math.max(...adminList.map((u) => u.id)) + 1
: 1;
const next = { id, ...body };
adminList.push(next);
const { password, ...other } = next;
res.status(200).json({ success: true, data: other });
},
[`PATCH ${ApiPrefix}/admin/:id`](req, res) {
const { id } = req.params || {};
const body = req.body || {};
const idx = adminList.findIndex((u) => String(u.id) === String(id));
if (idx === -1)
return res
.status(404)
.json({ success: false, message: 'Not found', data: null });
adminList[idx] = { ...adminList[idx], ...body };
const { password, ...other } = adminList[idx];
res.status(200).json({ success: true, data: other });
},
};
+50 -58
View File
@@ -1,64 +1,56 @@
{
"private": true,
"name": "antd-admin",
"version": "4.3.5",
"version": "6.0.0",
"description": "An admin dashboard application demo built upon Ant Design and UmiJS",
"license": "MIT",
"scripts": {
"build": "umi build",
"dev": "umi dev",
"test": "jest",
"test:watch": "jest --watch",
"format": "prettier --write .",
"lint": "eslint --ext .ts,.tsx src",
"lint:fix": "eslint --ext .ts,.tsx src --fix",
"start": "npm run dev"
},
"dependencies": {
"antd": "^2.11.2",
"axios": "^0.16.2",
"babel-polyfill": "^6.23.0",
"classnames": "^2.2.5",
"cross-env": "^5.0.5",
"d3-shape": "^1.2.0",
"draftjs-to-markdown": "^0.4.0",
"dva": "^2.0.1",
"dva-loading": "^0.2.0",
"ejs-loader": "^0.3.0",
"history": "^4.7.2",
"js-beautify": "^1.6.14",
"jsonp": "^0.2.1",
"less-vars-to-js": "^1.1.2",
"lodash": "^4.17.4",
"mockjs": "^1.0.1-beta3",
"nprogress": "^0.2.0",
"path-to-regexp": "^1.7.0",
"prop-types": "^15.5.10",
"qs": "^6.5.0",
"query-string": "^5.0.0",
"rc-tween-one": "^1.3.1",
"react": "^15.6.1",
"react-countup": "^2.1.1",
"react-dom": "^15.6.1",
"react-draft-wysiwyg": "^1.10.0",
"react-helmet": "^5.1.3",
"recharts": "^0.22.4"
"@ant-design/icons": "^6.1.0",
"@ant-design/x": "^2.3.0",
"@ant-design/x-sdk": "^2.3.0",
"@umijs/plugins": "^4.6.32",
"antd": "^6.3.2",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"umi": "^4.6.32",
"zustand": "^5.0.0"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
"babel-plugin-dev-expression": "^0.2.1",
"babel-plugin-dva-hmr": "^0.3.2",
"babel-plugin-import": "^1.1.1",
"babel-plugin-transform-runtime": "^6.9.0",
"babel-runtime": "^6.9.2",
"copy-webpack-plugin": "^4.0.1",
"draftjs-to-html": "^0.7.0",
"dva-model-extend": "^0.1.1",
"eslint": "^4.1.1",
"eslint-config-airbnb": "^15.0.2",
"eslint-import-resolver-node": "^0.3.1",
"eslint-loader": "^1.9.0",
"eslint-plugin-import": "^2.6.1",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.1.0",
"html-webpack-plugin": "^2.29.0",
"redbox-react": "^1.2.10",
"roadhog": "^1.2.2"
},
"pre-commit": ["lint"],
"scripts": {
"dev": "cross-env BROWSER=none HOST=0.0.0.0 roadhog server",
"lint": "eslint --fix --ext .js src",
"build": "roadhog build",
"build:dll": "roadhog buildDll",
"build:new": "node version && roadhog build"
"@testing-library/jest-dom": "^6.1.1",
"@testing-library/react": "^14.0.0",
"@types/jest": "^29.5.3",
"@types/react": "19.2.14",
"@types/react-dom": "^19.2.3",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"@umijs/test": "^4.6.32",
"eslint": "^8.47.0",
"eslint-config-prettier": "^10.1.8",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-prettier": "^5.1.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unused-imports": "^2.0.0",
"jest": "^29.6.1",
"mockjs": "^1.1.0",
"prettier": "^2.8.8",
"prettier-plugin-organize-imports": "^3.2.2",
"prettier-plugin-packagejson": "^2.4.3",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.2",
"typescript": "^5.9.3",
"jest-environment-jsdom": "^29.6.1",
"jsdom": "^21.1.1"
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

+24
View File
@@ -0,0 +1,24 @@
<svg width="169px" height="141px" viewBox="0 0 169 141" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 51.3 (57544) - http://www.bohemiancoding.com/sketch -->
<desc>Created with Sketch.</desc>
<defs>
<linearGradient x1="54.0428975%" y1="4.39752391%" x2="54.0428975%" y2="108.456714%" id="linearGradient-1">
<stop stop-color="#29CDFF" offset="0%"></stop>
<stop stop-color="#148EFF" offset="62.3089445%"></stop>
<stop stop-color="#0A60FF" offset="100%"></stop>
</linearGradient>
<linearGradient x1="50%" y1="14.2201464%" x2="50%" y2="113.263844%" id="linearGradient-2">
<stop stop-color="#FA816E" offset="0%"></stop>
<stop stop-color="#F74A5C" offset="65.9092442%"></stop>
<stop stop-color="#F51D2C" offset="100%"></stop>
</linearGradient>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="Group" transform="translate(0.000000, -5.000000)">
<rect id="Rectangle" fill="url(#linearGradient-1)" transform="translate(83.718923, 75.312358) rotate(-24.000000) translate(-83.718923, -75.312358) " x="68.7189234" y="0.312357954" width="30" height="150" rx="15"></rect>
<rect id="Rectangle" fill="url(#linearGradient-1)" transform="translate(129.009910, 75.580213) rotate(-24.000000) translate(-129.009910, -75.580213) " x="114.00991" y="0.580212739" width="30" height="150" rx="15"></rect>
<circle id="Oval" fill="url(#linearGradient-2)" cx="25" cy="120" r="25"></circle>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

+82
View File
@@ -0,0 +1,82 @@
import { ConfigProvider } from 'antd';
import 'antd/dist/reset.css';
import enUS from 'antd/locale/en_US';
import zhCN from 'antd/locale/zh_CN';
import React, { useEffect, useState } from 'react';
import AuthGate from './components/AuthGate';
function LocaleWrapper({ children }: { children: React.ReactElement }) {
// read initial locale synchronously so Antd has correct locale on first render
const pick = (l: string | null) => {
if (l === 'zh-CN') return zhCN;
return enUS;
};
let initial: typeof zhCN | typeof enUS | undefined = undefined;
const stored = window.localStorage.getItem('umi_locale') || null;
initial = pick(stored);
const [locale, setLocale] = useState<typeof zhCN | typeof enUS | undefined>(
initial,
);
useEffect(() => {
const read = () => {
let l: string | null = null;
try {
l = window.localStorage.getItem('umi_locale') || null;
} catch (e) {
l = null;
}
setLocale(pick(l));
};
const onStorage = (ev: StorageEvent) => {
if (ev.key === 'umi_locale') read();
};
const onLocaleChange = (ev: Event) => {
// CustomEvent used by TopbarControls with detail = locale string
const possible = ev as CustomEvent | Event;
if (possible && typeof (possible as CustomEvent).detail !== 'undefined') {
const d = (possible as CustomEvent).detail;
if (d) setLocale(pick(String(d)));
}
};
window.addEventListener('storage', onStorage);
window.addEventListener('localechange', onLocaleChange as EventListener);
return () => {
window.removeEventListener('storage', onStorage);
window.removeEventListener(
'localechange',
onLocaleChange as EventListener,
);
};
}, []);
return <ConfigProvider locale={locale}>{children}</ConfigProvider>;
}
export function rootContainer(container: React.ReactElement) {
return (
<LocaleWrapper>
<AuthGate>{container}</AuthGate>
</LocaleWrapper>
);
}
// ensure mobile viewport meta exists (adds meta tag if not present)
try {
if (typeof window !== 'undefined') {
const hasVp = document.querySelector('meta[name="viewport"]');
if (!hasVp) {
const m = document.createElement('meta');
m.name = 'viewport';
m.content = 'width=device-width,initial-scale=1,maximum-scale=1';
document.head.appendChild(m);
}
}
} catch (e) {
// ignore in non-DOM environments
}
+63
View File
@@ -0,0 +1,63 @@
import { Spin } from 'antd';
import React, { useEffect, useState } from 'react';
import { history } from 'umi';
import useGlobalSync from '@/hooks/useGlobalSync';
import useIsMounted from '@/hooks/useIsMounted';
import adminService from '../services/admin';
import useGlobalStore from '../store/useGlobalStore';
export default function AuthGate({ children }: { children: React.ReactNode }) {
const isLoggedIn = useGlobalSync((s) => s.isLoggedIn);
const [loading, setLoading] = useState(true);
const isMounted = useIsMounted();
useEffect(() => {
(async () => {
try {
const admin = (await adminService.currentAdmin()) as
| import('@/types/admin').Admin
| undefined;
if (!isMounted()) return;
if (admin) {
useGlobalStore.getState().login();
useGlobalStore.getState().setCurrentUser(admin);
} else {
useGlobalStore.getState().logout();
}
} catch (e) {
useGlobalStore.getState().logout();
} finally {
if (isMounted()) setLoading(false);
}
})();
}, [isMounted]);
useEffect(() => {
const path = history.location.pathname;
if (!isLoggedIn && path !== '/login') {
history.replace('/login');
}
if (isLoggedIn && path === '/login') {
history.replace('/');
}
}, [isLoggedIn]);
if (loading) {
return (
<div
style={{
minHeight: '100vh',
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
>
<Spin size="large" />
</div>
);
}
return <>{children}</>;
}
-67
View File
@@ -1,67 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import { TweenOneGroup } from 'rc-tween-one'
const enterAnim = [
{
opacity: 0,
x: 30,
backgroundColor: '#fffeee',
duration: 0,
}, {
height: 0,
duration: 200,
type: 'from',
delay: 250,
ease: 'easeOutQuad',
onComplete: (e) => {
e.target.style.height = 'auto'
},
}, {
opacity: 1,
x: 0,
duration: 250,
ease: 'easeOutQuad',
}, {
delay: 1000,
backgroundColor: '#fff',
},
]
const leaveAnim = [
{
duration: 250,
x: -30,
opacity: 0,
}, {
height: 0,
duration: 200,
ease: 'easeOutQuad',
},
]
const AnimTableBody = ({ body, page = 1, current }) => {
if (current !== +page) {
return body
}
return (
<TweenOneGroup
component="tbody"
className={body.props.className}
enter={enterAnim}
leave={leaveAnim}
appear={false}
>
{body.props.children}
</TweenOneGroup>
)
}
AnimTableBody.propTypes = {
body: PropTypes.element,
page: PropTypes.any,
current: PropTypes.number.isRequired,
}
export default AnimTableBody
-112
View File
@@ -1,112 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Table } from 'antd'
import { request } from 'utils'
import lodash from 'lodash'
import './DataTable.less'
class DataTable extends React.Component {
constructor (props) {
super(props)
const { dataSource, pagination = {
showSizeChanger: true,
showQuickJumper: true,
showTotal: total => `共 ${total} 条`,
current: 1,
total: 100 },
} = props
this.state = {
loading: false,
dataSource,
fetchData: {},
pagination,
}
}
componentDidMount () {
if (this.props.fetch) {
this.fetch()
}
}
componentWillReceiveProps (nextProps) {
const staticNextProps = lodash.cloneDeep(nextProps)
delete staticNextProps.columns
const { columns, ...otherProps } = this.props
if (!lodash.isEqual(staticNextProps, otherProps)) {
this.props = nextProps
this.fetch()
}
}
handleTableChange = (pagination, filters, sorter) => {
const pager = this.state.pagination
pager.current = pagination.current
this.setState({
pagination: pager,
fetchData: {
results: pagination.pageSize,
page: pagination.current,
sortField: sorter.field,
sortOrder: sorter.order,
...filters,
},
}, () => {
this.fetch()
})
}
fetch = () => {
const { fetch: { url, data, dataKey } } = this.props
const { fetchData } = this.state
this.setState({ loading: true })
this.promise = request({
url,
data: {
...data,
...fetchData,
},
}).then((result) => {
if (!this.refs.DataTable) {
return
}
const { pagination } = this.state
pagination.total = result.total || pagination.total
this.setState({
loading: false,
dataSource: dataKey ? result[dataKey] : result.data,
pagination,
})
})
}
render () {
const { fetch, ...tableProps } = this.props
const { loading, dataSource, pagination } = this.state
return (<Table
ref="DataTable"
bordered
loading={loading}
onChange={this.handleTableChange}
{...tableProps}
pagination={pagination}
dataSource={dataSource}
/>)
}
}
DataTable.propTypes = {
fetch: PropTypes.object,
rowKey: PropTypes.string,
pagination: React.PropTypes.oneOfType([
React.PropTypes.bool,
React.PropTypes.object,
]),
columns: PropTypes.array,
dataSource: PropTypes.array,
}
export default DataTable
-6
View File
@@ -1,6 +0,0 @@
{
"name": "DataTable",
"version": "0.0.0",
"private": true,
"main": "./DataTable.js"
}
+64
View File
@@ -0,0 +1,64 @@
import { fireEvent, render, screen } from '@testing-library/react';
import React from 'react';
import DropOption from './DropOption';
// Mock antd Dropdown to expose menu items for testing
jest.mock('antd', () => {
return {
Dropdown: ({ menu, children }: any) =>
React.createElement(
'div',
null,
React.createElement('div', { 'data-testid': 'trigger' }, children),
React.createElement(
'div',
{ 'data-testid': 'menu' },
menu?.items?.map((it: any) =>
React.createElement(
'button',
{
key: it.key,
'data-key': it.key,
onClick: () => menu.onClick?.({ key: it.key }),
},
typeof it.label === 'string'
? it.label
: React.createElement('span', null, it.label),
),
),
),
),
};
});
jest.mock('@ant-design/icons', () => ({
BarsOutlined: () => React.createElement('span', null, 'Bars'),
DownOutlined: () => React.createElement('span', null, 'Down'),
}));
test('renders default trigger when no children provided', () => {
render(<DropOption menuOptions={[]} />);
const trigger = screen.getByTestId('trigger');
// default trigger in component is an <a>
expect(trigger.querySelector('a')).toBeTruthy();
});
test('wraps plain text children in a span', () => {
render(<DropOption menuOptions={[]}>PlainChild</DropOption>);
const trigger = screen.getByTestId('trigger');
expect(screen.getByText('PlainChild')).toBeTruthy();
expect(trigger.firstElementChild?.tagName.toLowerCase()).toBe('span');
});
test('clicking menu item calls onMenuClick with key', () => {
const onMenuClick = jest.fn();
render(
<DropOption
menuOptions={[{ key: 'one', label: 'One' }]}
onMenuClick={onMenuClick}
/>,
);
const item = screen.getByText('One');
fireEvent.click(item);
expect(onMenuClick).toHaveBeenCalledWith('one');
});
+48
View File
@@ -0,0 +1,48 @@
import { BarsOutlined, DownOutlined } from '@ant-design/icons';
import { Dropdown } from 'antd';
import React from 'react';
type Option = { key: string; label: React.ReactNode };
interface DropOptionProps {
menuOptions: Option[];
onMenuClick?: (key: string) => void;
children?: React.ReactNode;
}
const DropOption: React.FC<DropOptionProps> = ({
menuOptions,
onMenuClick,
children,
}) => {
const items = menuOptions.map((o) => ({ key: o.key, label: o.label }));
const menu = {
items,
onClick: ({ key }: { key: string }) => onMenuClick?.(key),
};
// ensure Dropdown receives a single React element as child
let triggerNode: React.ReactElement;
if (React.Children.count(children) === 1 && React.isValidElement(children)) {
triggerNode = children as React.ReactElement;
} else if (children) {
// wrap non-element children (like plain text) in a span
triggerNode = <span>{children}</span>;
} else {
triggerNode = (
<a onClick={(e) => e.preventDefault()}>
<BarsOutlined style={{ marginRight: 2 }} />
<DownOutlined />
</a>
);
}
return (
<Dropdown menu={menu} trigger={['click']}>
{triggerNode}
</Dropdown>
);
};
export default DropOption;
-25
View File
@@ -1,25 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Dropdown, Button, Icon, Menu } from 'antd'
const DropOption = ({ onMenuClick, menuOptions = [], buttonStyle, dropdownProps }) => {
const menu = menuOptions.map(item => <Menu.Item key={item.key}>{item.name}</Menu.Item>)
return (<Dropdown
overlay={<Menu onClick={onMenuClick}>{menu}</Menu>}
{...dropdownProps}
>
<Button style={{ border: 'none', ...buttonStyle }}>
<Icon style={{ marginRight: 2 }} type="bars" />
<Icon type="down" />
</Button>
</Dropdown>)
}
DropOption.propTypes = {
onMenuClick: PropTypes.func,
menuOptions: PropTypes.array.isRequired,
buttonStyle: PropTypes.object,
dropdownProps: PropTypes.object,
}
export default DropOption
-6
View File
@@ -1,6 +0,0 @@
{
"name": "DropOption",
"version": "0.0.0",
"private": true,
"main": "./DropOption.js"
}
-11
View File
@@ -1,11 +0,0 @@
import React from 'react'
import { Editor } from 'react-draft-wysiwyg'
import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css'
import styles from './Editor.less'
const DraftEditor = (props) => {
return (<Editor toolbarClassName={styles.toolbar} wrapperClassName={styles.wrapper} editorClassName={styles.editor} {...props} />)
}
export default DraftEditor
-111
View File
@@ -1,111 +0,0 @@
.wrapper {
height: 500px;
:global {
.rdw-dropdownoption-default {
padding: 6px;
}
.rdw-dropdown-optionwrapper {
box-sizing: content-box;
width: 100%;
border-radius: 0 0 2px 2px;
}
.rdw-inline-wrapper {
flex-wrap: wrap;
margin-bottom: 0;
.rdw-option-wrapper {
margin-bottom: 6px;
}
}
.rdw-option-active {
box-shadow: 1px 1px 0 #e8e8e8 inset;
}
.rdw-dropdown-optionwrapper {
&:hover {
box-shadow: none;
}
}
.rdw-colorpicker-option {
box-shadow: none;
}
.rdw-colorpicker-modal,
.rdw-embedded-modal,
.rdw-emoji-modal,
.rdw-image-modal,
.rdw-link-modal {
box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05);
}
.rdw-colorpicker-modal,
.rdw-embedded-modal,
.rdw-link-modal {
height: auto;
}
.rdw-emoji-modal {
width: 214px;
}
.rdw-colorpicker-modal {
width: auto;
}
.rdw-embedded-modal-btn,
.rdw-image-modal-btn,
.rdw-link-modal-btn {
height: 32px;
margin-top: 12px;
}
.rdw-embedded-modal-input,
.rdw-embedded-modal-size-input,
.rdw-link-modal-input {
padding: 2px 6px;
height: 32px;
}
.rdw-dropdown-selectedtext {
color: #000;
}
.rdw-dropdown-wrapper,
.rdw-option-wrapper {
min-width: 36px;
transition: all 0.2s ease;
height: 30px;
&:active {
box-shadow: 1px 1px 0 #e8e8e8 inset;
}
&:hover {
box-shadow: 1px 1px 0 #e8e8e8;
}
}
.rdw-dropdown-wrapper {
min-width: 60px;
}
.rdw-editor-main {
box-sizing: border-box;
}
}
.editor {
border: 1px solid #F1F1F1;
padding: 5px;
border-radius: 2px;
height: auto;
min-height: 200px;
}
.toolbar {}
}
-6
View File
@@ -1,6 +0,0 @@
{
"name": "Editor",
"version": "0.0.0",
"private": true,
"main": "./Editor.js"
}
-29
View File
@@ -1,29 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import styles from './FilterItem.less'
const FilterItem = ({
label = '',
children,
}) => {
const labelArray = label.split('')
return (
<div className={styles.filterItem}>
{labelArray.length > 0
? <div className={styles.labelWrap}>
{labelArray.map((item, index) => <span className="labelText" key={index}>{item}</span>)}
</div>
: ''}
<div className={styles.item}>
{children}
</div>
</div>
)
}
FilterItem.propTypes = {
label: PropTypes.string,
children: PropTypes.element.isRequired,
}
export default FilterItem
-17
View File
@@ -1,17 +0,0 @@
.filterItem {
display: flex;
justify-content: space-between;
.labelWrap {
width: 64px;
line-height: 28px;
margin-right: 12px;
justify-content: space-between;
display: flex;
overflow: hidden;
}
.item {
flex: 1;
}
}
-6
View File
@@ -1,6 +0,0 @@
{
"name": "FilterItem",
"version": "0.0.0",
"private": true,
"main": "./FilterItem.js"
}
+34
View File
@@ -0,0 +1,34 @@
import React from 'react';
interface LinkItem {
title: string;
href: string;
}
interface GlobalFooterProps {
links?: LinkItem[];
copyright?: React.ReactNode;
className?: string;
}
const GlobalFooter: React.FC<GlobalFooterProps> = ({
links = [],
copyright,
}) => {
return (
<footer style={{ textAlign: 'center', padding: '24px 0', color: '#666' }}>
{links.length > 0 && (
<div style={{ marginBottom: 8 }}>
{links.map((l, i) => (
<a key={i} href={l.href} style={{ margin: '0 8px' }}>
{l.title}
</a>
))}
</div>
)}
<div>{copyright ?? `© ${new Date().getFullYear()}`}</div>
</footer>
);
};
export default GlobalFooter;
+33
View File
@@ -0,0 +1,33 @@
import {
AppstoreOutlined,
HomeOutlined,
InfoCircleOutlined,
ProfileOutlined,
RobotOutlined,
SettingOutlined,
TeamOutlined,
ToolOutlined,
UserAddOutlined,
UserOutlined,
} from '@ant-design/icons';
import React from 'react';
export const ICON_MAP: Record<string, React.ReactNode> = {
home: <HomeOutlined />,
'info-c': <InfoCircleOutlined />,
user: <UserOutlined />,
team: <TeamOutlined />,
profile: <ProfileOutlined />,
'user-add': <UserAddOutlined />,
settings: <SettingOutlined />,
tool: <ToolOutlined />,
robot: <RobotOutlined />,
'app-store': <AppstoreOutlined />,
};
export function Icon({ name }: { name?: string }) {
if (!name) return null;
return ICON_MAP[name] || null;
}
export default Icon;
-21
View File
@@ -1,21 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import './iconfont.less'
const Iconfont = ({ type, colorful }) => {
if (colorful) {
return (<span
dangerouslySetInnerHTML={{
__html: `<svg class="colorful-icon" aria-hidden="true"><use xlink:href="#${type.startsWith('#') ? type.replace(/#/, '') : type}"></use></svg>`,
}}
/>)
}
return <i className={`antdadmin icon-${type}`} />
}
Iconfont.propTypes = {
type: PropTypes.string,
colorful: PropTypes.bool,
}
export default Iconfont
-8
View File
@@ -1,8 +0,0 @@
:global .colorful-icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
font-size: 16px;
}
-6
View File
@@ -1,6 +0,0 @@
{
"name": "Iconfont",
"version": "0.0.0",
"private": true,
"main": "./Iconfont.js"
}
-73
View File
@@ -1,73 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Breadcrumb, Icon } from 'antd'
import { Link } from 'react-router-dom'
import pathToRegexp from 'path-to-regexp'
import { queryArray } from 'utils'
import styles from './Bread.less'
const Bread = ({ menu, location }) => {
// 匹配当前路由
let pathArray = []
let current
for (let index in menu) {
if (menu[index].route && pathToRegexp(menu[index].route).exec(location.pathname)) {
current = menu[index]
break
}
}
const getPathArray = (item) => {
pathArray.unshift(item)
if (item.bpid) {
getPathArray(queryArray(menu, item.bpid, 'id'))
}
}
if (!current) {
pathArray.push(menu[0] || {
id: 1,
icon: 'laptop',
name: 'Dashboard',
})
pathArray.push({
id: 404,
name: 'Not Found',
})
} else {
getPathArray(current)
}
// 递归查找父级
const breads = pathArray.map((item, key) => {
const content = (
<span>{item.icon
? <Icon type={item.icon} style={{ marginRight: 4 }} />
: ''}{item.name}</span>
)
return (
<Breadcrumb.Item key={key}>
{((pathArray.length - 1) !== key)
? <Link to={item.route || '#'}>
{content}
</Link>
: content}
</Breadcrumb.Item>
)
})
return (
<div className={styles.bread}>
<Breadcrumb>
{breads}
</Breadcrumb>
</div>
)
}
Bread.propTypes = {
menu: PropTypes.array,
location: PropTypes.object,
}
export default Bread
-8
View File
@@ -1,8 +0,0 @@
@import "~themes/vars";
.bread {
height: 64px;
line-height: 64px;
padding: 0 24px;
margin-bottom: -24px;
}
-9
View File
@@ -1,9 +0,0 @@
import React from 'react'
import { config } from 'utils'
import styles from './Footer.less'
const Footer = () => (<div className={styles.footer}>
{config.footerText}
</div>)
export default Footer
-12
View File
@@ -1,12 +0,0 @@
@import "~themes/vars";
.footer {
height: 48px;
line-height: 48px;
text-align: center;
font-size: 12px;
color: #999;
background: #fff;
box-shadow: @shadow-2;
width: 100%;
}
-74
View File
@@ -1,74 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Menu, Icon, Popover } from 'antd'
import classnames from 'classnames'
import styles from './Header.less'
import Menus from './Menu'
const SubMenu = Menu.SubMenu
const Header = ({ user, logout, switchSider, siderFold, isNavbar, menuPopoverVisible, location, switchMenuPopover, navOpenKeys, changeOpenKeys, menu }) => {
let handleClickMenu = e => e.key === 'logout' && logout()
const menusProps = {
menu,
siderFold: false,
darkTheme: false,
isNavbar,
handleClickNavMenu: switchMenuPopover,
location,
navOpenKeys,
changeOpenKeys,
}
return (
<div className={styles.header}>
{isNavbar
? <Popover placement="bottomLeft" onVisibleChange={switchMenuPopover} visible={menuPopoverVisible} overlayClassName={styles.popovermenu} trigger="click" content={<Menus {...menusProps} />}>
<div className={styles.button}>
<Icon type="bars" />
</div>
</Popover>
: <div
className={styles.button}
onClick={switchSider}
>
<Icon type={classnames({ 'menu-unfold': siderFold, 'menu-fold': !siderFold })} />
</div>}
<div className={styles.rightWarpper}>
<div className={styles.button}>
<Icon type="mail" />
</div>
<Menu mode="horizontal" onClick={handleClickMenu}>
<SubMenu
style={{
float: 'right',
}}
title={<span>
<Icon type="user" />
{user.username}
</span>}
>
<Menu.Item key="logout">
Sign out
</Menu.Item>
</SubMenu>
</Menu>
</div>
</div>
)
}
Header.propTypes = {
menu: PropTypes.array,
user: PropTypes.object,
logout: PropTypes.func,
switchSider: PropTypes.func,
siderFold: PropTypes.bool,
isNavbar: PropTypes.bool,
menuPopoverVisible: PropTypes.bool,
location: PropTypes.object,
switchMenuPopover: PropTypes.func,
navOpenKeys: PropTypes.array,
changeOpenKeys: PropTypes.func,
}
export default Header
-59
View File
@@ -1,59 +0,0 @@
@import "~themes/vars";
.header {
:global .ant-menu-horizontal {
& > .ant-menu-submenu {
float: right;
}
border: none;
display: inline-block;
}
box-shadow: @shadow-2;
position: relative;
display: flex;
justify-content: space-between;
height: 47px;
background-color: #fff;
z-index: 999;
.rightWarpper {
display: flex;
padding-right: 16px;
}
.button {
width: 47px;
height: 47px;
line-height: 47px;
text-align: center;
font-size: 18px;
cursor: pointer;
transition: @transition-ease-in;
&:hover {
color: @primary-color;
background-color: fade(@primary-color, 15%);
}
}
}
.popovermenu {
width: 280px;
margin-left: 6px;
:global .ant-popover-inner-content {
padding: 0;
.ant-menu-inline .ant-menu-item,
.ant-menu-vertical .ant-menu-item {
border-right: 0;
height: 48px;
line-height: 48px;
}
.ant-menu-inline .ant-menu-item-selected,
.ant-menu-inline .ant-menu-selected {
border-right: 0;
}
}
}
-292
View File
@@ -1,292 +0,0 @@
@import "~themes/vars";
.layout {
position: relative;
height: 100vh;
&.withnavbar {
.main {
margin-left: 0;
}
}
&.fold {
.sider {
width: 42px;
.logo {
img {
width: 28px;
margin: 6px 7px;
}
}
:global {
.ant-menu-root {
width: 100%;
overflow: visible;
& > .ant-menu-item {
padding: 0;
text-align: center;
.anticon {
font-size: 14px;
margin-right: 0;
}
}
& > .ant-menu-submenu {
& > .ant-menu-submenu-title {
padding: 0;
text-align: center;
.anticon {
font-size: 14px;
margin-right: 0;
}
&::after {
display: none;
}
}
}
}
}
}
.main {
margin-left: 42px;
}
}
.sider {
width: 224px;
background: #3e3e3e;
position: absolute;
overflow: visible;
padding-bottom: 24px;
height: 100vh;
transition: @transition-ease-out;
box-shadow: @shadow-1;
color: #999;
&.light {
background: #fff;
.switchtheme {
background: #fff;
border-top: solid 1px #f8f8f8;
}
}
.logo {
text-align: center;
height: 40px;
line-height: 40px;
cursor: pointer;
margin: 28px 0;
transition: @transition-ease-out;
overflow: hidden;
img {
width: 40px;
margin-right: 8px;
transition: @transition-ease-out;
}
span {
vertical-align: text-bottom;
font-size: 16px;
text-transform: uppercase;
display: inline-block;
}
.anticon {
transition: @transition-ease-out;
}
}
.switchtheme {
width: 100%;
position: absolute;
bottom: 0;
height: 48px;
background-color: @dark-half;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 16px 0 24px;
overflow: hidden;
z-index: 1000;
span {
white-space: nowrap;
overflow: hidden;
}
:global {
.anticon {
min-width: 14px;
margin-right: 8px;
font-size: 14px;
}
}
}
:global {
.ant-menu-dark,
.ant-menu-dark .ant-menu-sub {
color: #999;
}
.ant-menu-root {
height: ~"calc(100vh - 144px)";
overflow-x: hidden;
border-right: none;
&::-webkit-scrollbar-thumb {
background-color: transparent;
}
&:hover {
&::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.2);
}
}
&.ant-menu-vertical {
.ant-menu-sub {
height: 0;
opacity: 0;
transition: none;
}
.ant-menu-submenu-active {
.ant-menu-sub {
height: auto;
opacity: 1;
}
}
}
}
.ant-menu {
transition: @transition-ease-out;
.ant-menu-item,
.ant-menu-submenu-title {
overflow: hidden;
white-space: normal;
}
}
}
}
.main {
margin-left: 224px;
overflow: auto;
height: 100vh;
transition: @transition-ease-out;
:global {
.content-inner {
background: #fff;
padding: 24px;
box-shadow: @shadow-1;
min-height: e("calc(100vh - 184px)");
}
}
.container {
margin: 24px;
}
.content {
min-height: e("calc(100vh - 184px)");
position: relative;
}
}
}
:global .ant-menu-dark {
color: #999;
background-color: #3e3e3e;
.ant-menu-submenu-title:hover,
.ant-menu-submenu:hover {
color: @primary-color;
}
.ant-menu-sub {
color: #999;
}
.ant-menu-submenu-selected {
color: @primary-color;
&:not(.ant-menu-submenu-open) {
background-color: @dark-half;
}
}
.ant-menu-item,
.ant-menu-submenu-title {
& > a {
color: #999;
}
&:hover > a {
color: @primary-color;
}
}
&.ant-menu-inline {
.ant-menu-item-selected {
background-color: @dark-half;
}
}
.ant-menu-item-selected {
color: @primary-color;
background-color: @dark-half;
& > a {
color: @primary-color;
}
&:hover {
background-color: @dark-half;
}
}
}
.spin {
:global .ant-spin-container {
height: 100vh;
}
}
@media (max-width: 767px) {
.layout {
.main {
.container {
margin: 12px;
}
.bread {
padding: 0 12px;
}
.content {
min-height: e("calc(100vh - 160px)");
}
:global {
.content-inner {
padding: 12px;
min-height: e("calc(100vh - 160px)");
}
}
}
}
}
-132
View File
@@ -1,132 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Menu, Icon } from 'antd'
import { Link } from 'react-router-dom'
import { arrayToTree, queryArray } from 'utils'
import pathToRegexp from 'path-to-regexp'
const Menus = ({ siderFold, darkTheme, handleClickNavMenu, navOpenKeys, changeOpenKeys, menu, location }) => {
// 生成树状
const menuTree = arrayToTree(menu.filter(_ => _.mpid !== '-1'), 'id', 'mpid')
const levelMap = {}
// 递归生成菜单
const getMenus = (menuTreeN, siderFoldN) => {
return menuTreeN.map((item) => {
if (item.children) {
if (item.mpid) {
levelMap[item.id] = item.mpid
}
return (
<Menu.SubMenu
key={item.id}
title={<span>
{item.icon && <Icon type={item.icon} />}
{(!siderFoldN || !menuTree.includes(item)) && item.name}
</span>}
>
{getMenus(item.children, siderFoldN)}
</Menu.SubMenu>
)
}
return (
<Menu.Item key={item.id}>
<Link to={item.route || '#'}>
{item.icon && <Icon type={item.icon} />}
{(!siderFoldN || !menuTree.includes(item)) && item.name}
</Link>
</Menu.Item>
)
})
}
const menuItems = getMenus(menuTree, siderFold)
// 保持选中
const getAncestorKeys = (key) => {
let map = {}
const getParent = (index) => {
const result = [String(levelMap[index])]
if (levelMap[result[0]]) {
result.unshift(getParent(result[0])[0])
}
return result
}
for (let index in levelMap) {
if ({}.hasOwnProperty.call(levelMap, index)) {
map[index] = getParent(index)
}
}
return map[key] || []
}
const onOpenChange = (openKeys) => {
const latestOpenKey = openKeys.find(key => !navOpenKeys.includes(key))
const latestCloseKey = navOpenKeys.find(key => !openKeys.includes(key))
let nextOpenKeys = []
if (latestOpenKey) {
nextOpenKeys = getAncestorKeys(latestOpenKey).concat(latestOpenKey)
}
if (latestCloseKey) {
nextOpenKeys = getAncestorKeys(latestCloseKey)
}
changeOpenKeys(nextOpenKeys)
}
let menuProps = !siderFold ? {
onOpenChange,
openKeys: navOpenKeys,
} : {}
// 寻找选中路由
let currentMenu
let defaultSelectedKeys
for (let item of menu) {
if (item.route && pathToRegexp(item.route).exec(location.pathname)) {
currentMenu = item
break
}
}
const getPathArray = (array, current, pid, id) => {
let result = [String(current[id])]
const getPath = (item) => {
if (item && item[pid]) {
result.unshift(String(item[pid]))
getPath(queryArray(array, item[pid], id))
}
}
getPath(current)
return result
}
if (currentMenu) {
defaultSelectedKeys = getPathArray(menu, currentMenu, 'mpid', 'id')
}
if (!defaultSelectedKeys) {
defaultSelectedKeys = ['1']
}
return (
<Menu
{...menuProps}
mode={siderFold ? 'vertical' : 'inline'}
theme={darkTheme ? 'dark' : 'light'}
onClick={handleClickNavMenu}
selectedKeys={defaultSelectedKeys}
>
{menuItems}
</Menu>
)
}
Menus.propTypes = {
menu: PropTypes.array,
siderFold: PropTypes.bool,
darkTheme: PropTypes.bool,
handleClickNavMenu: PropTypes.func,
navOpenKeys: PropTypes.array,
changeOpenKeys: PropTypes.func,
location: PropTypes.object,
}
export default Menus
-42
View File
@@ -1,42 +0,0 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Icon, Switch } from 'antd'
import { config } from 'utils'
import styles from './Layout.less'
import Menus from './Menu'
const Sider = ({ siderFold, darkTheme, location, changeTheme, navOpenKeys, changeOpenKeys, menu }) => {
const menusProps = {
menu,
siderFold,
darkTheme,
location,
navOpenKeys,
changeOpenKeys,
}
return (
<div>
<div className={styles.logo}>
<img alt={'logo'} src={config.logo} />
{siderFold ? '' : <span>{config.name}</span>}
</div>
<Menus {...menusProps} />
{!siderFold ? <div className={styles.switchtheme}>
<span><Icon type="bulb" />Switch Theme</span>
<Switch onChange={changeTheme} defaultChecked={darkTheme} checkedChildren="Dark" unCheckedChildren="Light" />
</div> : ''}
</div>
)
}
Sider.propTypes = {
menu: PropTypes.array,
siderFold: PropTypes.bool,
darkTheme: PropTypes.bool,
location: PropTypes.object,
changeTheme: PropTypes.func,
navOpenKeys: PropTypes.array,
changeOpenKeys: PropTypes.func,
}
export default Sider
-1
View File
@@ -1 +0,0 @@
@import "~themes/vars";

Some files were not shown because too many files have changed in this diff Show More