congmao-cli 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/README.md +2 -0
  2. package/bin/index.js +20 -0
  3. package/package.json +42 -0
  4. package/src/commands/create.js +171 -0
  5. package/src/commands/mcp.js +157 -0
  6. package/src/mcp/CURSOR_SETUP.md +259 -0
  7. package/src/mcp/README.md +134 -0
  8. package/src/mcp/USAGE_EXAMPLES.md +181 -0
  9. package/src/mcp/get-cursor-config.js +58 -0
  10. package/src/mcp/package.json +23 -0
  11. package/src/mcp/pnpm-lock.yaml +2441 -0
  12. package/src/mcp/src/handlers.js +211 -0
  13. package/src/mcp/src/http-server.js +332 -0
  14. package/src/mcp/src/index.js +195 -0
  15. package/src/mcp/src/schemas.js +54 -0
  16. package/src/mcp/test-create-project.js +49 -0
  17. package/src/mcp/test-mcp.js +89 -0
  18. package/src/mcp/test-show-tree.js +66 -0
  19. package/src/template/Uni-app/README.md +19 -0
  20. package/src/template/Uni-app/babel.config.js +81 -0
  21. package/src/template/Uni-app/package.json +107 -0
  22. package/src/template/Uni-app/postcss.config.js +27 -0
  23. package/src/template/Uni-app/public/index.html +25 -0
  24. package/src/template/Uni-app/shims-uni.d.ts +11 -0
  25. package/src/template/Uni-app/shims-vue.d.ts +4 -0
  26. package/src/template/Uni-app/src/App.vue +17 -0
  27. package/src/template/Uni-app/src/main.js +12 -0
  28. package/src/template/Uni-app/src/manifest.json +75 -0
  29. package/src/template/Uni-app/src/pages/index/index.vue +49 -0
  30. package/src/template/Uni-app/src/pages.json +16 -0
  31. package/src/template/Uni-app/src/static/logo.png +0 -0
  32. package/src/template/Uni-app/src/uni.promisify.adaptor.js +13 -0
  33. package/src/template/Uni-app/src/uni.scss +76 -0
  34. package/src/template/Uni-app/yarn.lock +11466 -0
  35. package/src/template/Vue2/.editorconfig +14 -0
  36. package/src/template/Vue2/.env +2 -0
  37. package/src/template/Vue2/.env.development +2 -0
  38. package/src/template/Vue2/.env.site +2 -0
  39. package/src/template/Vue2/.prettierrc.js +39 -0
  40. package/src/template/Vue2/.stylelintignore +8 -0
  41. package/src/template/Vue2/README-zh_CN.md +115 -0
  42. package/src/template/Vue2/commitlint.config.js +1 -0
  43. package/src/template/Vue2/docs/docs-starter.png +0 -0
  44. package/src/template/Vue2/docs/docs-startup.png +0 -0
  45. package/src/template/Vue2/docs/docs-structure.png +0 -0
  46. package/src/template/Vue2/globals.d.ts +13 -0
  47. package/src/template/Vue2/index.html +27 -0
  48. package/src/template/Vue2/jsx.d.ts +13 -0
  49. package/src/template/Vue2/mock/index.ts +147 -0
  50. package/src/template/Vue2/package.json +91 -0
  51. package/src/template/Vue2/package.json.ejs +91 -0
  52. package/src/template/Vue2/public/favicon.ico +0 -0
  53. package/src/template/Vue2/shims-vue.d.ts +5 -0
  54. package/src/template/Vue2/src/App.vue +19 -0
  55. package/src/template/Vue2/src/assets/assets-login-bg-black.png +0 -0
  56. package/src/template/Vue2/src/assets/assets-login-bg-white.png +0 -0
  57. package/src/template/Vue2/src/assets/assets-logo-full.svg +39 -0
  58. package/src/template/Vue2/src/assets/assets-product-1.svg +5 -0
  59. package/src/template/Vue2/src/assets/assets-product-2.svg +5 -0
  60. package/src/template/Vue2/src/assets/assets-product-3.svg +5 -0
  61. package/src/template/Vue2/src/assets/assets-product-4.svg +5 -0
  62. package/src/template/Vue2/src/assets/assets-result-403.svg +32 -0
  63. package/src/template/Vue2/src/assets/assets-result-404.svg +36 -0
  64. package/src/template/Vue2/src/assets/assets-result-500.svg +32 -0
  65. package/src/template/Vue2/src/assets/assets-result-ie.svg +33 -0
  66. package/src/template/Vue2/src/assets/assets-result-maintenance.svg +49 -0
  67. package/src/template/Vue2/src/assets/assets-result-wifi.svg +23 -0
  68. package/src/template/Vue2/src/assets/assets-setting-auto.svg +13 -0
  69. package/src/template/Vue2/src/assets/assets-setting-dark.svg +5 -0
  70. package/src/template/Vue2/src/assets/assets-setting-light.svg +13 -0
  71. package/src/template/Vue2/src/assets/assets-t-logo.svg +41 -0
  72. package/src/template/Vue2/src/assets/assets-tencent-logo.png +0 -0
  73. package/src/template/Vue2/src/components/color/index.vue +35 -0
  74. package/src/template/Vue2/src/components/product-card/index.vue +121 -0
  75. package/src/template/Vue2/src/components/result/index.vue +118 -0
  76. package/src/template/Vue2/src/components/thumbnail/index.vue +49 -0
  77. package/src/template/Vue2/src/components/trend/index.vue +105 -0
  78. package/src/template/Vue2/src/config/color.ts +30 -0
  79. package/src/template/Vue2/src/config/global.ts +2 -0
  80. package/src/template/Vue2/src/config/host.ts +26 -0
  81. package/src/template/Vue2/src/config/style.ts +14 -0
  82. package/src/template/Vue2/src/constants/index.ts +46 -0
  83. package/src/template/Vue2/src/interface.ts +39 -0
  84. package/src/template/Vue2/src/layouts/blank.vue +12 -0
  85. package/src/template/Vue2/src/layouts/components/Breadcrumb.vue +39 -0
  86. package/src/template/Vue2/src/layouts/components/Content.vue +43 -0
  87. package/src/template/Vue2/src/layouts/components/Footer.vue +27 -0
  88. package/src/template/Vue2/src/layouts/components/Header.vue +321 -0
  89. package/src/template/Vue2/src/layouts/components/LayoutContent.vue +168 -0
  90. package/src/template/Vue2/src/layouts/components/LayoutHeader.vue +52 -0
  91. package/src/template/Vue2/src/layouts/components/LayoutSidebar.vue +51 -0
  92. package/src/template/Vue2/src/layouts/components/MenuContent.vue +108 -0
  93. package/src/template/Vue2/src/layouts/components/Notice.vue +221 -0
  94. package/src/template/Vue2/src/layouts/components/Search.vue +134 -0
  95. package/src/template/Vue2/src/layouts/components/SideNav.vue +150 -0
  96. package/src/template/Vue2/src/layouts/index.vue +100 -0
  97. package/src/template/Vue2/src/layouts/setting.vue +404 -0
  98. package/src/template/Vue2/src/main.js +9 -0
  99. package/src/template/Vue2/src/main.jsx +51 -0
  100. package/src/template/Vue2/src/pages/dashboard/base/components/MiddleChart.vue +158 -0
  101. package/src/template/Vue2/src/pages/dashboard/base/components/OutputOverview.vue +189 -0
  102. package/src/template/Vue2/src/pages/dashboard/base/components/RankList.vue +111 -0
  103. package/src/template/Vue2/src/pages/dashboard/base/components/TopPanel.vue +246 -0
  104. package/src/template/Vue2/src/pages/dashboard/base/index.ts +702 -0
  105. package/src/template/Vue2/src/pages/dashboard/base/index.vue +44 -0
  106. package/src/template/Vue2/src/pages/dashboard/detail/index.ts +267 -0
  107. package/src/template/Vue2/src/pages/dashboard/detail/index.vue +242 -0
  108. package/src/template/Vue2/src/pages/detail/advanced/components/Product.vue +167 -0
  109. package/src/template/Vue2/src/pages/detail/advanced/index.less +74 -0
  110. package/src/template/Vue2/src/pages/detail/advanced/index.vue +219 -0
  111. package/src/template/Vue2/src/pages/detail/base/index.less +105 -0
  112. package/src/template/Vue2/src/pages/detail/base/index.vue +46 -0
  113. package/src/template/Vue2/src/pages/detail/deploy/index.ts +204 -0
  114. package/src/template/Vue2/src/pages/detail/deploy/index.vue +224 -0
  115. package/src/template/Vue2/src/pages/detail/secondary/index.less +71 -0
  116. package/src/template/Vue2/src/pages/detail/secondary/index.vue +131 -0
  117. package/src/template/Vue2/src/pages/form/base/index.less +57 -0
  118. package/src/template/Vue2/src/pages/form/base/index.vue +254 -0
  119. package/src/template/Vue2/src/pages/form/step/index.less +37 -0
  120. package/src/template/Vue2/src/pages/form/step/index.vue +259 -0
  121. package/src/template/Vue2/src/pages/frame/doc/index.vue +86 -0
  122. package/src/template/Vue2/src/pages/frame/tdesign/index.vue +86 -0
  123. package/src/template/Vue2/src/pages/list/base/index.vue +267 -0
  124. package/src/template/Vue2/src/pages/list/card/index.vue +221 -0
  125. package/src/template/Vue2/src/pages/list/components/CommonTable.vue +313 -0
  126. package/src/template/Vue2/src/pages/list/filter/index.vue +15 -0
  127. package/src/template/Vue2/src/pages/list/tree/index.vue +174 -0
  128. package/src/template/Vue2/src/pages/login/components/components-header.vue +74 -0
  129. package/src/template/Vue2/src/pages/login/components/components-login.vue +154 -0
  130. package/src/template/Vue2/src/pages/login/components/components-register.vue +144 -0
  131. package/src/template/Vue2/src/pages/login/index.less +202 -0
  132. package/src/template/Vue2/src/pages/login/index.vue +53 -0
  133. package/src/template/Vue2/src/pages/nest-menu/Index.vue +10 -0
  134. package/src/template/Vue2/src/pages/result/403/index.vue +14 -0
  135. package/src/template/Vue2/src/pages/result/404/index.vue +14 -0
  136. package/src/template/Vue2/src/pages/result/500/index.vue +14 -0
  137. package/src/template/Vue2/src/pages/result/browser-incompatible/index.vue +77 -0
  138. package/src/template/Vue2/src/pages/result/fail/index.vue +57 -0
  139. package/src/template/Vue2/src/pages/result/maintenance/index.vue +14 -0
  140. package/src/template/Vue2/src/pages/result/network-error/index.vue +24 -0
  141. package/src/template/Vue2/src/pages/result/success/index.vue +59 -0
  142. package/src/template/Vue2/src/pages/user/index.less +148 -0
  143. package/src/template/Vue2/src/pages/user/index.ts +157 -0
  144. package/src/template/Vue2/src/pages/user/index.vue +204 -0
  145. package/src/template/Vue2/src/permission.js +56 -0
  146. package/src/template/Vue2/src/router/index.js +43 -0
  147. package/src/template/Vue2/src/router/modules/base.ts +29 -0
  148. package/src/template/Vue2/src/router/modules/components.ts +175 -0
  149. package/src/template/Vue2/src/router/modules/others.ts +55 -0
  150. package/src/template/Vue2/src/service/service-advance.ts +233 -0
  151. package/src/template/Vue2/src/service/service-base.ts +205 -0
  152. package/src/template/Vue2/src/service/service-detail-base.ts +84 -0
  153. package/src/template/Vue2/src/service/service-detail-deploy.ts +234 -0
  154. package/src/template/Vue2/src/service/service-detail.ts +57 -0
  155. package/src/template/Vue2/src/service/service-user.ts +64 -0
  156. package/src/template/Vue2/src/store/index.ts +22 -0
  157. package/src/template/Vue2/src/store/modules/notification.ts +90 -0
  158. package/src/template/Vue2/src/store/modules/permission.ts +66 -0
  159. package/src/template/Vue2/src/store/modules/setting.ts +122 -0
  160. package/src/template/Vue2/src/store/modules/tab-router.ts +83 -0
  161. package/src/template/Vue2/src/store/modules/user.ts +98 -0
  162. package/src/template/Vue2/src/style/font-family.less +6 -0
  163. package/src/template/Vue2/src/style/index.less +5 -0
  164. package/src/template/Vue2/src/style/layout.less +201 -0
  165. package/src/template/Vue2/src/style/reset.less +78 -0
  166. package/src/template/Vue2/src/style/variables.less +27 -0
  167. package/src/template/Vue2/src/utils/charts.ts +38 -0
  168. package/src/template/Vue2/src/utils/color.ts +118 -0
  169. package/src/template/Vue2/src/utils/date.ts +12 -0
  170. package/src/template/Vue2/src/utils/request.ts +60 -0
  171. package/src/template/Vue2/stylelint.config.js +5 -0
  172. package/src/template/Vue2/tsconfig.json +26 -0
  173. package/src/template/Vue2/vite.config.js +58 -0
  174. package/src/template/Vue3/package.json.ejs +8 -0
  175. package/src/template/Vue3/pages.json +10 -0
  176. package/src/template/Vue3/src/main.js +7 -0
  177. package/src/utils/copy.js +17 -0
  178. package/src/utils/eslint.js +205 -0
  179. package/src/utils/logo.js +18 -0
  180. package/src/utils/render.js +20 -0
