@kevairy/template 0.1.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 (293) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +14 -0
  3. package/package.json +37 -0
  4. package/template/.env +22 -0
  5. package/template/.env.development +13 -0
  6. package/template/.env.production +10 -0
  7. package/template/.prettierignore +3 -0
  8. package/template/.prettierrc +20 -0
  9. package/template/.stylelintignore +9 -0
  10. package/template/.stylelintrc.cjs +84 -0
  11. package/template/LICENSE +21 -0
  12. package/template/README.md +22 -0
  13. package/template/_gitignore +19 -0
  14. package/template/eslint-auto-import.json +324 -0
  15. package/template/eslint.config.mjs +83 -0
  16. package/template/index.html +25 -0
  17. package/template/package.json +79 -0
  18. package/template/playwright.config.ts +25 -0
  19. package/template/public/favicon.ico +0 -0
  20. package/template/src/App.vue +39 -0
  21. package/template/src/adapters/auth/index.ts +9 -0
  22. package/template/src/adapters/auth/mock.ts +10 -0
  23. package/template/src/adapters/auth/types.ts +11 -0
  24. package/template/src/adapters/navigation/index.ts +13 -0
  25. package/template/src/adapters/navigation/types.ts +6 -0
  26. package/template/src/api/auth.ts +23 -0
  27. package/template/src/assets/images/avatar/avatar.webp +0 -0
  28. package/template/src/assets/images/avatar/avatar1.webp +0 -0
  29. package/template/src/assets/images/avatar/avatar10.webp +0 -0
  30. package/template/src/assets/images/avatar/avatar2.webp +0 -0
  31. package/template/src/assets/images/avatar/avatar3.webp +0 -0
  32. package/template/src/assets/images/avatar/avatar4.webp +0 -0
  33. package/template/src/assets/images/avatar/avatar5.webp +0 -0
  34. package/template/src/assets/images/avatar/avatar6.webp +0 -0
  35. package/template/src/assets/images/avatar/avatar7.webp +0 -0
  36. package/template/src/assets/images/avatar/avatar8.webp +0 -0
  37. package/template/src/assets/images/avatar/avatar9.webp +0 -0
  38. package/template/src/assets/images/ceremony/hb.png +0 -0
  39. package/template/src/assets/images/ceremony/sd.png +0 -0
  40. package/template/src/assets/images/ceremony/xc.png +0 -0
  41. package/template/src/assets/images/ceremony/yd.png +0 -0
  42. package/template/src/assets/images/common/logo.webp +0 -0
  43. package/template/src/assets/images/draw/draw1.png +0 -0
  44. package/template/src/assets/images/favicon.ico +0 -0
  45. package/template/src/assets/images/lock/bg_dark.webp +0 -0
  46. package/template/src/assets/images/lock/bg_light.webp +0 -0
  47. package/template/src/assets/images/login/kylin-hero-source.png +0 -0
  48. package/template/src/assets/images/login/lf_icon2.webp +0 -0
  49. package/template/src/assets/images/settings/menu_layouts/dual_column.png +0 -0
  50. package/template/src/assets/images/settings/menu_layouts/horizontal.png +0 -0
  51. package/template/src/assets/images/settings/menu_layouts/mixed.png +0 -0
  52. package/template/src/assets/images/settings/menu_layouts/vertical.png +0 -0
  53. package/template/src/assets/images/settings/menu_styles/dark.png +0 -0
  54. package/template/src/assets/images/settings/menu_styles/design.png +0 -0
  55. package/template/src/assets/images/settings/menu_styles/light.png +0 -0
  56. package/template/src/assets/images/settings/theme_styles/dark.png +0 -0
  57. package/template/src/assets/images/settings/theme_styles/light.png +0 -0
  58. package/template/src/assets/images/settings/theme_styles/system.png +0 -0
  59. package/template/src/assets/images/svg/403.svg +1 -0
  60. package/template/src/assets/images/svg/404.svg +1 -0
  61. package/template/src/assets/images/svg/500.svg +5 -0
  62. package/template/src/assets/images/svg/login_icon.svg +1 -0
  63. package/template/src/assets/images/user/avatar.webp +0 -0
  64. package/template/src/assets/images/user/bg.webp +0 -0
  65. package/template/src/assets/styles/core/app.scss +227 -0
  66. package/template/src/assets/styles/core/dark.scss +93 -0
  67. package/template/src/assets/styles/core/el-dark.scss +2 -0
  68. package/template/src/assets/styles/core/el-light.scss +34 -0
  69. package/template/src/assets/styles/core/el-ui.scss +519 -0
  70. package/template/src/assets/styles/core/md.scss +1036 -0
  71. package/template/src/assets/styles/core/mixin.scss +157 -0
  72. package/template/src/assets/styles/core/reset.scss +41 -0
  73. package/template/src/assets/styles/core/router-transition.scss +104 -0
  74. package/template/src/assets/styles/core/tailwind.css +219 -0
  75. package/template/src/assets/styles/core/theme-animation.scss +63 -0
  76. package/template/src/assets/styles/core/theme-change.scss +11 -0
  77. package/template/src/assets/styles/custom/one-dark-pro.scss +98 -0
  78. package/template/src/assets/styles/index.scss +23 -0
  79. package/template/src/assets/svg/loading.ts +32 -0
  80. package/template/src/bootstrap/initializeApp.ts +30 -0
  81. package/template/src/components/core/banners/art-basic-banner/index.vue +343 -0
  82. package/template/src/components/core/banners/art-card-banner/index.vue +114 -0
  83. package/template/src/components/core/base/art-back-to-top/index.vue +40 -0
  84. package/template/src/components/core/base/art-logo/index.vue +34 -0
  85. package/template/src/components/core/base/art-svg-icon/index.vue +24 -0
  86. package/template/src/components/core/cards/art-bar-chart-card/index.vue +103 -0
  87. package/template/src/components/core/cards/art-data-list-card/index.vue +74 -0
  88. package/template/src/components/core/cards/art-donut-chart-card/index.vue +124 -0
  89. package/template/src/components/core/cards/art-image-card/index.vue +89 -0
  90. package/template/src/components/core/cards/art-line-chart-card/index.vue +126 -0
  91. package/template/src/components/core/cards/art-progress-card/index.vue +86 -0
  92. package/template/src/components/core/cards/art-stats-card/index.vue +67 -0
  93. package/template/src/components/core/cards/art-timeline-list-card/index.vue +69 -0
  94. package/template/src/components/core/charts/art-bar-chart/index.vue +203 -0
  95. package/template/src/components/core/charts/art-dual-bar-compare-chart/index.vue +195 -0
  96. package/template/src/components/core/charts/art-h-bar-chart/index.vue +208 -0
  97. package/template/src/components/core/charts/art-k-line-chart/index.vue +152 -0
  98. package/template/src/components/core/charts/art-line-chart/index.vue +371 -0
  99. package/template/src/components/core/charts/art-radar-chart/index.vue +105 -0
  100. package/template/src/components/core/charts/art-ring-chart/index.vue +133 -0
  101. package/template/src/components/core/charts/art-scatter-chart/index.vue +115 -0
  102. package/template/src/components/core/feedback/art-page-loading/index.vue +281 -0
  103. package/template/src/components/core/forms/art-button-more/index.vue +71 -0
  104. package/template/src/components/core/forms/art-button-table/index.vue +59 -0
  105. package/template/src/components/core/forms/art-drag-verify/index.vue +430 -0
  106. package/template/src/components/core/forms/art-excel-export/index.vue +390 -0
  107. package/template/src/components/core/forms/art-excel-import/index.vue +62 -0
  108. package/template/src/components/core/forms/art-form/index.vue +507 -0
  109. package/template/src/components/core/forms/art-wang-editor/index.vue +261 -0
  110. package/template/src/components/core/forms/art-wang-editor/style.scss +273 -0
  111. package/template/src/components/core/layouts/art-breadcrumb/index.vue +142 -0
  112. package/template/src/components/core/layouts/art-chat-window/index.vue +262 -0
  113. package/template/src/components/core/layouts/art-fast-enter/index.vue +113 -0
  114. package/template/src/components/core/layouts/art-fireworks-effect/index.vue +633 -0
  115. package/template/src/components/core/layouts/art-global-component/index.vue +14 -0
  116. package/template/src/components/core/layouts/art-global-search/index.vue +431 -0
  117. package/template/src/components/core/layouts/art-header-bar/index.vue +485 -0
  118. package/template/src/components/core/layouts/art-header-bar/widget/ArtUserMenu.vue +118 -0
  119. package/template/src/components/core/layouts/art-menus/art-horizontal-menu/index.vue +110 -0
  120. package/template/src/components/core/layouts/art-menus/art-horizontal-menu/widget/HorizontalSubmenu.vue +106 -0
  121. package/template/src/components/core/layouts/art-menus/art-mixed-menu/index.vue +279 -0
  122. package/template/src/components/core/layouts/art-menus/art-sidebar-menu/index.vue +354 -0
  123. package/template/src/components/core/layouts/art-menus/art-sidebar-menu/style.scss +251 -0
  124. package/template/src/components/core/layouts/art-menus/art-sidebar-menu/theme.scss +258 -0
  125. package/template/src/components/core/layouts/art-menus/art-sidebar-menu/widget/SidebarSubmenu.vue +190 -0
  126. package/template/src/components/core/layouts/art-notification/index.vue +456 -0
  127. package/template/src/components/core/layouts/art-page-content/index.vue +137 -0
  128. package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsConfig.ts +248 -0
  129. package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsHandlers.ts +167 -0
  130. package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsPanel.ts +233 -0
  131. package/template/src/components/core/layouts/art-settings-panel/composables/useSettingsState.ts +37 -0
  132. package/template/src/components/core/layouts/art-settings-panel/index.vue +72 -0
  133. package/template/src/components/core/layouts/art-settings-panel/style.scss +92 -0
  134. package/template/src/components/core/layouts/art-settings-panel/widget/BasicSettings.vue +77 -0
  135. package/template/src/components/core/layouts/art-settings-panel/widget/BoxStyleSettings.vue +38 -0
  136. package/template/src/components/core/layouts/art-settings-panel/widget/ColorSettings.vue +35 -0
  137. package/template/src/components/core/layouts/art-settings-panel/widget/ContainerSettings.vue +33 -0
  138. package/template/src/components/core/layouts/art-settings-panel/widget/MenuLayoutSettings.vue +31 -0
  139. package/template/src/components/core/layouts/art-settings-panel/widget/MenuStyleSettings.vue +44 -0
  140. package/template/src/components/core/layouts/art-settings-panel/widget/SectionTitle.vue +17 -0
  141. package/template/src/components/core/layouts/art-settings-panel/widget/SettingActions.vue +236 -0
  142. package/template/src/components/core/layouts/art-settings-panel/widget/SettingDrawer.vue +51 -0
  143. package/template/src/components/core/layouts/art-settings-panel/widget/SettingHeader.vue +18 -0
  144. package/template/src/components/core/layouts/art-settings-panel/widget/SettingItem.vue +101 -0
  145. package/template/src/components/core/layouts/art-settings-panel/widget/ThemeSettings.vue +28 -0
  146. package/template/src/components/core/layouts/art-work-tab/index.vue +584 -0
  147. package/template/src/components/core/media/art-cutter-img/index.vue +350 -0
  148. package/template/src/components/core/media/art-video-player/index.vue +111 -0
  149. package/template/src/components/core/others/art-menu-right/index.vue +415 -0
  150. package/template/src/components/core/others/art-watermark/index.vue +64 -0
  151. package/template/src/components/core/text-effect/art-count-to/index.vue +310 -0
  152. package/template/src/components/core/text-effect/art-festival-text-scroll/index.vue +32 -0
  153. package/template/src/components/core/text-effect/art-text-scroll/index.vue +285 -0
  154. package/template/src/components/core/theme/theme-svg/index.vue +100 -0
  155. package/template/src/components/core/views/exception/ArtException.vue +55 -0
  156. package/template/src/components/core/views/login/AuthTopBar.vue +149 -0
  157. package/template/src/components/core/views/login/LoginLeftView.vue +602 -0
  158. package/template/src/components/core/views/result/ArtResultPage.vue +43 -0
  159. package/template/src/components/core/widget/art-icon-button/index.vue +23 -0
  160. package/template/src/config/assets/images.ts +61 -0
  161. package/template/src/config/index.ts +170 -0
  162. package/template/src/config/modules/component.ts +98 -0
  163. package/template/src/config/modules/fastEnter.ts +16 -0
  164. package/template/src/config/modules/festival.ts +51 -0
  165. package/template/src/config/modules/headerBar.ts +64 -0
  166. package/template/src/config/setting.ts +109 -0
  167. package/template/src/directives/core/auth.ts +66 -0
  168. package/template/src/directives/core/highlight-loader.ts +37 -0
  169. package/template/src/directives/core/highlight.ts +253 -0
  170. package/template/src/directives/core/ripple.ts +116 -0
  171. package/template/src/directives/core/roles.ts +87 -0
  172. package/template/src/directives/index.ts +14 -0
  173. package/template/src/enums/appEnum.ts +81 -0
  174. package/template/src/enums/formEnum.ts +17 -0
  175. package/template/src/env.d.ts +32 -0
  176. package/template/src/hooks/core/useAppMode.ts +45 -0
  177. package/template/src/hooks/core/useAuth.ts +74 -0
  178. package/template/src/hooks/core/useCeremony.ts +184 -0
  179. package/template/src/hooks/core/useChart.ts +745 -0
  180. package/template/src/hooks/core/useCommon.ts +87 -0
  181. package/template/src/hooks/core/useFastEnter.ts +55 -0
  182. package/template/src/hooks/core/useHeaderBar.ts +201 -0
  183. package/template/src/hooks/core/useLayoutHeight.ts +148 -0
  184. package/template/src/hooks/core/useTableColumns.ts +313 -0
  185. package/template/src/hooks/core/useTheme.ts +174 -0
  186. package/template/src/hooks/index.ts +29 -0
  187. package/template/src/locales/index.ts +123 -0
  188. package/template/src/locales/langs/en.json +283 -0
  189. package/template/src/locales/langs/zh.json +283 -0
  190. package/template/src/main.ts +29 -0
  191. package/template/src/mock/auth.ts +46 -0
  192. package/template/src/plugins/echarts.ts +76 -0
  193. package/template/src/plugins/index.ts +6 -0
  194. package/template/src/router/core/ComponentLoader.ts +82 -0
  195. package/template/src/router/core/IframeRouteManager.ts +78 -0
  196. package/template/src/router/core/MenuProcessor.ts +280 -0
  197. package/template/src/router/core/RoutePermissionValidator.ts +161 -0
  198. package/template/src/router/core/RouteRegistry.ts +90 -0
  199. package/template/src/router/core/RouteTransformer.ts +132 -0
  200. package/template/src/router/core/RouteValidator.ts +187 -0
  201. package/template/src/router/core/index.ts +14 -0
  202. package/template/src/router/guards/afterEach.ts +34 -0
  203. package/template/src/router/guards/beforeEach.ts +442 -0
  204. package/template/src/router/index.ts +24 -0
  205. package/template/src/router/modules/dashboard.ts +23 -0
  206. package/template/src/router/modules/examples.ts +109 -0
  207. package/template/src/router/modules/exception.ts +46 -0
  208. package/template/src/router/modules/index.ts +12 -0
  209. package/template/src/router/modules/result.ts +32 -0
  210. package/template/src/router/routes/asyncRoutes.ts +9 -0
  211. package/template/src/router/routes/staticRoutes.ts +60 -0
  212. package/template/src/router/routesAlias.ts +8 -0
  213. package/template/src/services/auth.ts +15 -0
  214. package/template/src/store/index.ts +52 -0
  215. package/template/src/store/modules/menu.ts +109 -0
  216. package/template/src/store/modules/setting.ts +450 -0
  217. package/template/src/store/modules/user.ts +218 -0
  218. package/template/src/store/modules/worktab.ts +568 -0
  219. package/template/src/types/api/api.d.ts +86 -0
  220. package/template/src/types/common/index.ts +95 -0
  221. package/template/src/types/common/response.ts +32 -0
  222. package/template/src/types/component/chart.ts +324 -0
  223. package/template/src/types/component/index.ts +86 -0
  224. package/template/src/types/config/index.ts +253 -0
  225. package/template/src/types/directive/directive.d.ts +15 -0
  226. package/template/src/types/import/auto-imports.d.ts +319 -0
  227. package/template/src/types/import/components.d.ts +126 -0
  228. package/template/src/types/index.ts +22 -0
  229. package/template/src/types/router/index.ts +80 -0
  230. package/template/src/types/store/index.ts +157 -0
  231. package/template/src/utils/form/index.ts +9 -0
  232. package/template/src/utils/form/validator.ts +316 -0
  233. package/template/src/utils/http/contract.ts +39 -0
  234. package/template/src/utils/http/error.ts +182 -0
  235. package/template/src/utils/http/index.ts +226 -0
  236. package/template/src/utils/http/status.ts +18 -0
  237. package/template/src/utils/index.ts +31 -0
  238. package/template/src/utils/navigation/index.ts +10 -0
  239. package/template/src/utils/navigation/jump.ts +68 -0
  240. package/template/src/utils/navigation/route.ts +85 -0
  241. package/template/src/utils/navigation/worktab.ts +67 -0
  242. package/template/src/utils/router.ts +63 -0
  243. package/template/src/utils/socket/index.ts +423 -0
  244. package/template/src/utils/storage/index.ts +7 -0
  245. package/template/src/utils/storage/storage-config.ts +127 -0
  246. package/template/src/utils/storage/storage-key-manager.ts +97 -0
  247. package/template/src/utils/storage/storage.ts +250 -0
  248. package/template/src/utils/sys/console.ts +9 -0
  249. package/template/src/utils/sys/error-handle.ts +143 -0
  250. package/template/src/utils/sys/index.ts +2 -0
  251. package/template/src/utils/sys/mittBus.ts +61 -0
  252. package/template/src/utils/ui/animation.ts +80 -0
  253. package/template/src/utils/ui/colors.ts +273 -0
  254. package/template/src/utils/ui/emojo.ts +24 -0
  255. package/template/src/utils/ui/iconify-loader.ts +31 -0
  256. package/template/src/utils/ui/index.ts +11 -0
  257. package/template/src/utils/ui/loading.ts +158 -0
  258. package/template/src/utils/ui/tabs.ts +60 -0
  259. package/template/src/views/auth/forget-password/index.vue +62 -0
  260. package/template/src/views/auth/login/index.vue +166 -0
  261. package/template/src/views/auth/login/style.css +38 -0
  262. package/template/src/views/auth/register/index.vue +240 -0
  263. package/template/src/views/dashboard/console/index.vue +173 -0
  264. package/template/src/views/examples/analytics/index.vue +389 -0
  265. package/template/src/views/examples/complex-form/index.vue +395 -0
  266. package/template/src/views/examples/crud-workspace/index.vue +412 -0
  267. package/template/src/views/examples/navigation/detail/index.vue +151 -0
  268. package/template/src/views/examples/navigation/state/index.vue +226 -0
  269. package/template/src/views/examples/overview/index.vue +309 -0
  270. package/template/src/views/examples/permissions/index.vue +303 -0
  271. package/template/src/views/examples/search-table/index.vue +182 -0
  272. package/template/src/views/examples/search-table/search.config.ts +81 -0
  273. package/template/src/views/examples/search-table/service.ts +116 -0
  274. package/template/src/views/examples/search-table/table.config.ts +37 -0
  275. package/template/src/views/exception/403/index.vue +16 -0
  276. package/template/src/views/exception/404/index.vue +16 -0
  277. package/template/src/views/exception/500/index.vue +16 -0
  278. package/template/src/views/index/index.vue +29 -0
  279. package/template/src/views/index/style.scss +93 -0
  280. package/template/src/views/outside/Iframe.vue +42 -0
  281. package/template/src/views/result/fail/index.vue +28 -0
  282. package/template/src/views/result/success/index.vue +21 -0
  283. package/template/tests/e2e/auth.spec.ts +14 -0
  284. package/template/tests/e2e/search-table.spec.ts +154 -0
  285. package/template/tests/unit/adapters/auth.spec.ts +38 -0
  286. package/template/tests/unit/config/app-config.spec.ts +17 -0
  287. package/template/tests/unit/directives/highlight.spec.ts +20 -0
  288. package/template/tests/unit/http/contract.spec.ts +47 -0
  289. package/template/tests/unit/mock/search-table.spec.ts +62 -0
  290. package/template/tests/unit/router/examples.spec.ts +52 -0
  291. package/template/tsconfig.json +28 -0
  292. package/template/vite.config.ts +181 -0
  293. package/template/vitest.config.ts +27 -0
