外汇后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.2 KiB

4 months ago
  1. # React Antd Admin 管理后台
  2. react + antd + typescript 集成轻量级管理后台
  3. ## 注意
  4. node version require 16.19.0
  5. 修改config中的配置 dev 测试,prod生成
  6. ## 功能
  7. - 多页标签
  8. - 动态权限
  9. - 主题配置
  10. ## 使用
  11. 用户名:admin 密码:123456
  12. ### 使用命令行
  13. ```bash
  14. npm install -g typescript
  15. yarn install
  16. yarn start
  17. cp env .env.development
  18. cp env .env.production
  19. ```
  20. ### Redux 的使用说明
  21. ```
  22. # 在/src/store/actionTypes/index1.tsx 定义新字段,格式如下
  23. export default {
  24. ...,
  25. SET_ACTION: {
  26. name: 'SET_ACTION',
  27. field: 'action'
  28. }
  29. }
  30. # 在/src/store/state/index1.tsx 也定义新字段,格式如下
  31. interface StoreState {
  32. ...;
  33. action: string;
  34. }
  35. const initState: StoreState = {
  36. ...,
  37. action: ''
  38. }
  39. # 在要使用的组件中
  40. import { connect } from 'react-redux'
  41. import * as actions from '@/store/actions'
  42. export default connect(
  43. (state) => state,
  44. actions
  45. )(ComponentName)
  46. # 然后在 props 就有 setStoreData 属性,可用来 dispatch
  47. setStoreData('SET_ACTION', '')
  48. # 只需要定义 type 和 state,不需要写每个action,效率提高了木有有!!!
  49. ```
  50. ### 路由/菜单配置
  51. ```
  52. # 所有路由写在 /src/route/routes.ts (包括菜单栏的路由)
  53. 用于路由权限控制
  54. # 左侧菜单路由写在 /src/config/menu.ts
  55. 仅用于菜单栏展示
  56. # 分两套的原因是,方便维护,如果不嫌麻烦,可以都写在 routes 里,用一个字段标识菜单路由即可
  57. ```
  58. ### 关于换肤配置
  59. > 本框架是使用 less.js 实现动态切换主题,js文件在 /public/less.min.js
  60. ```
  61. # 主题配置文件在 /public/color.less
  62. 引用了 antd 组件后,基本不需要自己额外自定义主题样式,因为主题文件里都有。
  63. 但是!!!
  64. 如果自己写了自定义组件,切换主题后样式显示不正常,
  65. 则需要自己在 color.less 底部添加深浅主题对应的样式,具体参考主题文件内额外配置。
  66. ```
  67. ```bash
  68. # 上传生产环境
  69. yarn deploy:prod:dc
  70. # 访问路径
  71. https://filefast.io/OTUxNDdiZW/#/login
  72. 上传命令:yarn deploy:prod:dc
  73. 代码路径:/data/wwwroot/admin-filefast
  74. 访问路径:
  75. https://filefast.io/OTUxNDdiZW/#/login
  76. ```