@@ -0,0 +1,90 @@
1
+ export interface msgDataItem {
2
+ id: string;
3
+ content: string;
4
+ type: string;
5
+ status: boolean;
6
+ collected: boolean;
7
+ date: string;
8
+ quality: string;
9
+ }
10
+ // 定义的state初始值
11
+ const state: { msgData: Array<msgDataItem> } = {
12
+ msgData: [
13
+ {
14
+ id: '123',
15
+ content: '腾讯大厦一楼改造施工项目 已通过审核!',
16
+ type: '合同动态',
17
+ status: true,
18
+ collected: false,
19
+ date: '2021-01-01 08:00',
20
+ quality: 'high',
21
+ },
22
+ {
23
+ id: '124',
24
+ content: '三季度生产原材料采购项目 开票成功!',
25
+ type: '票务动态',
26
+ status: true,
27
+ collected: false,
28
+ date: '2021-01-01 08:00',
29
+ quality: 'low',
30
+ },
31
+ {
32
+ id: '125',
33
+ content: '2021-01-01 10:00的【国家电网线下签约】会议即将开始,请提前10分钟前往 会议室1 进行签到!',
34
+ type: '会议通知',
35
+ status: true,
36
+ collected: false,
37
+ date: '2021-01-01 08:00',
38
+ quality: 'middle',
39
+ },
40
+ {
41
+ id: '126',
42
+ content: '一季度生产原材料采购项目 开票成功!',
43
+ type: '票务动态',
44
+ status: true,
45
+ collected: false,
46
+ date: '2021-01-01 08:00',
47
+ quality: 'low',
48
+ },
49
+ {
50
+ id: '127',
51
+ content: '二季度生产原材料采购项目 开票成功!',
52
+ type: '票务动态',
53
+ status: true,
54
+ collected: false,
55
+ date: '2021-01-01 08:00',
56
+ quality: 'low',
57
+ },
58
+ {
59
+ id: '128',
60
+ content: '三季度生产原材料采购项目 开票成功!',
61
+ type: '票务动态',
62
+ status: true,
63
+ collected: false,
64
+ date: '2021-01-01 08:00',
65
+ quality: 'low',
66
+ },
67
+ ],
68
+ };
69
+
70
+ const mutations = {
71
+ setMsgData(state, data) {
72
+ // eslint-disable-next-line no-param-reassign
73
+ state.msgData = data;
74
+ },
75
+ };
76
+
77
+ const getters = {
78
+ unreadMsg: (state) => state.msgData.filter((item) => item.status),
79
+ readMsg: (state) => state.msgData.filter((item) => !item.status),
80
+ };
81
+
82
+ const actions = {};
83
+
84
+ export default {
85
+ namespaced: true,
86
+ state,
87
+ mutations,
88
+ actions,
89
+ getters,
90
+ };
@@ -0,0 +1,66 @@
1
+ import { resetRouter, asyncRouterList } from '@/router';
2
+
3
+ function filterPermissionsRouters(routes, roles) {
4
+ const res = [];
5
+ routes.forEach((route) => {
6
+ const children = [];
7
+ route.children?.forEach((childRouter) => {
8
+ const roleCode = childRouter.meta?.roleCode || childRouter.name;
9
+ if (roles.indexOf(roleCode) !== -1) {
10
+ children.push(childRouter);
11
+ }
12
+ });
13
+ if (children.length > 0) {
14
+ route.children = children;
15
+ res.push(route);
16
+ }
17
+ });
18
+ return res;
19
+ }
20
+
21
+ const state = {
22
+ whiteListRouters: ['/login'],
23
+ routers: [],
24
+ };
25
+
26
+ const mutations = {
27
+ setRouters: (state, routers) => {
28
+ state.routers = routers;
29
+ },
30
+ };
31
+
32
+ const getters = {
33
+ routers: (state) => state.routers,
34
+ whiteListRouters: (state) => state.whiteListRouters,
35
+ };
36
+
37
+ const actions = {
38
+ async initRoutes({ commit }, roles) {
39
+ let accessedRouters;
40
+
41
+ // special token
42
+ if (roles.includes('ALL_ROUTERS')) {
43
+ accessedRouters = asyncRouterList;
44
+ } else {
45
+ accessedRouters = filterPermissionsRouters(asyncRouterList, roles);
46
+ }
47
+
48
+ commit('setRouters', accessedRouters);
49
+
50
+ // register routers
51
+ // router.addRoutes(state.routers);
52
+ },
53
+ async restore({ commit }) {
54
+ // remove routers
55
+ resetRouter();
56
+ commit('setRouters', []);
57
+ },
58
+ };
59
+
60
+ export default {
61
+ namespaced: true,
62
+ state,
63
+ mutations,
64
+ actions,
65
+ getters,
66
+ };
@@ -0,0 +1,122 @@
1
+ /* eslint-disable no-param-reassign */
2
+ import { Color } from 'tvision-color';
3
+ import STYLE_CONFIG from '@/config/style';
4
+ import { TColorSeries, TColorToken, LIGHT_CHART_COLORS, DARK_CHART_COLORS } from '@/config/color';
5
+ import { insertThemeStylesheet, generateColorMap } from '@/utils/color';
6
+
7
+ // 定义的state初始值
8
+ const state = {
9
+ ...STYLE_CONFIG,
10
+ showSettingPanel: false,
11
+ colorList: {},
12
+ chartColors: LIGHT_CHART_COLORS,
13
+ };
14
+
15
+ type IInitStateType = typeof state;
16
+
17
+ export interface IStateType extends IInitStateType {
18
+ isAsideFooter: boolean;
19
+ showSettingPanel: boolean;
20
+ }
21
+
22
+ // 定义的state的初始值方法,传入state或者额外的方法,然后利用 vuex 的双向数据驱动进行值的改变
23
+ // 可通过this.$store.commit(' ')调用,但是触发的是同步事件
24
+ const mutations = {
25
+ update(state: IStateType, payload: IStateType) {
26
+ state.showBreadcrumb = payload.showBreadcrumb;
27
+ state.mode = payload.mode;
28
+ state.layout = payload.layout;
29
+ state.isSidebarCompact = payload.isSidebarCompact;
30
+ state.splitMenu = payload.splitMenu;
31
+ state.isFooterAside = payload.isFooterAside;
32
+ state.isSidebarFixed = payload.isSidebarFixed;
33
+ state.isHeaderFixed = payload.isHeaderFixed;
34
+ state.showHeader = payload.showHeader;
35
+ state.showFooter = payload.showFooter;
36
+ state.backgroundTheme = payload.backgroundTheme;
37
+ state.brandTheme = payload.brandTheme;
38
+ state.isUseTabsRouter = payload.isUseTabsRouter;
39
+ },
40
+ toggleSidebarCompact(state: IStateType) {
41
+ state.isSidebarCompact = !state.isSidebarCompact;
42
+ },
43
+ toggleUseTabsRouter(state: IStateType) {
44
+ state.isUseTabsRouter = !state.isUseTabsRouter;
45
+ },
46
+ showSidebarCompact(state: IStateType, payload: boolean) {
47
+ state.isSidebarCompact = payload;
48
+ },
49
+ toggleSettingPanel(state: IStateType, payload: boolean) {
50
+ state.showSettingPanel = payload;
51
+ },
52
+ addColor(state: IStateType, payload: TColorSeries) {
53
+ state.colorList = { ...state.colorList, ...payload };
54
+ },
55
+ changeChartColor(state: IStateType, payload: TColorToken) {
56
+ state.chartColors = { ...payload };
57
+ },
58
+ };
59
+
60
+ const getters = {
61
+ showHeader: (state: IStateType) => state.showHeader,
62
+ showSidebar: (state: IStateType) => state.layout !== 'top',
63
+ showSidebarLogo: (state: IStateType) => state.layout === 'side',
64
+ showHeaderLogo: (state: IStateType) => state.layout !== 'side',
65
+ showFooter: (state: IStateType) => state.showFooter,
66
+ isUseTabsRouter: (state: IStateType) => state.isUseTabsRouter,
67
+ mode: (state: IStateType) => {
68
+ if (state.mode === 'auto') {
69
+ const media = window.matchMedia('(prefers-color-scheme:dark)');
70
+ if (media.matches) {
71
+ return 'dark';
72
+ }
73
+ return 'light';
74
+ }
75
+ return state.mode;
76
+ },
77
+ };
78
+
79
+ const actions = {
80
+ changeTheme({ commit, dispatch }, payload: IStateType) {
81
+ dispatch('changeMode', payload);
82
+ dispatch('changeBrandTheme', payload);
83
+ commit('update', payload);
84
+ },
85
+ changeMode({ commit }, payload: IStateType) {
86
+ let theme = payload.mode;
87
+ if (payload.mode === 'auto') {
88
+ const media = window.matchMedia('(prefers-color-scheme:dark)');
89
+ if (media.matches) {
90
+ theme = 'dark';
91
+ } else {
92
+ theme = 'light';
93
+ }
94
+ }
95
+ const isDarkMode = theme === 'dark';
96
+
97
+ document.documentElement.setAttribute('theme-mode', isDarkMode ? 'dark' : '');
98
+
99
+ commit('changeChartColor', isDarkMode ? DARK_CHART_COLORS : LIGHT_CHART_COLORS);
100
+ },
101
+ changeBrandTheme(_: { state: IStateType }, payload: IStateType) {
102
+ const { brandTheme, mode } = payload;
103
+ const { colors: newPalette, primary: brandColorIndex } = Color.getColorGradations({
104
+ colors: [brandTheme],
105
+ step: 10,
106
+ remainInput: false, // 是否保留输入 不保留会矫正不合适的主题色
107
+ })[0];
108
+ const colorMap = generateColorMap(brandTheme, newPalette, mode as 'light' | 'dark', brandColorIndex);
109
+
110
+ insertThemeStylesheet(brandTheme, colorMap, mode as 'light' | 'dark');
111
+
112
+ document.documentElement.setAttribute('theme-color', brandTheme);
113
+ },
114
+ };
115
+
116
+ export default {
117
+ namespaced: true,
118
+ state,
119
+ mutations,
120
+ actions,
121
+ getters,
122
+ };
@@ -0,0 +1,83 @@
1
+ export type TRouterInfo = {
2
+ path: string;
3
+ routeIdx: number;
4
+ title: string;
5
+ name?: string;
6
+ isAlive?: boolean;
7
+ isHome?: boolean;
8
+ };
9
+
10
+ export type TTabRouterType = {
11
+ isRefreshing: boolean;
12
+ tabRouterList: Array<TRouterInfo>;
13
+ };
14
+
15
+ const homeRoute: Array<TRouterInfo> = [
16
+ {
17
+ path: '/dashboard/base',
18
+ routeIdx: 0,
19
+ title: '仪表盘',
20
+ name: 'DashboardBase',
21
+ isHome: true,
22
+ },
23
+ ];
24
+
25
+ const state: TTabRouterType = {
26
+ tabRouterList: homeRoute,
27
+ isRefreshing: false,
28
+ };
29
+
30
+ const mutations = {
31
+ // 处理刷新
32
+ toggleTabRouterAlive(state: TTabRouterType, routeIdx: number) {
33
+ state.isRefreshing = !state.isRefreshing;
34
+ state.tabRouterList[routeIdx].isAlive = !state.tabRouterList[routeIdx].isAlive;
35
+ },
36
+ // 处理新增
37
+ appendTabRouterList(state: TTabRouterType, newRoute: TRouterInfo) {
38
+ if (!state.tabRouterList.find((route: TRouterInfo) => route.path === newRoute.path))
39
+ // eslint-disable-next-line no-param-reassign
40
+ state.tabRouterList = state.tabRouterList.concat({ ...newRoute, isAlive: true });
41
+ },
42
+ // 处理关闭当前
43
+ subtractCurrentTabRouter(state: TTabRouterType, newRoute: TRouterInfo) {
44
+ const { routeIdx } = newRoute;
45
+ state.tabRouterList = state.tabRouterList.slice(0, routeIdx).concat(state.tabRouterList.slice(routeIdx + 1));
46
+ },
47
+ // 处理关闭右侧
48
+ subtractTabRouterBehind(state: TTabRouterType, newRoute: TRouterInfo) {
49
+ const { routeIdx } = newRoute;
50
+ state.tabRouterList = state.tabRouterList.slice(0, routeIdx + 1);
51
+ },
52
+ // 处理关闭左侧
53
+ subtractTabRouterAhead(state: TTabRouterType, newRoute: TRouterInfo) {
54
+ const { routeIdx } = newRoute;
55
+ state.tabRouterList = homeRoute.concat(state.tabRouterList.slice(routeIdx));
56
+ },
57
+ // 处理关闭其他
58
+ subtractTabRouterOther(state: TTabRouterType, newRoute: TRouterInfo) {
59
+ const { routeIdx } = newRoute;
60
+ state.tabRouterList = homeRoute.concat([state.tabRouterList?.[routeIdx]]);
61
+ },
62
+ removeTabRouterList() {
63
+ state.tabRouterList = [];
64
+ },
65
+ initTabRouterList(state: TTabRouterType, newRoute: TRouterInfo[]) {
66
+ state.tabRouterList = newRoute;
67
+ },
68
+ };
69
+
70
+ const getters = {
71
+ tabRouterList: (state: TTabRouterType) => state.tabRouterList,
72
+ isRefreshing: (state: TTabRouterType) => state.isRefreshing,
73
+ };
74
+
75
+ const actions = {};
76
+
77
+ export default {
78
+ namespaced: true,
79
+ state,
80
+ mutations,
81
+ actions,
82
+ getters,
83
+ };
@@ -0,0 +1,98 @@
1
+ import { TOKEN_NAME } from '@/config/global';
2
+
3
+ const InitUserInfo = {
4
+ roles: [],
5
+ };
6
+
7
+ // 定义的state初始值
8
+ const state = {
9
+ token: localStorage.getItem(TOKEN_NAME) || 'main_token', // 默认token不走权限
10
+ userInfo: InitUserInfo,
11
+ };
12
+
13
+ const mutations = {
14
+ setToken(state, token) {
15
+ localStorage.setItem(TOKEN_NAME, token);
16
+ state.token = token;
17
+ },
18
+ removeToken(state) {
19
+ localStorage.removeItem(TOKEN_NAME);
20
+ state.token = '';
21
+ },
22
+ setUserInfo(state, userInfo) {
23
+ state.userInfo = userInfo;
24
+ },
25
+ };
26
+
27
+ const getters = {
28
+ token: (state) => state.token,
29
+ roles: (state) => state.userInfo?.roles,
30
+ };
31
+
32
+ const actions = {
33
+ async login({ commit }, userInfo) {
34
+ const mockLogin = async (userInfo) => {
35
+ // 登录请求流程
36
+ console.log(userInfo);
37
+ // const { account, password } = userInfo;
38
+ // if (account !== 'td') {
39
+ // return {
40
+ // code: 401,
41
+ // message: '账号不存在',
42
+ // };
43
+ // }
44
+ // if (['main_', 'dev_'].indexOf(password) === -1) {
45
+ // return {
46
+ // code: 401,
47
+ // message: '密码错误',
48
+ // };
49
+ // }
50
+ // const token = {
51
+ // main_: 'main_token',
52
+ // dev_: 'dev_token',
53
+ // }[password];
54
+ return {
55
+ code: 200,
56
+ message: '登陆成功',
57
+ data: 'main_token',
58
+ };
59
+ };
60
+
61
+ const res = await mockLogin(userInfo);
62
+ if (res.code === 200) {
63
+ commit('setToken', res.data);
64
+ } else {
65
+ throw res;
66
+ }
67
+ },
68
+ async getUserInfo({ commit, state }) {
69
+ const mockRemoteUserInfo = async (token) => {
70
+ if (token === 'main_token') {
71
+ return {
72
+ name: 'td_main',
73
+ roles: ['ALL_ROUTERS'],
74
+ };
75
+ }
76
+ return {
77
+ name: 'td_dev',
78
+ roles: ['UserIndex', 'DashboardBase', 'login'],
79
+ };
80
+ };
81
+
82
+ const res = await mockRemoteUserInfo(state.token);
83
+
84
+ commit('setUserInfo', res);
85
+ },
86
+ async logout({ commit }) {
87
+ commit('removeToken');
88
+ commit('setUserInfo', InitUserInfo);
89
+ },
90
+ };
91
+
92
+ export default {
93
+ namespaced: true,
94
+ state,
95
+ mutations,
96
+ actions,
97
+ getters,
98
+ };
@@ -0,0 +1,6 @@
1
+ @font-face {
2
+ font-family: 'TencentSansW7';
3
+ src: url('data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAusAA4AAAAAEJQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAALkAAAABwAAAAchqPqzUdERUYAAAtwAAAAHgAAAB4AKQAbT1MvMgAAAbgAAABZAAAAYGmceoNjbWFwAAACYAAAAJcAAAHsPmfPZmdhc3AAAAtkAAAADAAAAAwACAAbZ2x5ZgAAAywAAAW8AAAG/Ivn/ztoZWFkAAABRAAAADYAAAA2E+AL5GhoZWEAAAF8AAAAIAAAACQIawJ9aG10eAAAAhQAAABMAAAATCG/Auxsb2NhAAADAAAAACwAAAAsDjIQIm1heHAAAAGcAAAAGgAAACAAfgBDbmFtZQAACOgAAAIUAAAEm0zGvtJwb3N0AAAK/AAAAGYAAAB/4wuGdnByZXAAAAL4AAAACAAAAAhwAgESAAEAAAABBR/xlpGAXw889QALA+gAAAAA2Ac3gwAAAADY+IxB//L/HAPPAwAAAAAIAAIAAAAAAAB42mNgZGBgWf7vFAMD84v/n/7vZD7PABRBAYIAwxQH7XjaY2BkYGAQZXBiYGEAAUYGGEiBUAAMEQDCAAB42mNgYepm2sPAysDA1MUUwcDA4A2hGeMYjBjNgKI8HMxMTCz8TCwLGJj2CzCAgRiI8PX382d0YGBMEmQ2+u/FcIJlOVA9CwMjSI6JlekwkFJgYAQAR1kL+QAAAAJYAHYAAAAAAU0AAAEEAAACUAAhAlYAFQJUACACKgAdAZUANgEUABUBYAAkA5wAFQINABsBqAA0AnAAKgJYACoD6ACF//YANP/yACN42mNgYGBmgGAZBkYGEHgG5DGC+SwMp4C0HIMAUISPQYEhiSGNIZMhl6GUoZJhgeIkfS6/N4GpQQuSBP//B+tMZEgByucwFGOT/7/4/6L/C/7P+z/z/7T/yffqLrJvVFu3Zm3xPJBtcgz4ADPFkIGRDWgMIcBAIWBhZWBj52Bg4GRg4OIGi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gu76qrvqqpqoAPMQ3KMy+A3wMWOGBehRwAy31LOAIayoPuEmfdwEv4Z76HPAy7quvAbfwqvEz4BXcjd4EvIpG9J5sqnmH2gfP7LDCOn4E3CD/04AjtNXzgJtYV68DXsJj9SngZTxRXwJu4XtDBbyCtehlwKtoRm8xQIlzTGGRIcUINQRXPH100cMOtgLape0QBgVif9dBjxlTkCPnSckj2MCQNudzGeQmrS5PB22ifcYmxII9RuWUf3JXXjOUhvKCt/PEoDyf2iwd1XIl/W5vZ4vXrhyaIjZFTRmPijIv06lsDEemuOTZlEHZact+nXRkL8/FR1diTWXshUnIefNnhtCULv0Rtvk4ox7qopKjbbcNhhVOWK1mXTgw6STX9t8kMh91k1RuRfJXJS98Zyp2rKSbcDIdzqfPB2OrrCyk1+n2F3HOMzrC+aFmPrcOg0i9XvukbhhCbPmaUBv73zqjrcTJf1gPV7PL6PK4yGN6L6oq882IvaWm/0w/ZfOt9014x3yZta1yS/V7fbJKNBcjzaraWJNIbXVixtqeSXly6x3TRSJjPZVjc50qKyQ2ttaUpxObVUkW15xRtXD9rg8Hs3FxRr8ATJnl93jaY2BiAIP/zQxGDNiAKBAzMjAxMjG4MLgyuDN4MHgy+DD4MwQwhDGEM0QwxDAyM7IwsjKyMbKzl+ZlGhgYGHIlFhXllxdlpmeUgISM3AwcQbSJq6sziDY1cjQA0WZGhoYAgBwU3AAAAAEAAgAIAAr//wAPAAEAAAAMAAAAFgAAAAIAAQADABQAAQAEAAAAAgAAAAAAAAABAAAAANWkJwgAAAAA2Ac3gwAAAADY+IxB') format('woff');
4
+ font-weight: normal;
5
+ font-style: normal;
6
+ }
@@ -0,0 +1,5 @@
1
+ @import './variables.less';
2
+
3
+ @import './font-family.less';
4
+
5
+ @import './reset.less';
@@ -0,0 +1,201 @@
1
+ @import './variables.less';
2
+ @import './font-family.less';
3
+
4
+ // layout rewrite
5
+
6
+ .t-layout__sider {
7
+ width: fit-content;
8
+ }
9
+
10
+ .t-layout__header {
11
+ height: auto;
12
+ }
13
+
14
+ .t-layout.t-layout--with-sider {
15
+ > .t-layout {
16
+ flex: 1;
17
+ min-width: 760px;
18
+ }
19
+ }
20
+
21
+ .t-layout.t-layout--with-sider {
22
+ > .t-layout__content {
23
+ flex: 1;
24
+ min-width: 760px;
25
+ }
26
+ }
27
+
28
+ .t-menu--dark .t-menu__operations .t-icon {
29
+ color: rgba(255, 255, 255, 0.55);
30
+ &:hover {
31
+ cursor: pointer;
32
+ }
33
+ }
34
+ .t-default-menu.t-menu--dark {
35
+ background: var(--td-gray-color-13);
36
+ }
37
+ .t-default-menu:not(.t-menu--dark) .t-menu__item.t-is-active:not(.t-is-opened) {
38
+ background-color: var(--td-brand-color-1);
39
+ color: var(--td-brand-color);
40
+ .t-icon {
41
+ color: var(--td-brand-color);
42
+ }
43
+ }
44
+
45
+ .t-alert--info {
46
+ background-color: var(--td-brand-color-1);
47
+ }
48
+
49
+ .@{starter-prefix} {
50
+ // 布局元素调整
51
+ &-wrapper {
52
+ height: 100vh;
53
+ display: flex;
54
+ flex-direction: column;
55
+ }
56
+
57
+ &-main-wrapper {
58
+ height: 500px;
59
+ overflow: scroll;
60
+ }
61
+
62
+ &-side-nav-layout {
63
+ &-relative {
64
+ height: 100%;
65
+ }
66
+ }
67
+
68
+ &-content-layout {
69
+ padding: var(--td-comp-paddingTB-xl) var(--td-comp-paddingLR-xl);
70
+ }
71
+
72
+ &-layout {
73
+ height: calc(100vh - var(--td-comp-size-xxxl));
74
+ overflow-y: scroll;
75
+
76
+ &-tabs-nav {
77
+ max-width: 100%;
78
+ position: fixed;
79
+ overflow: visible;
80
+ z-index: 100;
81
+ }
82
+ &-tabs-nav + .@{starter-prefix}-content-layout {
83
+ padding-top: var(--td-comp-paddingTB-xl);
84
+ }
85
+
86
+ &::-webkit-scrollbar {
87
+ width: 8px;
88
+ background: transparent;
89
+ }
90
+
91
+ &::-webkit-scrollbar-thumb {
92
+ border-radius: 6px;
93
+ border: 2px solid transparent;
94
+ background-clip: content-box;
95
+ background-color: var(--td-scrollbar-color);
96
+ }
97
+ }
98
+
99
+ &-footer-layout {
100
+ padding: 0;
101
+ margin-bottom: var(--td-comp-margin-l);
102
+ }
103
+
104
+ // slideBar
105
+ &-sidebar-layout {
106
+ height: 100%;
107
+ }
108
+
109
+ &-sidebar-compact {
110
+ width: var(--td-comp-size-xxxl);
111
+ }
112
+
113
+ &-sidebar-layout-side {
114
+ z-index: 100;
115
+ }
116
+
117
+ &-side-nav {
118
+ position: fixed;
119
+ top: 0;
120
+ bottom: 0;
121
+ z-index: 200;
122
+ transition: all 0.3s;
123
+ min-height: 100%;
124
+
125
+ &-mix {
126
+ top: var(--td-comp-size-xxxl);
127
+
128
+ &-fixed {
129
+ top: var(--td-comp-size-xxxl);
130
+ z-index: 0;
131
+ }
132
+ }
133
+
134
+ &-no-fixed {
135
+ position: relative;
136
+ z-index: 1;
137
+ }
138
+
139
+ &-no-logo {
140
+ z-index: 1;
141
+ }
142
+
143
+ &-logo-wrapper {
144
+ display: flex;
145
+ align-items: center;
146
+ justify-content: center;
147
+ width: 100%;
148
+ &:hover {
149
+ cursor: pointer;
150
+ }
151
+ }
152
+
153
+ &-logo-t-logo {
154
+ height: 32px;
155
+ width: 100%;
156
+ }
157
+
158
+ &-logo-tdesign-logo {
159
+ padding: 0 24px;
160
+ height: 32px;
161
+ width: 100%;
162
+ color: var(--td-text-color-primary);
163
+ }
164
+
165
+ &-logo-normal {
166
+ color: var(--td-brand-color);
167
+ font: var(--td-font-body-large);
168
+ transition: all 0.3s;
169
+ }
170
+ }
171
+
172
+ &-side-nav-placeholder {
173
+ flex: 1 1 232px;
174
+ min-width: 232px;
175
+ transition: all 0.3s;
176
+
177
+ &-hidden {
178
+ flex: 1 1 72px;
179
+ min-width: 72px;
180
+ transition: all 0.3s;
181
+ }
182
+ }
183
+ }
184
+
185
+ .route-tabs-dropdown {
186
+ .t-icon {
187
+ margin-right: 8px;
188
+ }
189
+ }
190
+
191
+ .logo-container {
192
+ cursor: pointer;
193
+ display: inline-flex;
194
+ height: var(--td-comp-size-xxxl);
195
+ margin-left: 24px;
196
+ }
197
+
198
+ .version-container {
199
+ color: var(--td-text-color-primary);
200
+ opacity: 0.4;
201
+ }