@gx-design-vue/create-gx-cli 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +3 -3
  3. package/src/main.js +6 -1
  4. package/template-mobile-vant-cli/build/generateModifyVars.ts +7 -0
  5. package/template-mobile-vant-cli/build/script/postBuild.ts +0 -1
  6. package/{template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/typings.ts → template-mobile-vant-cli/src/design/config.less} +0 -0
  7. package/template-mobile-vant-cli/types/components.d.ts +0 -2
  8. package/template-mobile-vant-cli/types/global.d.ts +3 -3
  9. package/template-mobile-vant-cli/types/module.d.ts +0 -2
  10. package/template-mobile-vant-cli/vite.config.ts +6 -7
  11. package/template-design-pro/.editorconfig +0 -19
  12. package/template-design-pro/.env +0 -2
  13. package/template-design-pro/.env.development +0 -18
  14. package/template-design-pro/.env.pro +0 -32
  15. package/template-design-pro/.env.production +0 -32
  16. package/template-design-pro/.env.test +0 -20
  17. package/template-design-pro/.eslintignore +0 -16
  18. package/template-design-pro/.eslintrc.js +0 -64
  19. package/template-design-pro/.gitpod.yml +0 -6
  20. package/template-design-pro/.husky/pre-commit +0 -4
  21. package/template-design-pro/.prettierignore +0 -9
  22. package/template-design-pro/.stylelintignore +0 -3
  23. package/template-design-pro/.yarnclean +0 -48
  24. package/template-design-pro/LICENSE +0 -21
  25. package/template-design-pro/README.md +0 -111
  26. package/template-design-pro/build/constant.ts +0 -6
  27. package/template-design-pro/build/generate/generateModifyVars.ts +0 -18
  28. package/template-design-pro/build/getConfigFileName.ts +0 -13
  29. package/template-design-pro/build/script/buildConf.ts +0 -44
  30. package/template-design-pro/build/script/postBuild.ts +0 -25
  31. package/template-design-pro/build/script/reSetRootHtml.ts +0 -20
  32. package/template-design-pro/build/utils.ts +0 -85
  33. package/template-design-pro/build/vite/cdn.ts +0 -7
  34. package/template-design-pro/build/vite/optimizer.ts +0 -22
  35. package/template-design-pro/build/vite/plugin/autoImport.ts +0 -18
  36. package/template-design-pro/build/vite/plugin/compress.ts +0 -35
  37. package/template-design-pro/build/vite/plugin/hmr.ts +0 -25
  38. package/template-design-pro/build/vite/plugin/html.ts +0 -47
  39. package/template-design-pro/build/vite/plugin/index.ts +0 -89
  40. package/template-design-pro/build/vite/plugin/mock.ts +0 -20
  41. package/template-design-pro/build/vite/plugin/pwa.ts +0 -37
  42. package/template-design-pro/build/vite/plugin/styleImport.ts +0 -129
  43. package/template-design-pro/build/vite/plugin/visualizer.ts +0 -17
  44. package/template-design-pro/build/vite/plugin/vite-plugin-antd-theme/index.ts +0 -24
  45. package/template-design-pro/build/vite/plugin/vite-plugin-mock/createMockServer.ts +0 -303
  46. package/template-design-pro/build/vite/plugin/vite-plugin-mock/createProdMockServer.ts +0 -93
  47. package/template-design-pro/build/vite/plugin/vite-plugin-mock/index.ts +0 -68
  48. package/template-design-pro/build/vite/plugin/vite-plugin-mock/types.ts +0 -30
  49. package/template-design-pro/build/vite/plugin/vite-plugin-mock/utils.ts +0 -26
  50. package/template-design-pro/commitlint.config.js +0 -32
  51. package/template-design-pro/config/config.ts +0 -14
  52. package/template-design-pro/config/default/animate.ts +0 -30
  53. package/template-design-pro/config/default/defaultSettings.ts +0 -75
  54. package/template-design-pro/config/default/network.ts +0 -16
  55. package/template-design-pro/config/default/proxy.ts +0 -26
  56. package/template-design-pro/config/default/theme.ts +0 -43
  57. package/template-design-pro/config/default/themeColor.ts +0 -62
  58. package/template-design-pro/index.html +0 -45
  59. package/template-design-pro/jest.config.mjs +0 -36
  60. package/template-design-pro/mock/_createProductionServer.ts +0 -19
  61. package/template-design-pro/mock/_util.ts +0 -55
  62. package/template-design-pro/mock/controller/menu.ts +0 -85
  63. package/template-design-pro/mock/controller/notices.ts +0 -114
  64. package/template-design-pro/mock/system/dict.ts +0 -60
  65. package/template-design-pro/mock/system/user.ts +0 -218
  66. package/template-design-pro/package.json +0 -151
  67. package/template-design-pro/pnpm-lock.yaml +0 -9913
  68. package/template-design-pro/postcss.config.js +0 -5
  69. package/template-design-pro/prettier.config.js +0 -18
  70. package/template-design-pro/public/resource/css/index.css +0 -171
  71. package/template-design-pro/public/resource/img/favicon.ico +0 -0
  72. package/template-design-pro/public/resource/img/logo.png +0 -0
  73. package/template-design-pro/public/resource/img/pro_icon.svg +0 -5
  74. package/template-design-pro/public/resource/img/pwa-192x192.png +0 -0
  75. package/template-design-pro/public/resource/img/pwa-512x512.png +0 -0
  76. package/template-design-pro/src/App.vue +0 -47
  77. package/template-design-pro/src/assets/error_images/403.png +0 -0
  78. package/template-design-pro/src/assets/error_images/404.png +0 -0
  79. package/template-design-pro/src/assets/error_images/cloud.png +0 -0
  80. package/template-design-pro/src/assets/login_images/login_background.svg +0 -69
  81. package/template-design-pro/src/assets/logo.png +0 -0
  82. package/template-design-pro/src/assets/menu_font/iconfont.css +0 -94
  83. package/template-design-pro/src/assets/menu_font/iconfont.eot +0 -0
  84. package/template-design-pro/src/assets/menu_font/iconfont.js +0 -1
  85. package/template-design-pro/src/assets/menu_font/iconfont.json +0 -142
  86. package/template-design-pro/src/assets/menu_font/iconfont.svg +0 -57
  87. package/template-design-pro/src/assets/menu_font/iconfont.ttf +0 -0
  88. package/template-design-pro/src/assets/menu_font/iconfont.woff +0 -0
  89. package/template-design-pro/src/assets/menu_font/iconfont.woff2 +0 -0
  90. package/template-design-pro/src/assets/menu_font/index.less +0 -94
  91. package/template-design-pro/src/common/global.ts +0 -1
  92. package/template-design-pro/src/components/GDesign/ProLayout/BasicLayout.less +0 -80
  93. package/template-design-pro/src/components/GDesign/ProLayout/BasicLayout.tsx +0 -342
  94. package/template-design-pro/src/components/GDesign/ProLayout/PageLoading.tsx +0 -20
  95. package/template-design-pro/src/components/GDesign/ProLayout/RenderTypings.ts +0 -31
  96. package/template-design-pro/src/components/GDesign/ProLayout/RouteContext.tsx +0 -82
  97. package/template-design-pro/src/components/GDesign/ProLayout/WrapContent.tsx +0 -69
  98. package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalFooter/index.tsx +0 -88
  99. package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/DefaultHeader.tsx +0 -189
  100. package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/Header.less +0 -8
  101. package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/index.tsx +0 -105
  102. package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/props.ts +0 -69
  103. package/template-design-pro/src/components/GDesign/ProLayout/components/GlobalHeader/style.less +0 -144
  104. package/template-design-pro/src/components/GDesign/ProLayout/components/LogoContent/index.tsx +0 -81
  105. package/template-design-pro/src/components/GDesign/ProLayout/components/LogoContent/props.ts +0 -29
  106. package/template-design-pro/src/components/GDesign/ProLayout/components/MultiTab/index.tsx +0 -384
  107. package/template-design-pro/src/components/GDesign/ProLayout/components/MultiTab/props.ts +0 -15
  108. package/template-design-pro/src/components/GDesign/ProLayout/components/MultiTab/style.less +0 -79
  109. package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/NoticeIcon.tsx +0 -148
  110. package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/NoticeList.module.less +0 -115
  111. package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/NoticeList.tsx +0 -154
  112. package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/index.less +0 -39
  113. package/template-design-pro/src/components/GDesign/ProLayout/components/NoticeIcon/index.tsx +0 -133
  114. package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/index.tsx +0 -190
  115. package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/props.ts +0 -48
  116. package/template-design-pro/src/components/GDesign/ProLayout/components/PageContainer/style.less +0 -128
  117. package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/AvatarDropdown.tsx +0 -63
  118. package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/HeaderSearch.tsx +0 -122
  119. package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/headerSearch.less +0 -30
  120. package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/index.tsx +0 -95
  121. package/template-design-pro/src/components/GDesign/ProLayout/components/RightContent/style.less +0 -90
  122. package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/BlockCheckbox.tsx +0 -70
  123. package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/LayoutSetting.tsx +0 -107
  124. package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/ThemeColor.tsx +0 -68
  125. package/template-design-pro/src/components/GDesign/ProLayout/components/SettingDrawer/index.tsx +0 -346
  126. package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/BaseMenu.tsx +0 -224
  127. package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/SiderMenu.tsx +0 -224
  128. package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/index.tsx +0 -43
  129. package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/props.ts +0 -112
  130. package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/style.less +0 -262
  131. package/template-design-pro/src/components/GDesign/ProLayout/components/SiderMenu/typings.ts +0 -44
  132. package/template-design-pro/src/components/GDesign/ProLayout/default.less +0 -2
  133. package/template-design-pro/src/components/GDesign/ProLayout/defaultSettings.ts +0 -121
  134. package/template-design-pro/src/components/GDesign/ProLayout/hooks/context/index.ts +0 -45
  135. package/template-design-pro/src/components/GDesign/ProLayout/index.ts +0 -43
  136. package/template-design-pro/src/components/GDesign/ProLayout/props.ts +0 -57
  137. package/template-design-pro/src/components/GDesign/ProLayout/style.less +0 -272
  138. package/template-design-pro/src/components/GDesign/ProLayout/typings.ts +0 -1
  139. package/template-design-pro/src/components/GDesign/ProLayout/utils/getMenuData.ts +0 -31
  140. package/template-design-pro/src/components/GDesign/ProLayout/utils/index.ts +0 -94
  141. package/template-design-pro/src/components/GDesign/ProLayout/utils/isImg/index.ts +0 -6
  142. package/template-design-pro/src/components/GDesign/ProLayout/utils/isUrl/index.ts +0 -5
  143. package/template-design-pro/src/components/GDesign/Result/index.tsx +0 -142
  144. package/template-design-pro/src/components/GDesign/Result/style.less +0 -140
  145. package/template-design-pro/src/components/GDesign/Scrollbars/components/Bar/index.tsx +0 -56
  146. package/template-design-pro/src/components/GDesign/Scrollbars/components/Bar/props.ts +0 -23
  147. package/template-design-pro/src/components/GDesign/Scrollbars/components/Thumb/index.tsx +0 -164
  148. package/template-design-pro/src/components/GDesign/Scrollbars/components/Thumb/props.ts +0 -11
  149. package/template-design-pro/src/components/GDesign/Scrollbars/context.ts +0 -10
  150. package/template-design-pro/src/components/GDesign/Scrollbars/index.tsx +0 -200
  151. package/template-design-pro/src/components/GDesign/Scrollbars/props.ts +0 -65
  152. package/template-design-pro/src/components/GDesign/Scrollbars/style.less +0 -85
  153. package/template-design-pro/src/components/GDesign/Scrollbars/util.ts +0 -40
  154. package/template-design-pro/src/components/GDesign/utils/index.ts +0 -7
  155. package/template-design-pro/src/components/PageLoading/index.tsx +0 -44
  156. package/template-design-pro/src/components/PageTransition/index.vue +0 -98
  157. package/template-design-pro/src/components/index.ts +0 -6
  158. package/template-design-pro/src/core/ant-design/index.ts +0 -14
  159. package/template-design-pro/src/core/gx-admin-design/index.ts +0 -7
  160. package/template-design-pro/src/core/gx-admin-directives/index.ts +0 -8
  161. package/template-design-pro/src/core/gx-admin-directives/permission.ts +0 -28
  162. package/template-design-pro/src/core/gx-design/index.ts +0 -7
  163. package/template-design-pro/src/core/gx-pro-design/index.ts +0 -10
  164. package/template-design-pro/src/core/index.ts +0 -27
  165. package/template-design-pro/src/design/ant-design/index.less +0 -4
  166. package/template-design-pro/src/design/ant-design/layout.less +0 -29
  167. package/template-design-pro/src/design/ant-design/menu.less +0 -55
  168. package/template-design-pro/src/design/ant-design/table.less +0 -67
  169. package/template-design-pro/src/design/ant-design/tooltip.less +0 -13
  170. package/template-design-pro/src/design/color.less +0 -1
  171. package/template-design-pro/src/design/config.less +0 -5
  172. package/template-design-pro/src/design/index.less +0 -41
  173. package/template-design-pro/src/design/mixin.less +0 -66
  174. package/template-design-pro/src/design/normalize.less +0 -390
  175. package/template-design-pro/src/global.less +0 -15
  176. package/template-design-pro/src/hooks/core/index.ts +0 -3
  177. package/template-design-pro/src/hooks/core/useRequest/index.ts +0 -70
  178. package/template-design-pro/src/hooks/core/useRequest/typings.ts +0 -0
  179. package/template-design-pro/src/hooks/event/index.ts +0 -3
  180. package/template-design-pro/src/hooks/event/useClipboard.ts +0 -14
  181. package/template-design-pro/src/hooks/system/index.ts +0 -5
  182. package/template-design-pro/src/hooks/system/useDict.ts +0 -62
  183. package/template-design-pro/src/hooks/system/usePermissions.ts +0 -39
  184. package/template-design-pro/src/hooks/typings.ts +0 -17
  185. package/template-design-pro/src/layout/BasicLayout.vue +0 -104
  186. package/template-design-pro/src/layout/BlankLayout.vue +0 -5
  187. package/template-design-pro/src/layout/ContentView.vue +0 -76
  188. package/template-design-pro/src/layout/IframeView.vue +0 -1
  189. package/template-design-pro/src/layout/UserLayout.vue +0 -7
  190. package/template-design-pro/src/main.ts +0 -34
  191. package/template-design-pro/src/plugins/index.ts +0 -3
  192. package/template-design-pro/src/router/guard/index.ts +0 -84
  193. package/template-design-pro/src/router/guard/permissions.ts +0 -73
  194. package/template-design-pro/src/router/guard/stateGuard.ts +0 -11
  195. package/template-design-pro/src/router/helper/routeHelper.ts +0 -244
  196. package/template-design-pro/src/router/helper/utils.ts +0 -19
  197. package/template-design-pro/src/router/index.ts +0 -30
  198. package/template-design-pro/src/router/routes/index.ts +0 -85
  199. package/template-design-pro/src/router/routes/modules/workplace.ts +0 -19
  200. package/template-design-pro/src/services/common/index.ts +0 -11
  201. package/template-design-pro/src/services/controller/router.ts +0 -10
  202. package/template-design-pro/src/services/controller/user.ts +0 -35
  203. package/template-design-pro/src/services/system/dictData.ts +0 -10
  204. package/template-design-pro/src/services/system/notices.ts +0 -9
  205. package/template-design-pro/src/store/index.ts +0 -32
  206. package/template-design-pro/src/store/modules/dict.ts +0 -27
  207. package/template-design-pro/src/store/modules/permission.ts +0 -19
  208. package/template-design-pro/src/store/modules/routes.ts +0 -110
  209. package/template-design-pro/src/store/modules/settings.ts +0 -102
  210. package/template-design-pro/src/store/modules/tabsRouter.ts +0 -73
  211. package/template-design-pro/src/store/modules/user.ts +0 -153
  212. package/template-design-pro/src/utils/accessToken.ts +0 -93
  213. package/template-design-pro/src/utils/crypto.ts +0 -39
  214. package/template-design-pro/src/utils/env.ts +0 -52
  215. package/template-design-pro/src/utils/fetchFile.ts +0 -79
  216. package/template-design-pro/src/utils/index.ts +0 -127
  217. package/template-design-pro/src/utils/pageTitle.ts +0 -17
  218. package/template-design-pro/src/utils/request/XHR.ts +0 -131
  219. package/template-design-pro/src/utils/request/axiosCancel.ts +0 -60
  220. package/template-design-pro/src/utils/request/checkStatus.ts +0 -26
  221. package/template-design-pro/src/utils/request/index.ts +0 -145
  222. package/template-design-pro/src/utils/request/typings.ts +0 -114
  223. package/template-design-pro/src/utils/storage.ts +0 -194
  224. package/template-design-pro/src/utils/uploadFile.ts +0 -26
  225. package/template-design-pro/src/utils/util.ts +0 -278
  226. package/template-design-pro/src/utils/validate.ts +0 -221
  227. package/template-design-pro/src/views/Iframe/index.vue +0 -76
  228. package/template-design-pro/src/views/MenuOne/index.vue +0 -15
  229. package/template-design-pro/src/views/MenuTwo/index.vue +0 -13
  230. package/template-design-pro/src/views/exception/403/index.vue +0 -9
  231. package/template-design-pro/src/views/exception/404/index.vue +0 -9
  232. package/template-design-pro/src/views/user/login/index.vue +0 -110
  233. package/template-design-pro/src/views/user/login/style.less +0 -38
  234. package/template-design-pro/stylelint.config.js +0 -106
  235. package/template-design-pro/tests/__mocks__/fileMock.ts +0 -1
  236. package/template-design-pro/tests/__mocks__/styleMock.ts +0 -1
  237. package/template-design-pro/tests/__mocks__/workerMock.ts +0 -5
  238. package/template-design-pro/tests/server/README.md +0 -15
  239. package/template-design-pro/tests/server/controller/FileController.ts +0 -18
  240. package/template-design-pro/tests/server/controller/UserController.ts +0 -15
  241. package/template-design-pro/tests/server/ecosystem.config.js +0 -18
  242. package/template-design-pro/tests/server/index.ts +0 -63
  243. package/template-design-pro/tests/server/nodemon.json +0 -8
  244. package/template-design-pro/tests/server/package.json +0 -36
  245. package/template-design-pro/tests/server/routes.ts +0 -23
  246. package/template-design-pro/tests/server/service/FileService.ts +0 -54
  247. package/template-design-pro/tests/server/service/UserService.ts +0 -25
  248. package/template-design-pro/tests/server/tsconfig.json +0 -15
  249. package/template-design-pro/tests/server/utils.ts +0 -9
  250. package/template-design-pro/tests/server/yarn.lock +0 -2955
  251. package/template-design-pro/tests/test.spec.ts +0 -16
  252. package/template-design-pro/tsconfig.json +0 -47
  253. package/template-design-pro/types/auto-imports.d.ts +0 -61
  254. package/template-design-pro/types/config.d.ts +0 -100
  255. package/template-design-pro/types/global.d.ts +0 -103
  256. package/template-design-pro/types/gx-components.d.ts +0 -24
  257. package/template-design-pro/types/index.d.ts +0 -13
  258. package/template-design-pro/types/mock.d.ts +0 -23
  259. package/template-design-pro/types/module.d.ts +0 -16
  260. package/template-design-pro/types/response.d.ts +0 -15
  261. package/template-design-pro/types/route.d.ts +0 -89
  262. package/template-design-pro/vite.config.ts +0 -136
  263. package/template-design-pro/yarn.lock +0 -9697
