@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,273 @@
1
+ /**
2
+ * 颜色处理工具模块
3
+ *
4
+ * 提供完整的颜色格式转换和处理功能
5
+ *
6
+ * ## 主要功能
7
+ *
8
+ * - Hex 与 RGB/RGBA 格式互转
9
+ * - 颜色混合计算
10
+ * - 颜色变浅/变深处理
11
+ * - Element Plus 主题色自动生成
12
+ * - 颜色格式验证
13
+ * - CSS 变量读取
14
+ * - 暗黑模式颜色适配
15
+ *
16
+ * ## 使用场景
17
+ *
18
+ * - 主题色动态切换
19
+ * - Element Plus 组件主题定制
20
+ * - 颜色渐变生成
21
+ * - 明暗主题颜色计算
22
+ * - 颜色格式标准化
23
+ *
24
+ * ## 核心功能
25
+ *
26
+ * - hexToRgba: Hex 转 RGBA(支持透明度)
27
+ * - hexToRgb: Hex 转 RGB 数组
28
+ * - rgbToHex: RGB 转 Hex
29
+ * - colourBlend: 两种颜色混合
30
+ * - getLightColor: 生成变浅的颜色
31
+ * - getDarkColor: 生成变深的颜色
32
+ * - handleElementThemeColor: 处理 Element Plus 主题色
33
+ * - setElementThemeColor: 设置完整的主题色系统
34
+ *
35
+ * ## 支持格式
36
+ *
37
+ * - Hex: #FFF, #FFFFFF
38
+ * - RGB: rgb(255, 255, 255)
39
+ * - RGBA: rgba(255, 255, 255, 0.5)
40
+ *
41
+ * @module utils/ui/colors
42
+ * @author Art Design Pro Team
43
+ */
44
+ import { useSettingStore } from '@/store/modules/setting'
45
+
46
+ /**
47
+ * 颜色转换结果接口
48
+ */
49
+ interface RgbaResult {
50
+ red: number
51
+ green: number
52
+ blue: number
53
+ rgba: string
54
+ }
55
+
56
+ /**
57
+ * 获取CSS变量值(别名函数)
58
+ * @param name CSS变量名
59
+ * @returns CSS变量值
60
+ */
61
+ export function getCssVar(name: string): string {
62
+ return getComputedStyle(document.documentElement).getPropertyValue(name)
63
+ }
64
+
65
+ /**
66
+ * 验证hex颜色格式
67
+ * @param hex hex颜色值
68
+ * @returns 是否为有效的hex颜色
69
+ */
70
+ function isValidHexColor(hex: string): boolean {
71
+ const cleanHex = hex.trim().replace(/^#/, '')
72
+ return /^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(cleanHex)
73
+ }
74
+
75
+ /**
76
+ * 验证RGB颜色值
77
+ * @param r 红色值
78
+ * @param g 绿色值
79
+ * @param b 蓝色值
80
+ * @returns 是否为有效的RGB值
81
+ */
82
+ function isValidRgbValue(r: number, g: number, b: number): boolean {
83
+ const isValid = (value: number) => Number.isInteger(value) && value >= 0 && value <= 255
84
+ return isValid(r) && isValid(g) && isValid(b)
85
+ }
86
+
87
+ /**
88
+ * 将hex颜色转换为RGBA
89
+ * @param hex hex颜色值 (支持 #FFF 或 #FFFFFF 格式)
90
+ * @param opacity 透明度 (0-1)
91
+ * @returns 包含RGB值和RGBA字符串的对象
92
+ */
93
+ export function hexToRgba(hex: string, opacity: number): RgbaResult {
94
+ if (!isValidHexColor(hex)) {
95
+ throw new Error('Invalid hex color format')
96
+ }
97
+
98
+ // 移除可能存在的 # 前缀并转换为大写
99
+ let cleanHex = hex.trim().replace(/^#/, '').toUpperCase()
100
+
101
+ // 如果是缩写形式(如 FFF),转换为完整形式
102
+ if (cleanHex.length === 3) {
103
+ cleanHex = cleanHex
104
+ .split('')
105
+ .map((char) => char.repeat(2))
106
+ .join('')
107
+ }
108
+
109
+ // 解析 RGB 值
110
+ const [red, green, blue] = cleanHex.match(/\w\w/g)!.map((x) => parseInt(x, 16))
111
+
112
+ // 确保 opacity 在有效范围内
113
+ const validOpacity = Math.max(0, Math.min(1, opacity))
114
+
115
+ // 构建 RGBA 字符串
116
+ const rgba = `rgba(${red}, ${green}, ${blue}, ${validOpacity.toFixed(2)})`
117
+
118
+ return { red, green, blue, rgba }
119
+ }
120
+
121
+ /**
122
+ * 将hex颜色转换为RGB数组
123
+ * @param hexColor hex颜色值
124
+ * @returns RGB数组 [r, g, b]
125
+ */
126
+ export function hexToRgb(hexColor: string): number[] {
127
+ if (!isValidHexColor(hexColor)) {
128
+ ElMessage.warning('输入错误的hex颜色值')
129
+ throw new Error('Invalid hex color format')
130
+ }
131
+
132
+ const cleanHex = hexColor.replace(/^#/, '')
133
+ let hex = cleanHex
134
+
135
+ // 处理缩写形式
136
+ if (hex.length === 3) {
137
+ hex = hex
138
+ .split('')
139
+ .map((char) => char.repeat(2))
140
+ .join('')
141
+ }
142
+
143
+ const hexPairs = hex.match(/../g)
144
+ if (!hexPairs) {
145
+ throw new Error('Invalid hex color format')
146
+ }
147
+
148
+ return hexPairs.map((hexPair) => parseInt(hexPair, 16))
149
+ }
150
+
151
+ /**
152
+ * 将RGB颜色转换为hex
153
+ * @param r 红色值 (0-255)
154
+ * @param g 绿色值 (0-255)
155
+ * @param b 蓝色值 (0-255)
156
+ * @returns hex颜色值
157
+ */
158
+ export function rgbToHex(r: number, g: number, b: number): string {
159
+ if (!isValidRgbValue(r, g, b)) {
160
+ ElMessage.warning('输入错误的RGB颜色值')
161
+ throw new Error('Invalid RGB color values')
162
+ }
163
+
164
+ const toHex = (value: number) => {
165
+ const hex = value.toString(16)
166
+ return hex.length === 1 ? `0${hex}` : hex
167
+ }
168
+
169
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`
170
+ }
171
+
172
+ /**
173
+ * 颜色混合
174
+ * @param color1 第一个颜色
175
+ * @param color2 第二个颜色
176
+ * @param ratio 混合比例 (0-1)
177
+ * @returns 混合后的颜色
178
+ */
179
+ export function colourBlend(color1: string, color2: string, ratio: number): string {
180
+ const validRatio = Math.max(0, Math.min(1, Number(ratio)))
181
+
182
+ const rgb1 = hexToRgb(color1)
183
+ const rgb2 = hexToRgb(color2)
184
+
185
+ const blendedRgb = rgb1.map((value1, index) => {
186
+ const value2 = rgb2[index]
187
+ return Math.round(value1 * (1 - validRatio) + value2 * validRatio)
188
+ })
189
+
190
+ return rgbToHex(blendedRgb[0], blendedRgb[1], blendedRgb[2])
191
+ }
192
+
193
+ /**
194
+ * 获取变浅的颜色
195
+ * @param color 原始颜色
196
+ * @param level 变浅程度 (0-1)
197
+ * @param isDark 是否为暗色主题
198
+ * @returns 变浅后的颜色
199
+ */
200
+ export function getLightColor(color: string, level: number, isDark: boolean = false): string {
201
+ if (!isValidHexColor(color)) {
202
+ ElMessage.warning('输入错误的hex颜色值')
203
+ throw new Error('Invalid hex color format')
204
+ }
205
+
206
+ if (isDark) {
207
+ return getDarkColor(color, level)
208
+ }
209
+
210
+ const rgb = hexToRgb(color)
211
+ const lightRgb = rgb.map((value) => Math.floor((255 - value) * level + value))
212
+
213
+ return rgbToHex(lightRgb[0], lightRgb[1], lightRgb[2])
214
+ }
215
+
216
+ /**
217
+ * 获取变深的颜色
218
+ * @param color 原始颜色
219
+ * @param level 变深程度 (0-1)
220
+ * @returns 变深后的颜色
221
+ */
222
+ export function getDarkColor(color: string, level: number): string {
223
+ if (!isValidHexColor(color)) {
224
+ ElMessage.warning('输入错误的hex颜色值')
225
+ throw new Error('Invalid hex color format')
226
+ }
227
+
228
+ const rgb = hexToRgb(color)
229
+ const darkRgb = rgb.map((value) => Math.floor(value * (1 - level)))
230
+
231
+ return rgbToHex(darkRgb[0], darkRgb[1], darkRgb[2])
232
+ }
233
+
234
+ /**
235
+ * 处理 Element Plus 主题颜色
236
+ * @param theme 主题颜色
237
+ * @param isDark 是否为暗色主题
238
+ */
239
+ export function handleElementThemeColor(theme: string, isDark: boolean = false): void {
240
+ document.documentElement.style.setProperty('--el-color-primary', theme)
241
+
242
+ for (let i = 1; i <= 9; i++) {
243
+ document.documentElement.style.setProperty(
244
+ `--el-color-primary-light-${i}`,
245
+ getLightColor(theme, i / 10, isDark)
246
+ )
247
+ }
248
+
249
+ for (let i = 1; i <= 9; i++) {
250
+ document.documentElement.style.setProperty(
251
+ `--el-color-primary-dark-${i}`,
252
+ getDarkColor(theme, i / 10)
253
+ )
254
+ }
255
+ }
256
+
257
+ /**
258
+ * 设置 Element Plus 主题颜色
259
+ * @param color 主题颜色
260
+ */
261
+ export function setElementThemeColor(color: string): void {
262
+ const mixColor = '#ffffff'
263
+ const elStyle = document.documentElement.style
264
+
265
+ elStyle.setProperty('--el-color-primary', color)
266
+ handleElementThemeColor(color, useSettingStore().isDark)
267
+
268
+ // 生成更淡一点的颜色
269
+ for (let i = 1; i < 16; i++) {
270
+ const itemColor = colourBlend(color, mixColor, i / 16)
271
+ elStyle.setProperty(`--el-color-primary-custom-${i}`, itemColor)
272
+ }
273
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 表情
3
+ * 用于在消息提示的时候显示对应的表情
4
+ *
5
+ * 用法
6
+ * ElMessage.success(`${EmojiText[200]} 图片上传成功`)
7
+ * ElMessage.error(`${EmojiText[400]} 图片上传失败`)
8
+ * ElMessage.error(`${EmojiText[500]} 图片上传失败`)
9
+ *
10
+ * @module utils/ui/emojo
11
+ * @author Art Design Pro Team
12
+ */
13
+
14
+ // macos 用户 按 shift + 6 可以唤出更多表情……
15
+ const EmojiText: { [key: string]: string } = {
16
+ '0': 'O_O', // 空
17
+ '200': '^_^', // 成功
18
+ '400': 'T_T', // 错误请求
19
+ '500': 'X_X' // 服务器内部错误,无法完成请求
20
+ }
21
+
22
+ // const EmojiIcon = ['🟢', '🔴', '🟡 ', '🚀', '✨', '💡', '🛠️', '🔥', '🎉', '🌟', '🌈']
23
+
24
+ export default EmojiText
@@ -0,0 +1,31 @@
1
+ /**
2
+ * 离线图标加载器
3
+ *
4
+ * 用于在内网环境下支持 Iconify 图标的离线加载。
5
+ * 通过预加载图标集数据,避免运行时从 CDN 获取图标。
6
+ *
7
+ * 使用方式:
8
+ * 1. 安装所需图标集:pnpm add -D @iconify-json/[icon-set-name]
9
+ * 2. 在此文件中导入并注册图标集
10
+ * 3. 在组件中使用:<ArtSvgIcon icon="ri:home-line" />
11
+ *
12
+ * @module utils/ui/iconify-loader
13
+ * @author Art Design Pro Team
14
+ */
15
+
16
+ // import { addCollection } from '@iconify/vue'
17
+
18
+ // // 导入离线图标数据
19
+
20
+ // // 系统必要图标库
21
+ // import riIcons from '@iconify-json/ri/icons.json'
22
+
23
+ // // 演示图标库(可选,生产环境可移除)
24
+ // import svgSpinners from '@iconify-json/svg-spinners/icons.json'
25
+ // import lineMd from '@iconify-json/line-md/icons.json'
26
+
27
+ // // 注册离线图标集
28
+
29
+ // addCollection(riIcons)
30
+ // addCollection(svgSpinners)
31
+ // addCollection(lineMd)
@@ -0,0 +1,11 @@
1
+ /**
2
+ * UI 相关工具函数统一导出
3
+ *
4
+ * @module utils/ui/index
5
+ * @author Art Design Pro Team
6
+ */
7
+
8
+ export * from './colors'
9
+ export * from './loading'
10
+ export * from './tabs'
11
+ export * from './emojo'
@@ -0,0 +1,158 @@
1
+ /**
2
+ * 全局 Loading 加载管理模块
3
+ *
4
+ * 提供统一的全屏加载动画管理
5
+ *
6
+ * ## 主要功能
7
+ *
8
+ * - 全屏 Loading 显示和隐藏
9
+ * - 跟随亮色/暗色主题的全屏背景与稳定居中布局
10
+ * - 四点图标与逐字聚合加载动画
11
+ * - 单例模式防止重复创建
12
+ * - 锁定页面交互
13
+ *
14
+ * ## 使用场景
15
+ *
16
+ * - 页面初始化加载
17
+ * - 大量数据请求
18
+ * - 路由切换过渡
19
+ * - 异步操作等待
20
+ *
21
+ * ## 特性
22
+ *
23
+ * - 使用自定义 SVG 动画(四点旋转)
24
+ * - 文字碎片逐字聚合并反向散开
25
+ * - 单例模式确保同时只有一个 Loading
26
+ * - 提供便捷的显示/隐藏方法
27
+ *
28
+ * @module utils/ui/loading
29
+ * @author Art Design Pro Team
30
+ */
31
+ import { createVNode, render } from 'vue'
32
+ import ArtPageLoading from '@/components/core/feedback/art-page-loading/index.vue'
33
+ import AppConfig from '@/config'
34
+
35
+ interface LoadingInstance {
36
+ close: () => void
37
+ setLeaving: (leaving: boolean) => void
38
+ }
39
+
40
+ const LOADING_ANIMATION_DURATION = 1000
41
+ const LOADING_EXIT_DURATION = 220
42
+
43
+ let loadingInstance: LoadingInstance | null = null
44
+ let previousBodyOverflow = ''
45
+ let loadingStartedAt = 0
46
+ let hideTimer: number | null = null
47
+ let isLeaving = false
48
+
49
+ const prefersReducedMotion = (): boolean =>
50
+ window.matchMedia?.('(prefers-reduced-motion: reduce)').matches ?? false
51
+
52
+ const createLoading = (): LoadingInstance => {
53
+ const container = document.createElement('div')
54
+ previousBodyOverflow = document.body.style.overflow
55
+ document.body.style.overflow = 'hidden'
56
+ document.body.appendChild(container)
57
+
58
+ const renderLoading = (leaving: boolean): void => {
59
+ render(
60
+ createVNode(ArtPageLoading, {
61
+ text: AppConfig.systemInfo.name,
62
+ fullscreen: true,
63
+ duration: LOADING_ANIMATION_DURATION,
64
+ leaving,
65
+ exitDuration: LOADING_EXIT_DURATION
66
+ }),
67
+ container
68
+ )
69
+ }
70
+
71
+ renderLoading(false)
72
+
73
+ return {
74
+ setLeaving: renderLoading,
75
+ close: () => {
76
+ render(null, container)
77
+ container.remove()
78
+ document.body.style.overflow = previousBodyOverflow
79
+ }
80
+ }
81
+ }
82
+
83
+ const clearHideTimer = (): void => {
84
+ if (hideTimer !== null) {
85
+ clearTimeout(hideTimer)
86
+ hideTimer = null
87
+ }
88
+ }
89
+
90
+ const closeLoadingImmediately = (): void => {
91
+ clearHideTimer()
92
+
93
+ if (loadingInstance) {
94
+ loadingInstance.close()
95
+ loadingInstance = null
96
+ loadingStartedAt = 0
97
+ isLeaving = false
98
+ }
99
+ }
100
+
101
+ const startLoadingExit = (): void => {
102
+ if (!loadingInstance) {
103
+ return
104
+ }
105
+
106
+ if (prefersReducedMotion()) {
107
+ closeLoadingImmediately()
108
+ return
109
+ }
110
+
111
+ isLeaving = true
112
+ loadingInstance.setLeaving(true)
113
+ hideTimer = window.setTimeout(closeLoadingImmediately, LOADING_EXIT_DURATION)
114
+ }
115
+
116
+ export const loadingService = {
117
+ /**
118
+ * 显示 loading
119
+ * @returns 关闭 loading 的函数
120
+ */
121
+ showLoading(): () => void {
122
+ const wasLeaving = isLeaving
123
+ clearHideTimer()
124
+
125
+ if (!loadingInstance) {
126
+ loadingStartedAt = Date.now()
127
+ loadingInstance = createLoading()
128
+ } else if (wasLeaving) {
129
+ isLeaving = false
130
+ loadingStartedAt = Date.now()
131
+ loadingInstance.setLeaving(false)
132
+ }
133
+ return () => this.hideLoading()
134
+ },
135
+
136
+ /**
137
+ * 隐藏 loading
138
+ */
139
+ hideLoading(): void {
140
+ if (!loadingInstance || hideTimer !== null) {
141
+ return
142
+ }
143
+
144
+ const minimumVisibleDuration = prefersReducedMotion() ? 0 : LOADING_ANIMATION_DURATION
145
+ const elapsedTime = Date.now() - loadingStartedAt
146
+ const remainingTime = minimumVisibleDuration - elapsedTime
147
+
148
+ if (remainingTime <= 0) {
149
+ startLoadingExit()
150
+ return
151
+ }
152
+
153
+ hideTimer = window.setTimeout(() => {
154
+ hideTimer = null
155
+ startLoadingExit()
156
+ }, remainingTime)
157
+ }
158
+ }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * 标签页布局配置模块
3
+ *
4
+ * 提供不同标签页样式的高度和间距配置
5
+ *
6
+ * ## 主要功能
7
+ *
8
+ * - 多种标签页样式配置(默认、卡片、谷歌风格)
9
+ * - 标签页打开/关闭状态的高度管理
10
+ * - 顶部间距自动计算
11
+ * - 配置获取和默认值处理
12
+ *
13
+ * ## 使用场景
14
+ *
15
+ * - 工作标签页(Worktab)布局计算
16
+ * - 页面内容区域高度调整
17
+ * - 标签页显示/隐藏时的动画
18
+ * - 响应式布局适配
19
+ *
20
+ * ## 配置项说明
21
+ *
22
+ * - openTop: 标签页显示时,内容区域距离顶部的距离
23
+ * - closeTop: 标签页隐藏时,内容区域距离顶部的距离
24
+ * - openHeight: 标签页显示时的总高度(包含标签栏)
25
+ * - closeHeight: 标签页隐藏时的总高度(仅头部)
26
+ *
27
+ * ## 支持的样式
28
+ *
29
+ * - tab-default: 默认标签页样式
30
+ * - tab-card: 卡片式标签页
31
+ * - tab-google: 谷歌浏览器风格标签页
32
+ *
33
+ * @module utils/ui/tabs
34
+ * @author Art Design Pro Team
35
+ */
36
+ export const TAB_CONFIG = {
37
+ 'tab-default': {
38
+ openTop: 106,
39
+ closeTop: 60,
40
+ openHeight: 121,
41
+ closeHeight: 75
42
+ },
43
+ 'tab-card': {
44
+ openTop: 122,
45
+ closeTop: 78,
46
+ openHeight: 139,
47
+ closeHeight: 95
48
+ },
49
+ 'tab-google': {
50
+ openTop: 122,
51
+ closeTop: 78,
52
+ openHeight: 139,
53
+ closeHeight: 95
54
+ }
55
+ }
56
+
57
+ // 获取当前 tab 样式配置,设置默认值
58
+ export const getTabConfig = (style: string) => {
59
+ return TAB_CONFIG[style as keyof typeof TAB_CONFIG] || TAB_CONFIG['tab-card'] // 默认使用 tab-card 配置
60
+ }
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <div class="flex w-full h-screen">
3
+ <LoginLeftView />
4
+
5
+ <div class="relative flex-1">
6
+ <AuthTopBar />
7
+
8
+ <div class="auth-right-wrap">
9
+ <div class="form">
10
+ <h3 class="title">{{ $t('forgetPassword.title') }}</h3>
11
+ <p class="sub-title">{{ $t('forgetPassword.subTitle') }}</p>
12
+ <div class="mt-5">
13
+ <span class="input-label" v-if="showInputLabel">账号</span>
14
+ <ElInput
15
+ class="custom-height"
16
+ :placeholder="$t('forgetPassword.placeholder')"
17
+ v-model.trim="username"
18
+ />
19
+ </div>
20
+
21
+ <div style="margin-top: 15px">
22
+ <ElButton
23
+ class="w-full custom-height"
24
+ type="primary"
25
+ @click="register"
26
+ :loading="loading"
27
+ v-ripple
28
+ >
29
+ {{ $t('forgetPassword.submitBtnText') }}
30
+ </ElButton>
31
+ </div>
32
+
33
+ <div style="margin-top: 15px">
34
+ <ElButton class="w-full custom-height" plain @click="toLogin">
35
+ {{ $t('forgetPassword.backBtnText') }}
36
+ </ElButton>
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ </template>
43
+
44
+ <script setup lang="ts">
45
+ defineOptions({ name: 'ForgetPassword' })
46
+
47
+ const router = useRouter()
48
+ const showInputLabel = ref(false)
49
+
50
+ const username = ref('')
51
+ const loading = ref(false)
52
+
53
+ const register = async () => {}
54
+
55
+ const toLogin = () => {
56
+ router.push({ name: 'Login' })
57
+ }
58
+ </script>
59
+
60
+ <style scoped>
61
+ @import '../login/style.css';
62
+ </style>