@@ -0,0 +1,166 @@
1
+ <!-- 通用模板登录页面:当前使用本地 Mock,后续项目只需替换认证适配层。 -->
2
+ <template>
3
+ <div class="flex w-full h-screen">
4
+ <LoginLeftView />
5
+
6
+ <div class="relative flex-1">
7
+ <AuthTopBar />
8
+
9
+ <div class="auth-right-wrap">
10
+ <div class="form">
11
+ <h3 class="title">{{ $t('login.title') }}</h3>
12
+ <p class="sub-title">{{ $t('login.subTitle') }}</p>
13
+
14
+ <ElAlert
15
+ class="mock-alert"
16
+ type="info"
17
+ :closable="false"
18
+ show-icon
19
+ :title="$t('login.mockMode')"
20
+ />
21
+
22
+ <ElForm
23
+ ref="formRef"
24
+ :model="formData"
25
+ :rules="rules"
26
+ class="login-form"
27
+ @keyup.enter="handleSubmit"
28
+ >
29
+ <ElFormItem prop="username">
30
+ <ElInput
31
+ v-model.trim="formData.username"
32
+ class="custom-height"
33
+ :placeholder="$t('login.placeholder.username')"
34
+ autocomplete="username"
35
+ autofocus
36
+ />
37
+ </ElFormItem>
38
+
39
+ <ElFormItem prop="password">
40
+ <ElInput
41
+ v-model="formData.password"
42
+ class="custom-height"
43
+ :placeholder="$t('login.placeholder.password')"
44
+ type="password"
45
+ autocomplete="current-password"
46
+ show-password
47
+ />
48
+ </ElFormItem>
49
+
50
+ <p class="security-note">
51
+ <ArtSvgIcon icon="ri:shield-check-line" aria-hidden="true" />
52
+ {{ $t('login.mockSecurityNote') }}
53
+ </p>
54
+
55
+ <ElButton
56
+ class="w-full custom-height login-button"
57
+ type="primary"
58
+ :loading="loading"
59
+ v-ripple
60
+ @click="handleSubmit"
61
+ >
62
+ {{ $t('login.mockBtnText') }}
63
+ </ElButton>
64
+ </ElForm>
65
+ </div>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </template>
70
+
71
+ <script setup lang="ts">
72
+ import AppConfig from '@/config'
73
+ import { useUserStore } from '@/store/modules/user'
74
+ import { useI18n } from 'vue-i18n'
75
+ import { fetchLogin } from '@/api/auth'
76
+ import { ElMessage, ElNotification, type FormInstance, type FormRules } from 'element-plus'
77
+ import { MOCK_AUTH_ACCOUNT } from '@/mock/auth'
78
+
79
+ defineOptions({ name: 'Login' })
80
+
81
+ const { t } = useI18n()
82
+ const userStore = useUserStore()
83
+ const router = useRouter()
84
+ const route = useRoute()
85
+ const systemName = AppConfig.systemInfo.name
86
+
87
+ const formRef = ref<FormInstance>()
88
+ const loading = ref(false)
89
+
90
+ const formData = reactive({
91
+ username: MOCK_AUTH_ACCOUNT.username,
92
+ password: MOCK_AUTH_ACCOUNT.password
93
+ })
94
+
95
+ const rules = computed<FormRules>(() => ({
96
+ username: [{ required: true, message: t('login.placeholder.username'), trigger: 'blur' }],
97
+ password: [{ required: true, message: t('login.placeholder.password'), trigger: 'blur' }]
98
+ }))
99
+
100
+ const handleSubmit = async () => {
101
+ if (!formRef.value || loading.value) return
102
+
103
+ const valid = await formRef.value.validate().catch(() => false)
104
+ if (!valid) return
105
+
106
+ try {
107
+ loading.value = true
108
+ const username = formData.username.trim()
109
+ const { accessToken, refreshToken } = await fetchLogin({
110
+ username,
111
+ password: formData.password
112
+ })
113
+
114
+ if (!accessToken) throw new Error('登录响应中缺少访问令牌')
115
+
116
+ userStore.establishSession(accessToken, refreshToken)
117
+ showLoginSuccessNotice()
118
+ await router.replace(getSafeRedirect())
119
+ } catch (error) {
120
+ console.error('[Login] 登录失败:', error)
121
+ ElMessage.error(error instanceof Error ? error.message : t('login.unexpectedError'))
122
+ } finally {
123
+ loading.value = false
124
+ }
125
+ }
126
+
127
+ const getSafeRedirect = (): string => {
128
+ const redirect = typeof route.query.redirect === 'string' ? route.query.redirect : '/'
129
+ return redirect.startsWith('/') && !redirect.startsWith('//') ? redirect : '/'
130
+ }
131
+
132
+ const showLoginSuccessNotice = () => {
133
+ ElNotification({
134
+ title: t('login.success.title'),
135
+ type: 'success',
136
+ duration: 2500,
137
+ zIndex: 10000,
138
+ message: `${t('login.success.message')}, ${systemName}!`
139
+ })
140
+ }
141
+ </script>
142
+
143
+ <style scoped>
144
+ @import './style.css';
145
+
146
+ .login-form {
147
+ margin-top: 25px;
148
+ }
149
+
150
+ .mock-alert {
151
+ margin-top: 20px;
152
+ }
153
+
154
+ .security-note {
155
+ display: flex;
156
+ gap: 6px;
157
+ align-items: center;
158
+ margin-top: 8px;
159
+ font-size: 12px;
160
+ color: var(--art-gray-500);
161
+ }
162
+
163
+ .login-button {
164
+ margin-top: 24px;
165
+ }
166
+ </style>
@@ -0,0 +1,38 @@
1
+ @reference '@styles/core/tailwind.css';
2
+
3
+ /* 授权页右侧区域 */
4
+ .auth-right-wrap {
5
+ @apply absolute inset-0 w-[440px] h-[650px] py-[5px] m-auto overflow-hidden
6
+ max-sm:px-7 max-sm:w-full
7
+ animate-[slideInRight_0.6s_cubic-bezier(0.25,0.46,0.45,0.94)_forwards]
8
+ max-md:animate-none;
9
+
10
+ .form {
11
+ @apply h-full py-[40px];
12
+ }
13
+
14
+ .title {
15
+ @apply text-g-900 text-4xl font-semibold max-md:text-3xl max-sm:pt-10;
16
+ }
17
+
18
+ .sub-title {
19
+ @apply mt-[10px] text-g-600 text-sm;
20
+ }
21
+
22
+ .custom-height {
23
+ @apply !h-[40px];
24
+ }
25
+ }
26
+
27
+ /* 滑入动画 */
28
+ @keyframes slideInRight {
29
+ from {
30
+ opacity: 0;
31
+ transform: translateX(30px);
32
+ }
33
+
34
+ to {
35
+ opacity: 1;
36
+ transform: translateX(0);
37
+ }
38
+ }
@@ -0,0 +1,240 @@
1
+ <!-- 注册页面 -->
2
+ <template>
3
+ <div class="flex w-full h-screen">
4
+ <LoginLeftView />
5
+
6
+ <div class="relative flex-1">
7
+ <AuthTopBar />
8
+
9
+ <div class="auth-right-wrap">
10
+ <div class="form">
11
+ <h3 class="title">{{ $t('register.title') }}</h3>
12
+ <p class="sub-title">{{ $t('register.subTitle') }}</p>
13
+ <ElForm
14
+ class="mt-7.5"
15
+ ref="formRef"
16
+ :model="formData"
17
+ :rules="rules"
18
+ label-position="top"
19
+ :key="formKey"
20
+ >
21
+ <ElFormItem prop="username">
22
+ <ElInput
23
+ class="custom-height"
24
+ v-model.trim="formData.username"
25
+ :placeholder="$t('register.placeholder.username')"
26
+ />
27
+ </ElFormItem>
28
+
29
+ <ElFormItem prop="password">
30
+ <ElInput
31
+ class="custom-height"
32
+ v-model.trim="formData.password"
33
+ :placeholder="$t('register.placeholder.password')"
34
+ type="password"
35
+ autocomplete="off"
36
+ show-password
37
+ />
38
+ </ElFormItem>
39
+
40
+ <ElFormItem prop="confirmPassword">
41
+ <ElInput
42
+ class="custom-height"
43
+ v-model.trim="formData.confirmPassword"
44
+ :placeholder="$t('register.placeholder.confirmPassword')"
45
+ type="password"
46
+ autocomplete="off"
47
+ @keyup.enter="register"
48
+ show-password
49
+ />
50
+ </ElFormItem>
51
+
52
+ <ElFormItem prop="agreement">
53
+ <ElCheckbox v-model="formData.agreement">
54
+ {{ $t('register.agreeText') }}
55
+ <RouterLink
56
+ style="color: var(--theme-color); text-decoration: none"
57
+ to="/privacy-policy"
58
+ >{{ $t('register.privacyPolicy') }}</RouterLink
59
+ >
60
+ </ElCheckbox>
61
+ </ElFormItem>
62
+
63
+ <div style="margin-top: 15px">
64
+ <ElButton
65
+ class="w-full custom-height"
66
+ type="primary"
67
+ @click="register"
68
+ :loading="loading"
69
+ v-ripple
70
+ >
71
+ {{ $t('register.submitBtnText') }}
72
+ </ElButton>
73
+ </div>
74
+
75
+ <div class="mt-5 text-sm text-g-600">
76
+ <span>{{ $t('register.hasAccount') }}</span>
77
+ <RouterLink class="text-theme" :to="{ name: 'Login' }">{{
78
+ $t('register.toLogin')
79
+ }}</RouterLink>
80
+ </div>
81
+ </ElForm>
82
+ </div>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ </template>
87
+
88
+ <script setup lang="ts">
89
+ import { useI18n } from 'vue-i18n'
90
+ import { ElMessage, type FormInstance, type FormRules } from 'element-plus'
91
+
92
+ defineOptions({ name: 'Register' })
93
+
94
+ interface RegisterForm {
95
+ username: string
96
+ password: string
97
+ confirmPassword: string
98
+ agreement: boolean
99
+ }
100
+
101
+ const USERNAME_MIN_LENGTH = 3
102
+ const USERNAME_MAX_LENGTH = 20
103
+ const PASSWORD_MIN_LENGTH = 6
104
+ const REDIRECT_DELAY = 1000
105
+
106
+ const { t, locale } = useI18n()
107
+ const router = useRouter()
108
+ const formRef = ref<FormInstance>()
109
+
110
+ const loading = ref(false)
111
+ const formKey = ref(0)
112
+
113
+ // 监听语言切换,重置表单
114
+ watch(locale, () => {
115
+ formKey.value++
116
+ })
117
+
118
+ const formData = reactive<RegisterForm>({
119
+ username: '',
120
+ password: '',
121
+ confirmPassword: '',
122
+ agreement: false
123
+ })
124
+
125
+ /**
126
+ * 验证密码
127
+ * 当密码输入后,如果确认密码已填写,则触发确认密码的验证
128
+ */
129
+ const validatePassword = (_rule: any, value: string, callback: (error?: Error) => void) => {
130
+ if (!value) {
131
+ callback(new Error(t('register.placeholder.password')))
132
+ return
133
+ }
134
+
135
+ if (formData.confirmPassword) {
136
+ formRef.value?.validateField('confirmPassword')
137
+ }
138
+
139
+ callback()
140
+ }
141
+
142
+ /**
143
+ * 验证确认密码
144
+ * 检查确认密码是否与密码一致
145
+ */
146
+ const validateConfirmPassword = (
147
+ _rule: any,
148
+ value: string,
149
+ callback: (error?: Error) => void
150
+ ) => {
151
+ if (!value) {
152
+ callback(new Error(t('register.rule.confirmPasswordRequired')))
153
+ return
154
+ }
155
+
156
+ if (value !== formData.password) {
157
+ callback(new Error(t('register.rule.passwordMismatch')))
158
+ return
159
+ }
160
+
161
+ callback()
162
+ }
163
+
164
+ /**
165
+ * 验证用户协议
166
+ * 确保用户已勾选同意协议
167
+ */
168
+ const validateAgreement = (_rule: any, value: boolean, callback: (error?: Error) => void) => {
169
+ if (!value) {
170
+ callback(new Error(t('register.rule.agreementRequired')))
171
+ return
172
+ }
173
+ callback()
174
+ }
175
+
176
+ const rules = computed<FormRules<RegisterForm>>(() => ({
177
+ username: [
178
+ { required: true, message: t('register.placeholder.username'), trigger: 'blur' },
179
+ {
180
+ min: USERNAME_MIN_LENGTH,
181
+ max: USERNAME_MAX_LENGTH,
182
+ message: t('register.rule.usernameLength'),
183
+ trigger: 'blur'
184
+ }
185
+ ],
186
+ password: [
187
+ { required: true, validator: validatePassword, trigger: 'blur' },
188
+ { min: PASSWORD_MIN_LENGTH, message: t('register.rule.passwordLength'), trigger: 'blur' }
189
+ ],
190
+ confirmPassword: [{ required: true, validator: validateConfirmPassword, trigger: 'blur' }],
191
+ agreement: [{ validator: validateAgreement, trigger: 'change' }]
192
+ }))
193
+
194
+ /**
195
+ * 注册用户
196
+ * 验证表单后提交注册请求
197
+ */
198
+ const register = async () => {
199
+ if (!formRef.value) return
200
+
201
+ try {
202
+ await formRef.value.validate()
203
+ loading.value = true
204
+
205
+ // TODO: 替换为真实 API 调用
206
+ // const params = {
207
+ // username: formData.username,
208
+ // password: formData.password
209
+ // }
210
+ // const res = await AuthService.register(params)
211
+ // if (res.code === ApiStatus.success) {
212
+ // ElMessage.success('注册成功')
213
+ // toLogin()
214
+ // }
215
+
216
+ // 模拟注册请求
217
+ setTimeout(() => {
218
+ loading.value = false
219
+ ElMessage.success('注册成功')
220
+ toLogin()
221
+ }, REDIRECT_DELAY)
222
+ } catch (error) {
223
+ console.error('表单验证失败:', error)
224
+ loading.value = false
225
+ }
226
+ }
227
+
228
+ /**
229
+ * 跳转到登录页面
230
+ */
231
+ const toLogin = () => {
232
+ setTimeout(() => {
233
+ router.push({ name: 'Login' })
234
+ }, REDIRECT_DELAY)
235
+ }
236
+ </script>
237
+
238
+ <style scoped>
239
+ @import '../login/style.css';
240
+ </style>
@@ -0,0 +1,173 @@
1
+ <template>
2
+ <main class="starter-home" aria-labelledby="starter-title">
3
+ <section class="starter-hero art-card">
4
+ <div class="starter-hero__icon" aria-hidden="true">
5
+ <ArtSvgIcon icon="ri:layout-grid-line" />
6
+ </div>
7
+ <div>
8
+ <p class="starter-hero__eyebrow">ADMIN FOUNDATION</p>
9
+ <h1 id="starter-title">{{ AppConfig.systemInfo.name }}</h1>
10
+ <p class="starter-hero__description">{{ AppConfig.systemInfo.description }}</p>
11
+ </div>
12
+ </section>
13
+
14
+ <section class="starter-grid" aria-label="模板使用入口">
15
+ <article v-for="item in starterItems" :key="item.title" class="starter-card art-card">
16
+ <span class="starter-card__icon" aria-hidden="true">
17
+ <ArtSvgIcon :icon="item.icon" />
18
+ </span>
19
+ <h2>{{ item.title }}</h2>
20
+ <p>{{ item.description }}</p>
21
+ <code>{{ item.location }}</code>
22
+ </article>
23
+ </section>
24
+ </main>
25
+ </template>
26
+
27
+ <script setup lang="ts">
28
+ import AppConfig from '@/config'
29
+
30
+ defineOptions({ name: 'Console' })
31
+
32
+ const starterItems = [
33
+ {
34
+ title: '配置应用',
35
+ description: '统一设置名称、Logo、主题、首页和功能开关。',
36
+ location: 'src/config/index.ts',
37
+ icon: 'ri:settings-3-line'
38
+ },
39
+ {
40
+ title: '添加模块',
41
+ description: '通过独立路由模块接入项目页面,保持底座与业务隔离。',
42
+ location: 'src/router/modules',
43
+ icon: 'ri:route-line'
44
+ },
45
+ {
46
+ title: '接入服务',
47
+ description: '在适配器中转换项目协议,避免页面依赖后端字段。',
48
+ location: 'src/adapters',
49
+ icon: 'ri:plug-line'
50
+ }
51
+ ]
52
+ </script>
53
+
54
+ <style scoped lang="scss">
55
+ .starter-home {
56
+ display: grid;
57
+ gap: 16px;
58
+ }
59
+
60
+ .starter-hero {
61
+ display: flex;
62
+ gap: 20px;
63
+ align-items: center;
64
+ min-height: 210px;
65
+ padding: clamp(24px, 4vw, 48px);
66
+ background:
67
+ radial-gradient(circle at 92% 12%, rgb(59 130 246 / 18%), transparent 34%),
68
+ var(--default-box-color);
69
+ }
70
+
71
+ .starter-hero__icon,
72
+ .starter-card__icon {
73
+ display: grid;
74
+ flex: 0 0 auto;
75
+ place-items: center;
76
+ color: var(--el-color-primary);
77
+ background: var(--el-color-primary-light-9);
78
+ border-radius: var(--custom-radius);
79
+ }
80
+
81
+ .starter-hero__icon {
82
+ width: 64px;
83
+ height: 64px;
84
+ font-size: 30px;
85
+ }
86
+
87
+ .starter-hero__eyebrow {
88
+ margin-bottom: 8px;
89
+ font-size: 12px;
90
+ font-weight: 700;
91
+ color: var(--el-color-primary);
92
+ letter-spacing: 0.12em;
93
+ }
94
+
95
+ h1 {
96
+ font-size: clamp(28px, 4vw, 40px);
97
+ font-weight: 650;
98
+ line-height: 1.2;
99
+ color: var(--art-gray-900);
100
+ }
101
+
102
+ .starter-hero__description {
103
+ max-width: 680px;
104
+ margin-top: 12px;
105
+ font-size: 16px;
106
+ line-height: 1.7;
107
+ color: var(--art-gray-700);
108
+ }
109
+
110
+ .starter-grid {
111
+ display: grid;
112
+ grid-template-columns: repeat(3, minmax(0, 1fr));
113
+ gap: 16px;
114
+ }
115
+
116
+ .starter-card {
117
+ min-height: 210px;
118
+ padding: 24px;
119
+ }
120
+
121
+ .starter-card__icon {
122
+ width: 44px;
123
+ height: 44px;
124
+ margin-bottom: 22px;
125
+ font-size: 22px;
126
+ }
127
+
128
+ .starter-card h2 {
129
+ font-size: 18px;
130
+ font-weight: 600;
131
+ color: var(--art-gray-900);
132
+ }
133
+
134
+ .starter-card p {
135
+ min-height: 48px;
136
+ margin: 10px 0 18px;
137
+ font-size: 14px;
138
+ line-height: 1.7;
139
+ color: var(--art-gray-600);
140
+ }
141
+
142
+ .starter-card code {
143
+ display: inline-block;
144
+ padding: 5px 9px;
145
+ font-size: 12px;
146
+ color: var(--art-gray-700);
147
+ overflow-wrap: anywhere;
148
+ background: var(--art-gray-100);
149
+ border-radius: 6px;
150
+ }
151
+
152
+ @media (width <= 900px) {
153
+ .starter-grid {
154
+ grid-template-columns: 1fr;
155
+ }
156
+
157
+ .starter-card {
158
+ min-height: auto;
159
+ }
160
+ }
161
+
162
+ @media (width <= 600px) {
163
+ .starter-hero {
164
+ align-items: flex-start;
165
+ }
166
+
167
+ .starter-hero__icon {
168
+ width: 48px;
169
+ height: 48px;
170
+ font-size: 24px;
171
+ }
172
+ }
173
+ </style>