@@ -1,104 +0,0 @@
1
- <template>
2
- <g-pro-layout
3
- v-model:collapsed="baseState.collapsed"
4
- v-model:selectedKeys="baseState.selectedKeys"
5
- v-model:openKeys="baseState.openKeys"
6
- v-bind="state"
7
- :breadcrumb="{ routes: baseState.breadcrumb }"
8
- @reloadPage="handleReloadPage"
9
- @handleCollapse="toggleCollapse"
10
- @menuHeaderClick="menuHeaderClick"
11
- >
12
- <template v-if="store.settings.layout === 'wide'" #menuExtraRender>
13
- <div class="text-center"> 额外元素 </div>
14
- </template>
15
- <ProContent :animate="state.animate" :isRouterAlive="isRouterAlive" />
16
- </g-pro-layout>
17
- </template>
18
- <script setup lang="ts">
19
- import { computed, reactive } from 'vue'
20
- import { cloneDeep } from 'lodash-es'
21
- import { useStore } from '@gx-vuex'
22
- import { RouteContextProps, getMenuData, clearMenuItem } from '@gx-design/ProLayout'
23
- import config from '/config/config'
24
- import ProContent from './ContentView.vue'
25
-
26
- const { animate } = config
27
- const { preset } = animate
28
-
29
- const store = useStore()
30
- const router = useRouter()
31
-
32
- const isRouterAlive = ref(true)
33
- const routeData: AppRouteModule[] = router.getRoutes() as any
34
-
35
- const { menuData } = getMenuData(clearMenuItem(routeData))
36
-
37
- const baseState = reactive<Omit<RouteContextProps, 'menuData'>>({
38
- breadcrumb: [],
39
- selectedKeys: [],
40
- openKeys: [],
41
- collapsed: false
42
- })
43
-
44
- const state = reactive({
45
- menuData,
46
- logoDirection: 'vertical',
47
- loading: computed(() => store.routes.routerLoading),
48
- layout: computed(() => store.settings.layout),
49
- theme: computed(() => store.settings.theme),
50
- splitMenus: computed(() => store.settings.splitMenus),
51
- primaryColor: computed(() => store.settings.primaryColor),
52
- fixedMultiTab: computed(() => store.settings.fixedMultiTab),
53
- fixedHeader: computed(() => store.settings.fixedHeader),
54
- fixSiderbar: computed(() => store.settings.fixSiderbar),
55
- showTabsBar: computed(() => store.settings.showTabsBar),
56
- autoHideHeader: computed(() => store.settings.autoHideHeader),
57
- showProgressBar: computed(() => store.settings.showProgressBar),
58
- animate: computed(() => store.settings.animate)
59
- })
60
-
61
- watch(
62
- () => router.currentRoute,
63
- () => {
64
- const matched = router.currentRoute.value.matched.concat()
65
- const breadcrumb = matched.map((item) => {
66
- return {
67
- path: item.path,
68
- breadcrumbName: item.meta.title || ''
69
- }
70
- })
71
- baseState.breadcrumb = cloneDeep(breadcrumb)
72
- },
73
- {
74
- deep: true,
75
- immediate: true
76
- }
77
- )
78
-
79
- watchEffect(() => {
80
- if (router.currentRoute) {
81
- const matched = router.currentRoute.value.matched.concat()
82
- baseState.selectedKeys = matched.filter((r) => r.name !== 'index').map((r) => r.path)
83
- baseState.openKeys = matched
84
- .filter((r) => r.path !== router.currentRoute.value.path)
85
- .map((r) => r.path)
86
- }
87
- })
88
-
89
- const handleReloadPage = () => {
90
- isRouterAlive.value = false
91
- nextTick(() => {
92
- isRouterAlive.value = true
93
- })
94
- }
95
-
96
- const toggleCollapse = () => {
97
- store.settings.toggleCollapse()
98
- }
99
- const menuHeaderClick = () => {
100
- router.push('/')
101
- }
102
-
103
- provide('reloadPage', handleReloadPage)
104
- </script>
@@ -1,5 +0,0 @@
1
- <template>
2
- <router-view v-slot="{ Component }">
3
- <component :is="Component" />
4
- </router-view>
5
- </template>
@@ -1,76 +0,0 @@
1
- <template>
2
- <router-view>
3
- <template #default="{ route, Component }">
4
- <page-transition
5
- :disabled="animate.disabled"
6
- :animate="animate.name"
7
- :direction="animate.direction"
8
- >
9
- <template v-if="isRouterAlive">
10
- <keep-alive v-if="keepAlive">
11
- <component :is="Component" :key="route.fullPath" />
12
- </keep-alive>
13
- <component v-else :is="Component" :key="route.fullPath" />
14
- </template>
15
- </page-transition>
16
- </template>
17
- </router-view>
18
- <IframeView v-if="iframeSrc" :frameSrc="iframeSrc" />
19
- </template>
20
-
21
- <script setup lang="ts">
22
- import { computed } from 'vue'
23
- import { useRoute, useRouter } from 'vue-router'
24
- import { useStore } from '@gx-vuex'
25
- import PageTransition from '@/components/PageTransition/index.vue'
26
- import IframeView from '../views/Iframe/index.vue'
27
-
28
- defineProps({
29
- isRouterAlive: {
30
- type: Boolean,
31
- required: false,
32
- default: true
33
- },
34
- contentStyle: {
35
- type: Object,
36
- required: false,
37
- default: () => {
38
- return {}
39
- }
40
- },
41
- animate: {
42
- type: Object,
43
- required: false,
44
- default: () => {
45
- return {}
46
- }
47
- }
48
- })
49
-
50
- const route = useRoute()
51
- const store = useStore()
52
- const router = useRouter()
53
-
54
- const keepAlive = ref(false)
55
-
56
- const iframeSrc = computed(() => {
57
- const meta = router.currentRoute.value?.meta
58
- return meta?.target && Number(meta?.targetStatus) === 0 ? meta?.target : ''
59
- })
60
-
61
- watch(
62
- () => route,
63
- () => {
64
- const { meta }: { meta: Meta } = route
65
- if (!store.settings.showTabsBar && !meta.keepAlive) {
66
- keepAlive.value = false
67
- } else {
68
- keepAlive.value = store.settings.keepAlive || store.settings.showTabsBar || meta.keepAlive
69
- }
70
- },
71
- {
72
- deep: true,
73
- immediate: true
74
- }
75
- )
76
- </script>
@@ -1 +0,0 @@
1
- <template></template>
@@ -1,7 +0,0 @@
1
- <template>
2
- <div id="gx-user-layout">
3
- <router-view v-slot="{ Component }">
4
- <component :is="Component" />
5
- </router-view>
6
- </div>
7
- </template>
@@ -1,34 +0,0 @@
1
- import { createApp } from 'vue'
2
-
3
- import { router, setupRouter } from '@/router'
4
- import { setupRouterGuard } from '@/router/guard'
5
-
6
- import App from './App.vue'
7
- import { setupStore } from './store'
8
- import { setupGlobCommon } from './core'
9
-
10
- import 'uno.css'
11
-
12
- import 'animate.css/source/animate.css'
13
- import './global.less'
14
-
15
- import './plugins'
16
-
17
- function startApp() {
18
- const app = createApp(App)
19
-
20
- // 配置store
21
- setupStore(app)
22
-
23
- setupGlobCommon(app)
24
-
25
- // 配置路由
26
- setupRouter(app)
27
-
28
- // 路由守卫
29
- setupRouterGuard(router)
30
-
31
- app.mount('#app')
32
- }
33
-
34
- startApp()
@@ -1,3 +0,0 @@
1
- // 加载插件
2
- import.meta.glob('./*.ts', { eager: true })
3
-
@@ -1,84 +0,0 @@
1
- import type { Router } from 'vue-router'
2
- import NProgress from 'nprogress'
3
- import config from '/config/config'
4
- import { useStoreRoutes, useStoreSettings } from '@gx-vuex'
5
- import getPageTitle from '@/utils/pageTitle'
6
- import { scrollToContainer } from '@/utils/util'
7
- import { createStateGuard } from './stateGuard'
8
- import { createPermissionGuard } from './permissions'
9
-
10
- const {
11
- routerLoadTime,
12
- routesWhiteList
13
- } = config.defaultSettings
14
-
15
- export function setupRouterGuard(router: Router) {
16
- createPageGuard(router)
17
- createPageLoadingGuard(router)
18
- createScrollGuard(router)
19
- createProgressGuard(router)
20
- createPermissionGuard(router)
21
- createStateGuard(router)
22
- }
23
-
24
- export function createPageGuard(router: Router) {
25
- const routes = useStoreRoutes()
26
- const settings = useStoreSettings()
27
-
28
- router.afterEach((to) => {
29
- const { meta }: any = to
30
- document.title = getPageTitle(meta.title || '')
31
- if (
32
- settings.layout !== 'wide' &&
33
- routes.routerLoadList.every(item => item !== to.path) &&
34
- routesWhiteList.indexOf(to.path) === -1
35
- ) {
36
- routes.addRouterLoadList(to.path)
37
- }
38
- })
39
- }
40
-
41
- export function createPageLoadingGuard(router: Router) {
42
- const routes = useStoreRoutes()
43
- const settings = useStoreSettings()
44
-
45
- router.beforeEach(async (to) => {
46
- if (
47
- settings.layout !== 'wide' &&
48
- routes.routerLoadList.every(item => item !== to.path) &&
49
- routesWhiteList.indexOf(to.path) === -1
50
- ) {
51
- routes.changeValue('routerLoading', true)
52
- }
53
-
54
- return true
55
- })
56
-
57
- router.afterEach((_) => {
58
- if (settings.layout === 'wide') {
59
- routes.changeValue('routerLoading', false)
60
- } else {
61
- setTimeout(() => {
62
- routes.changeValue('routerLoading', false)
63
- }, routerLoadTime || 200)
64
- }
65
- })
66
- }
67
-
68
- export function createScrollGuard(router: Router) {
69
- router.afterEach((_) => {
70
- scrollToContainer(0)
71
- })
72
- }
73
-
74
- export function createProgressGuard(router: Router) {
75
- const settings = useStoreSettings()
76
- router.beforeEach(() => {
77
- if (settings.showProgressBar) NProgress.start()
78
- return true
79
- })
80
-
81
- router.afterEach(() => {
82
- NProgress.done()
83
- })
84
- }
@@ -1,73 +0,0 @@
1
- import type { Router, RouteRecordRaw } from 'vue-router'
2
- import config from '/config/config'
3
- import { useStoreUser, useStoreRoutes, useStorePermission } from '@gx-vuex'
4
-
5
- const {
6
- authentication,
7
- loginInterception,
8
- recordRoute,
9
- routesWhiteList
10
- } = config.defaultSettings
11
-
12
- export function createPermissionGuard(router: Router) {
13
- const userStore = useStoreUser()
14
- const routeStore = useStoreRoutes()
15
- const permissionStore = useStorePermission()
16
-
17
- router.beforeEach(async (to, _, next) => {
18
- const token = loginInterception || userStore.accessToken
19
-
20
- if (routesWhiteList.includes(to.path)) {
21
- if ((to.path === '/') && token) {
22
- next({ path: '/', replace: true })
23
- }
24
- next()
25
- return
26
- }
27
-
28
- if (!token) {
29
- userStore.resetPermissions()
30
- if (recordRoute) {
31
- next({ path: '/user/login', query: { redirect: to.path }, replace: true })
32
- } else {
33
- next({ path: '/user/login', replace: true })
34
- }
35
- return
36
- }
37
-
38
- const hasRoles = permissionStore.role.length > 0
39
-
40
- if (hasRoles) {
41
- next()
42
- return
43
- }
44
-
45
- const userInfo = loginInterception
46
- ? await userStore.queryUserInfo() : await userStore.setVirtualRoles()
47
-
48
- if (!userInfo) {
49
- userStore.resetPermissions()
50
- if (recordRoute) {
51
- next({ path: '/user/login', query: { redirect: to.path }, replace: true })
52
- } else {
53
- next({ path: '/user/login', replace: true })
54
- }
55
- return
56
- }
57
-
58
- const routes = authentication === 'all'
59
- ? await routeStore.setAllRoutes()
60
- : await routeStore.setRoutes()
61
-
62
- routeStore.changeValue('meunLoading', false)
63
-
64
- if (routes?.length) {
65
- routes.forEach((route) => {
66
- router.addRoute(route as RouteRecordRaw)
67
- })
68
- next({ path: to.fullPath, replace: true })
69
- return
70
- }
71
- next({ path: '/exception/403', replace: true })
72
- })
73
- }
@@ -1,11 +0,0 @@
1
- import type { Router } from 'vue-router'
2
- import { useStoreUser } from '@gx-vuex'
3
-
4
- export function createStateGuard(router: Router) {
5
- router.afterEach((to) => {
6
- const user = useStoreUser()
7
- if (to.path === '/user/login') {
8
- user.resetPermissions()
9
- }
10
- })
11
- }
@@ -1,244 +0,0 @@
1
- import { cloneDeep } from 'lodash-es'
2
- import { warning } from '@gx-design/utils'
3
- import { getMaxFloor } from '@gx-design-vue/pro-utils'
4
-
5
- /**
6
- * @description: default layout
7
- */
8
- export const BasicLayout = () => import('@/layout/BasicLayout.vue')
9
- export const IframeView = () => import('@/layout/IframeView.vue')
10
- export const EXCEPTION_COMPONENT = () => import('@/views/exception/404/index.vue')
11
-
12
- const LayoutMap = new Map<string, () => Promise<typeof import('*.vue')>>()
13
-
14
- LayoutMap.set('BasicLayout', BasicLayout)
15
- LayoutMap.set('IframeView', IframeView)
16
-
17
- let dynamicViewsModules: Record<string, () => Promise<Recordable>>
18
-
19
- /**
20
- * @Author gx12358
21
- * @DateTime 2021/5/14
22
- * @lastTime 2021/5/14
23
- * @description 根路由
24
- */
25
- const rootRouter: MenuDataItem[] = buildMenu([
26
- {
27
- path: '/',
28
- name: 'index',
29
- meta: { title: '首页' },
30
- component: 'BasicLayout',
31
- redirect: '',
32
- children: []
33
- }
34
- ])
35
-
36
- // Dynamic introduction
37
- function asyncImportRoute(component: string) {
38
- dynamicViewsModules = dynamicViewsModules || import.meta.glob('../../views/**/*.{vue,tsx}')
39
- return dynamicImport(dynamicViewsModules, component)
40
- }
41
-
42
- function dynamicImport(
43
- dynamicViewsModules: Record<string, () => Promise<Recordable>>,
44
- component: string
45
- ) {
46
- const keys = Object.keys(dynamicViewsModules)
47
- const matchKeys = keys.filter((key) => {
48
- const k = key.replace('../../views', '')
49
- if (!component) return false
50
- const startFlag = component.startsWith('/')
51
- const endFlag = component.endsWith('.vue') || component.endsWith('.tsx')
52
- const startIndex = startFlag ? 0 : 1
53
- const lastIndex = endFlag ? k.length : k.lastIndexOf('.')
54
- return k.substring(startIndex, lastIndex) === component
55
- })
56
- if (matchKeys?.length === 1) {
57
- const matchKey = matchKeys[0]
58
- return dynamicViewsModules[matchKey]
59
- } else if (matchKeys?.length > 1) {
60
- warning(
61
- true,
62
- '请不要在views文件夹下的同一层次目录中创建具有相同文件名的“.vue”和“.TSX”文件。这将导致动态导入失败'
63
- )
64
- return
65
- } else {
66
- warning(true, '在src/views/下找不到`' + component + '.vue` 或 `' + component + '.tsx`, 请自行创建!')
67
- return EXCEPTION_COMPONENT
68
- }
69
- }
70
-
71
- /**
72
- * @Author gx12358
73
- * @DateTime 2021/5/14
74
- * @lastTime 2021/5/14
75
- * @description 将后台树形数据菜单和本地菜单结合
76
- */
77
- export function getRootMenu(rows: MenuDataItem[]): MenuDataItem[] {
78
- let menus: MenuDataItem[] = []
79
- if (getMaxFloor(cloneDeep(rows)) > 1) {
80
- menus = buildMenu(rows)
81
- } else {
82
- buildtree(rows, menus, 0)
83
- }
84
- rootRouter[0].children = menus
85
- rootRouter[0].children.push({
86
- key: 'externalLink',
87
- path: '/externalLink',
88
- meta: {
89
- title: '外链地址'
90
- },
91
- hidden: true
92
- } as MenuDataItem)
93
- return cloneDeep(rootRouter)
94
- }
95
-
96
- /**
97
- * @Author gx12358
98
- * @DateTime 2021/5/14
99
- * @lastTime 2021/5/14
100
- * @description 格式化 后端 结构信息并递归生成层级路由表
101
- */
102
- export const generator = (routerMap: MenuDataItem[], parent?) => {
103
- return routerMap.map((item: any) => {
104
- const currentRouter: AppRouteModule = {
105
- // 路由地址 动态拼接生成如 /dashboard/workplace
106
- path: parent && parent.path
107
- ? `${parent.path === '/'
108
- ? ''
109
- : (parent.path || '')}/${item.path}`
110
- : `/${item.path}`,
111
- // 路由名称,建议唯一
112
- name: item.name || '',
113
- // 该路由对应页面的 组件 优先根据组件名或者key从constantRouterComponents获取,没有则通过组件名地址查询
114
- component: item.menuType === 'M' ? undefined : (
115
- LayoutMap.get(item.component || item.key) ||
116
- asyncImportRoute(item.component)
117
- ),
118
- // meta: 页面标题, 菜单图标, 页面权限(供指令权限用,可去掉)
119
- meta: {
120
- title: item.title || '',
121
- tagFixed: item.tagFixed,
122
- tagHidden: item.tagHidden,
123
- icon: item.icon || undefined,
124
- homePage: item.homePage || 0,
125
- iconType: item.iconType || undefined,
126
- hideInMenu: item.hidden || false,
127
- target: item.target,
128
- targetStatus: item.targetStatus
129
- }
130
- }
131
- // 为了防止出现后端返回结果不规范,处理有可能出现拼接出两个 反斜杠
132
- if (!currentRouter.path.startsWith('http')) {
133
- currentRouter.path = currentRouter.path.replace('//', '/')
134
- }
135
- // 重定向
136
- item.redirect && (currentRouter.redirect = item.redirect)
137
- // 是否有子菜单,并递归处理
138
- if (item.children && item.children.length > 0) {
139
- // Recursion
140
- currentRouter.children = generator(item.children, currentRouter)
141
- }
142
- return currentRouter
143
- })
144
- }
145
-
146
- /**
147
- * @Author gx12358
148
- * @DateTime 2021/5/14
149
- * @lastTime 2021/5/14
150
- * @description 将后台树形结构菜单数据添加后修改属性(具体修改看后台返回值)
151
- */
152
- export function buildMenu(list: MenuDataItem[]) {
153
- return list.map((item: MenuDataItem) => {
154
- const {
155
- title = '',
156
- menuType,
157
- icon = '',
158
- iconType = 1, //菜单图标类型 0:本地 1:自定义 2:图片
159
- tagFixed = '1', //标签栏固定状态(标签栏路由地址是否固定(只有标签栏为显示转态才生效))0:是 1:否
160
- tagHidden = '0', //标签栏显示状态(隐藏的路由是否显示在标签栏中(只有标签栏为显示转态才生效))0:显示 1:隐藏
161
- homePageFlag = 0, //是否为主页(选择后为登录后跳转改地址,不选择默认跳转 /)0:否 1:是
162
- isFrame = '1', //是否外链 0:是 1:否
163
- outLinkType = 0 //外链类型(选择是系统内则以iframe形式在系统内部展示,否则跳转新页面打开) 0:系统内 1:系统外
164
- } = item.meta ?? item
165
- const child = {
166
- title,
167
- level: 'tree',
168
- name: item.name || title,
169
- key: item.name || title,
170
- icon,
171
- menuType,
172
- iconType: iconType || 1,
173
- hidden: !!item.hidden,
174
- homePage: homePageFlag,
175
- path: item.path && item.path.length > 0
176
- ? item.path
177
- : undefined,
178
- component: item.component,
179
- redirect: item.redirect === 'noRedirect'
180
- ? ''
181
- : item.redirect,
182
- tagFixed: tagFixed === '0',
183
- tagHidden: tagHidden === '1',
184
- target: isFrame === '0' ? item.target : '',
185
- targetStatus: outLinkType || 0,
186
- children: item.children && item.children.length > 0
187
- ? buildMenu(item.children)
188
- : []
189
- }
190
- return child
191
- })
192
- }
193
-
194
- /**
195
- * @Author gx12358
196
- * @DateTime 2021/5/14
197
- * @lastTime 2021/5/14
198
- * @description 将后台菜单数据变成树形结构(具体修改看后台返回值)
199
- */
200
- export function buildtree(list: MenuDataItem[], arr: MenuDataItem[], parentId: string | number) {
201
- list.forEach((item: MenuDataItem) => {
202
- const {
203
- title = '',
204
- icon = '',
205
- menuType,
206
- iconType = 1, //菜单图标类型 0:本地 1:自定义 2:图片
207
- tagFixed = '1', //标签栏固定状态(标签栏路由地址是否固定(只有标签栏为显示转态才生效))0:是 1:否
208
- tagHidden = '0', //标签栏显示状态(隐藏的路由是否显示在标签栏中(只有标签栏为显示转态才生效))0:显示 1:隐藏
209
- homePageFlag = 0, //是否为主页(选择后为登录后跳转改地址,不选择默认跳转 /)0:否 1:是
210
- isFrame = '1', //是否外链 0:是 1:否
211
- outLinkType = 0 //外链类型(选择是系统内则以iframe形式在系统内部展示,否则跳转新页面打开) 0:系统内 1:系统外
212
- } = item.meta ?? item
213
- if (item.parentId === parentId) {
214
- const child: any = {
215
- level: 'flat',
216
- title,
217
- name: item.name || title,
218
- key: item.name || title,
219
- icon,
220
- menuType,
221
- iconType,
222
- hidden: item.hidden,
223
- homePage: homePageFlag,
224
- path: item.path && item.path.length > 0
225
- ? item.path
226
- : undefined,
227
- component: item.component,
228
- redirect: item.redirect === 'noRedirect'
229
- ? ''
230
- : item.redirect,
231
- tagFixed: tagFixed === '0',
232
- tagHidden: tagHidden === '1',
233
- target: isFrame === '0' ? item.target : '',
234
- targetStatus: outLinkType || 0,
235
- children: []
236
- }
237
- buildtree(list, child.children, item.menuId)
238
- if (child.children.length === 0) {
239
- delete child.children
240
- }
241
- arr.push(child)
242
- }
243
- })
244
- }
@@ -1,19 +0,0 @@
1
- export function getFirstLastChild(data: any[]) {
2
- let newPath
3
- // 获取第一个children的path
4
- const getRoutePath = function (newdata) {
5
- let firstPath = ''
6
- if (newdata.children && newdata.children.length > 0) {
7
- firstPath = getRoutePath(newdata.children[0])
8
- } else {
9
- firstPath = `${newdata.path}`
10
- }
11
- return firstPath
12
- }
13
- if (data[0].children && data[0].children.length > 0) {
14
- newPath = getRoutePath(data[0].children[0])
15
- } else {
16
- newPath = data[0].path
17
- }
18
- return newPath
19
- }