@kevairy/template 0.1.1 → 0.1.3
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.
- package/package.json +1 -1
- package/template/.agents/skills/kevairy-ui/SKILL.md +36 -0
- package/template/.agents/skills/kevairy-ui/agents/openai.yaml +4 -0
- package/template/.agents/skills/kevairy-ui/references/component-catalog.md +45 -0
- package/template/.env +4 -0
- package/template/.prettierignore +2 -0
- package/template/AGENTS.md +15 -0
- package/template/_gitignore +4 -0
- package/template/package.json +11 -1
- package/template/scripts/gen-offline-icons.mjs +84 -0
- package/template/src/components/core/forms/art-wang-editor/index.vue +0 -5
- package/template/src/components/core/layouts/art-guide/index.vue +123 -0
- package/template/src/components/core/layouts/art-header-bar/index.vue +26 -26
- package/template/src/components/core/layouts/art-header-bar/widget/ArtUserMenu.vue +17 -1
- package/template/src/components/core/layouts/art-screen-lock/index.vue +325 -0
- package/template/src/components/core/layouts/art-settings-panel/widget/SettingActions.vue +0 -1
- package/template/src/components/core/media/art-cutter-img/index.vue +0 -1
- package/template/src/components/core/media/art-video-player/index.vue +0 -10
- package/template/src/components/core/views/login/AuthTopBar.vue +56 -6
- package/template/src/components/core/views/login/LoginLeftView.vue +24 -42
- package/template/src/config/index.ts +4 -1
- package/template/src/config/modules/component.ts +14 -0
- package/template/src/config/modules/guide.ts +122 -0
- package/template/src/config/modules/headerBar.ts +4 -0
- package/template/src/config/setting.ts +2 -2
- package/template/src/hooks/core/useGuide.ts +116 -0
- package/template/src/hooks/core/useHeaderBar.ts +6 -0
- package/template/src/locales/index.ts +0 -1
- package/template/src/locales/langs/en.json +66 -5
- package/template/src/locales/langs/zh.json +66 -5
- package/template/src/main.ts +3 -0
- package/template/src/store/modules/lock.ts +125 -0
- package/template/src/store/modules/setting.ts +8 -15
- package/template/src/store/modules/user.ts +3 -0
- package/template/src/types/config/index.ts +4 -0
- package/template/src/types/import/components.d.ts +2 -0
- package/template/src/utils/http/index.ts +3 -1
- package/template/src/utils/socket/index.ts +27 -2
- package/template/src/utils/sys/mittBus.ts +5 -0
- package/template/src/utils/ui/iconify-loader.ts +32 -18
- package/template/src/utils/ui/offline-icons.json +77 -0
- package/template/src/views/auth/login/index.vue +4 -4
- package/template/src/views/auth/login/style.css +74 -14
- package/template/src/views/examples/search-table/index.vue +2 -3
- package/template/tests/e2e/auth.spec.ts +52 -2
- package/template/tests/e2e/helpers/guide.ts +9 -0
- package/template/tests/e2e/search-table.spec.ts +11 -1
- package/template/vite.config.ts +5 -7
|
@@ -110,6 +110,8 @@ export interface AppFeatureConfig {
|
|
|
110
110
|
chat: boolean
|
|
111
111
|
watermark: boolean
|
|
112
112
|
festivalEffects: boolean
|
|
113
|
+
screenLock: boolean
|
|
114
|
+
guide: boolean
|
|
113
115
|
examples: boolean
|
|
114
116
|
}
|
|
115
117
|
|
|
@@ -250,4 +252,6 @@ export interface HeaderBarFeatureConfig {
|
|
|
250
252
|
settings: FeatureConfigItem
|
|
251
253
|
/** 主题切换 */
|
|
252
254
|
themeToggle: FeatureConfigItem
|
|
255
|
+
/** 锁屏功能 */
|
|
256
|
+
screenLock: FeatureConfigItem
|
|
253
257
|
}
|
|
@@ -35,6 +35,7 @@ declare module 'vue' {
|
|
|
35
35
|
ArtForm: typeof import('./../../components/core/forms/art-form/index.vue')['default']
|
|
36
36
|
ArtGlobalComponent: typeof import('./../../components/core/layouts/art-global-component/index.vue')['default']
|
|
37
37
|
ArtGlobalSearch: typeof import('./../../components/core/layouts/art-global-search/index.vue')['default']
|
|
38
|
+
ArtGuide: typeof import('./../../components/core/layouts/art-guide/index.vue')['default']
|
|
38
39
|
ArtHBarChart: typeof import('./../../components/core/charts/art-h-bar-chart/index.vue')['default']
|
|
39
40
|
ArtHeaderBar: typeof import('./../../components/core/layouts/art-header-bar/index.vue')['default']
|
|
40
41
|
ArtHorizontalMenu: typeof import('./../../components/core/layouts/art-menus/art-horizontal-menu/index.vue')['default']
|
|
@@ -54,6 +55,7 @@ declare module 'vue' {
|
|
|
54
55
|
ArtResultPage: typeof import('./../../components/core/views/result/ArtResultPage.vue')['default']
|
|
55
56
|
ArtRingChart: typeof import('./../../components/core/charts/art-ring-chart/index.vue')['default']
|
|
56
57
|
ArtScatterChart: typeof import('./../../components/core/charts/art-scatter-chart/index.vue')['default']
|
|
58
|
+
ArtScreenLock: typeof import('./../../components/core/layouts/art-screen-lock/index.vue')['default']
|
|
57
59
|
ArtSettingsPanel: typeof import('./../../components/core/layouts/art-settings-panel/index.vue')['default']
|
|
58
60
|
ArtSidebarMenu: typeof import('./../../components/core/layouts/art-menus/art-sidebar-menu/index.vue')['default']
|
|
59
61
|
ArtStatsCard: typeof import('./../../components/core/cards/art-stats-card/index.vue')['default']
|
|
@@ -12,7 +12,9 @@ import type { BaseResponse } from '@/types'
|
|
|
12
12
|
import { createRequestKey, isApiSuccessCode, normalizeApiCode } from './contract'
|
|
13
13
|
|
|
14
14
|
const REQUEST_TIMEOUT = 15000
|
|
15
|
-
|
|
15
|
+
// 网络类错误(超时/5xx)的最大重试次数,通过 VITE_HTTP_MAX_RETRIES 配置,默认 0(不重试)。
|
|
16
|
+
// 注意:POST 等非幂等请求重试存在重复提交风险,开启前请确认后端幂等性。
|
|
17
|
+
const MAX_RETRIES = Math.max(0, Math.floor(Number(import.meta.env.VITE_HTTP_MAX_RETRIES) || 0))
|
|
16
18
|
const RETRY_DELAY = 1000
|
|
17
19
|
const UNAUTHORIZED_DEBOUNCE_TIME = 3000
|
|
18
20
|
const REQUEST_CANCELLED_CODE = 499
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket 客户端(可选工具)
|
|
3
|
+
*
|
|
4
|
+
* 单例封装,内置心跳检测、断线重连(指数退避 + 抖动)、连接超时与离线消息队列。
|
|
5
|
+
*
|
|
6
|
+
* ## 使用说明
|
|
7
|
+
*
|
|
8
|
+
* - 模板默认不接线任何业务实时通道,本工具作为可复用能力导出,业务项目按需引入:
|
|
9
|
+
* `import { WebSocketClient } from '@/utils'`(或默认导出 `@/utils/socket`)。
|
|
10
|
+
* - 连接地址优先取 `getInstance({ url })`,否则回退到环境变量 `VITE_WEBSOCKET_URL`;
|
|
11
|
+
* 两者均未配置时跳过连接,不会抛错。
|
|
12
|
+
*
|
|
13
|
+
* @module utils/socket
|
|
14
|
+
*/
|
|
1
15
|
interface WebSocketOptions {
|
|
2
16
|
url?: string
|
|
3
17
|
messageHandler: (event: MessageEvent) => void
|
|
@@ -9,7 +23,7 @@ interface WebSocketOptions {
|
|
|
9
23
|
connectionTimeout?: number // 连接建立超时时间(ms)
|
|
10
24
|
}
|
|
11
25
|
|
|
12
|
-
export
|
|
26
|
+
export class WebSocketClient {
|
|
13
27
|
private static instance: WebSocketClient | null = null
|
|
14
28
|
private ws: WebSocket | null = null
|
|
15
29
|
private url: string
|
|
@@ -39,7 +53,8 @@ export default class WebSocketClient {
|
|
|
39
53
|
private isReconnecting: boolean = false
|
|
40
54
|
|
|
41
55
|
private constructor(options: WebSocketOptions) {
|
|
42
|
-
|
|
56
|
+
// 使用 Vite 环境变量(VITE_ 前缀);模板默认未配置,接入业务时通过 .env 提供 VITE_WEBSOCKET_URL
|
|
57
|
+
this.url = options.url || (import.meta.env.VITE_WEBSOCKET_URL as string) || ''
|
|
43
58
|
this.messageHandler = options.messageHandler
|
|
44
59
|
this.reconnectInterval = options.reconnectInterval ?? 20 * 1000 // 默认20秒
|
|
45
60
|
this.heartbeatInterval = options.heartbeatInterval ?? 5 * 1000 // 默认5秒
|
|
@@ -72,6 +87,12 @@ export default class WebSocketClient {
|
|
|
72
87
|
}
|
|
73
88
|
|
|
74
89
|
private connect(resetReconnectAttempts: boolean = false): void {
|
|
90
|
+
// 未配置 WebSocket 地址时直接跳过,避免 new WebSocket('') 抛错
|
|
91
|
+
if (!this.url) {
|
|
92
|
+
console.warn('WebSocket 地址未配置(VITE_WEBSOCKET_URL),已跳过连接')
|
|
93
|
+
return
|
|
94
|
+
}
|
|
95
|
+
|
|
75
96
|
// 如果正在连接中,不重复连接
|
|
76
97
|
if (this.isConnecting) {
|
|
77
98
|
console.log('正在建立WebSocket连接中...')
|
|
@@ -421,3 +442,7 @@ export default class WebSocketClient {
|
|
|
421
442
|
}
|
|
422
443
|
}
|
|
423
444
|
}
|
|
445
|
+
|
|
446
|
+
// 同时保留默认导出,兼容 `import WebSocketClient from '@/utils/socket'` 的旧用法;
|
|
447
|
+
// 命名导出使其可经由 `@/utils` 桶文件(export * from './socket')转发。
|
|
448
|
+
export default WebSocketClient
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
* - openSetting: 打开设置面板
|
|
37
37
|
* - openSearchDialog: 打开搜索对话框
|
|
38
38
|
* - openChat: 打开聊天窗口
|
|
39
|
+
* - openLockScreen: 打开锁屏界面
|
|
40
|
+
* - startGuide: 启动新手引导
|
|
39
41
|
*
|
|
40
42
|
* @module utils/sys/mittBus
|
|
41
43
|
* @author Art Design Pro Team
|
|
@@ -53,6 +55,9 @@ type Events = {
|
|
|
53
55
|
// 打开聊天窗口事件 - 无参数
|
|
54
56
|
openChat: void
|
|
55
57
|
// 打开锁屏事件 - 无参数
|
|
58
|
+
openLockScreen: void
|
|
59
|
+
// 启动新手引导事件 - 无参数
|
|
60
|
+
startGuide: void
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
// 创建类型安全的事件总线实例
|
|
@@ -1,31 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 离线图标加载器
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* 内网 / 离线环境下,Iconify 无法从公共 CDN(api.iconify.design)拉取图标数据,会导致
|
|
5
|
+
* 图标空白。此模块在应用启动时预注册图标集数据,使 <ArtSvgIcon icon="ri:xxx" /> 等用法
|
|
6
|
+
* 完全离线可用。
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* 图标集策略(兼顾体积与覆盖):
|
|
9
|
+
* - ri(Remix Icon):全量注册。它是项目主力图标集,菜单 / 路由的动态图标名基本都来自它,
|
|
10
|
+
* 全量注册可让业务后续新增任意 ri 图标都开箱即用(约 1MB,gzip 后 ~280KB)。
|
|
11
|
+
* - 其余图标集:仅注册项目实际用到的图标(由 scripts/gen-offline-icons.mjs 精确提取,几 KB),
|
|
12
|
+
* 避免全量打包(如 fluent / solar 单集达 10MB+)。
|
|
13
|
+
*
|
|
14
|
+
* 新增“非 ri 图标集”图标的步骤:
|
|
15
|
+
* 1. 安装图标集:pnpm add -D @iconify-json/<prefix>
|
|
16
|
+
* 2. 重新生成精简数据:pnpm gen:icons
|
|
11
17
|
*
|
|
12
18
|
* @module utils/ui/iconify-loader
|
|
13
|
-
* @author Art Design Pro Team
|
|
14
19
|
*/
|
|
20
|
+
import { addCollection, type IconifyJSON } from '@iconify/vue'
|
|
15
21
|
|
|
16
|
-
//
|
|
22
|
+
// 主力图标集:全量数据
|
|
23
|
+
import riIcons from '@iconify-json/ri/icons.json'
|
|
24
|
+
// 其余图标集的精简数据(脚本生成,请勿手动编辑)
|
|
25
|
+
import offlineIcons from './offline-icons.json'
|
|
17
26
|
|
|
18
|
-
|
|
27
|
+
/** 幂等标记,避免重复注册 */
|
|
28
|
+
let registered = false
|
|
19
29
|
|
|
20
|
-
|
|
21
|
-
|
|
30
|
+
/**
|
|
31
|
+
* 注册离线图标集(幂等,重复调用只生效一次)
|
|
32
|
+
*/
|
|
33
|
+
export function setupOfflineIcons(): void {
|
|
34
|
+
if (registered) return
|
|
22
35
|
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
// import lineMd from '@iconify-json/line-md/icons.json'
|
|
36
|
+
// 主力图标集:全量注册,覆盖所有菜单动态图标与业务常用图标
|
|
37
|
+
addCollection(riIcons as unknown as IconifyJSON)
|
|
26
38
|
|
|
27
|
-
//
|
|
39
|
+
// 其余图标集:注册精确提取的子集
|
|
40
|
+
for (const collection of offlineIcons as unknown as IconifyJSON[]) {
|
|
41
|
+
addCollection(collection)
|
|
42
|
+
}
|
|
28
43
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// addCollection(lineMd)
|
|
44
|
+
registered = true
|
|
45
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"prefix": "fluent",
|
|
4
|
+
"icons": {
|
|
5
|
+
"arrow-enter-left-20-filled": {
|
|
6
|
+
"body": "<path fill=\"currentColor\" d=\"m4.641 12.5l2.873 2.704a.75.75 0 0 1-1.028 1.092l-4.25-4a.75.75 0 0 1 0-1.092l4.25-4a.75.75 0 1 1 1.028 1.092L4.641 11H14.75a1.75 1.75 0 0 0 1.75-1.75v-4.5a.75.75 0 0 1 1.5 0v4.5a3.25 3.25 0 0 1-3.25 3.25z\"/>"
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"lastModified": 1790422098,
|
|
10
|
+
"width": 20,
|
|
11
|
+
"height": 20
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"prefix": "icon-park-outline",
|
|
15
|
+
"icons": {
|
|
16
|
+
"auto-width": {
|
|
17
|
+
"body": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"4\" d=\"M11.988 32L4 24.006L12 16m24.012 0L44 23.994L36 32M4 24h40\"/>"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"lastModified": 1754899616,
|
|
21
|
+
"width": 48,
|
|
22
|
+
"height": 48
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"prefix": "iconamoon",
|
|
26
|
+
"icons": {
|
|
27
|
+
"arrow-down-2-thin": {
|
|
28
|
+
"body": "<path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"m7 10l5 5l5-5\"/>"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"lastModified": 1722794093,
|
|
32
|
+
"width": 24,
|
|
33
|
+
"height": 24
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"prefix": "ix",
|
|
37
|
+
"icons": {
|
|
38
|
+
"width": {
|
|
39
|
+
"body": "<path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M85.333 128H42.667v256h42.666V256l79.085 79.085l30.17-30.17l-27.582-27.582h178.017l-27.583 27.584l30.17 30.17l79.057-79.057V384h42.666V128h-42.666v127.973l-79.057-79.056l-30.17 30.17l27.58 27.58H167.006l27.582-27.582l-30.17-30.17l-79.085 79.084z\" clip-rule=\"evenodd\"/>"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"lastModified": 1790785405,
|
|
43
|
+
"width": 512,
|
|
44
|
+
"height": 512
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"prefix": "solar",
|
|
48
|
+
"icons": {
|
|
49
|
+
"double-alt-arrow-right-linear": {
|
|
50
|
+
"body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M11 19L17 12L11 5\"/><path d=\"M7 19L13 12L7 5\"/></g>"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"lastModified": 1790422589,
|
|
54
|
+
"width": 24,
|
|
55
|
+
"height": 24
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"prefix": "system-uicons",
|
|
59
|
+
"icons": {
|
|
60
|
+
"inbox": {
|
|
61
|
+
"body": "<g fill=\"none\" fill-rule=\"evenodd\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M6.16 4.5h8.68a1 1 0 0 1 .92.606L18.5 11.5v4a2 2 0 0 1-2 2h-12a2 2 0 0 1-2-2v-4l2.74-6.394a1 1 0 0 1 .92-.606\"/><path d=\"M2.5 11.5h4a1 1 0 0 1 1 1v1a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h4\"/></g>"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"lastModified": 1754901428,
|
|
65
|
+
"width": 21,
|
|
66
|
+
"height": 21
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"prefix": "vaadin",
|
|
70
|
+
"icons": {
|
|
71
|
+
"ctrl-a": {
|
|
72
|
+
"body": "<path fill=\"currentColor\" d=\"M9 7V6H8V5H7v1h-.5v1H7v3.56a1.823 1.823 0 0 0 2.009 1.439L9 11a.9.9 0 0 1-.998-.495L8 7zm5-4h1v9h-1zm-1 3l-.085-.001c-.773 0-1.462.358-1.911.917L11 6.001h-1v6h1v-3a1.88 1.88 0 0 1 2.006-2l-.006-1zm-8.81 6C2.16 12 1 10.54 1 8s1.16-4 3.19-4h.029c.539 0 1.052.114 1.515.32l-.424.901a2.7 2.7 0 0 0-1.08-.22h-.042C2.38 5.001 2 6.631 2 8.001s.38 3 2.19 3c.497-.013.96-.145 1.366-.368l.444.898a3.94 3.94 0 0 1-1.806.47z\"/>"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"lastModified": 1722796111
|
|
76
|
+
}
|
|
77
|
+
]
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<!-- 通用模板登录页面:当前使用本地 Mock,后续项目只需替换认证适配层。 -->
|
|
2
2
|
<template>
|
|
3
|
-
<
|
|
3
|
+
<main class="auth-page">
|
|
4
4
|
<LoginLeftView />
|
|
5
5
|
|
|
6
|
-
<
|
|
6
|
+
<section class="auth-right-panel">
|
|
7
7
|
<AuthTopBar />
|
|
8
8
|
|
|
9
9
|
<div class="auth-right-wrap">
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
</ElForm>
|
|
65
65
|
</div>
|
|
66
66
|
</div>
|
|
67
|
-
</
|
|
68
|
-
</
|
|
67
|
+
</section>
|
|
68
|
+
</main>
|
|
69
69
|
</template>
|
|
70
70
|
|
|
71
71
|
<script setup lang="ts">
|
|
@@ -1,26 +1,86 @@
|
|
|
1
|
-
|
|
1
|
+
/* 授权页布局:保留 vh 回退,避免旧 Chromium 忽略新视口单位。 */
|
|
2
|
+
.auth-page {
|
|
3
|
+
display: flex;
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 100vh;
|
|
6
|
+
min-height: 100vh;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.auth-right-panel {
|
|
11
|
+
position: relative;
|
|
12
|
+
flex: 1 1 0;
|
|
13
|
+
min-width: 0;
|
|
14
|
+
height: 100%;
|
|
15
|
+
}
|
|
2
16
|
|
|
3
|
-
/* 授权页右侧区域 */
|
|
4
17
|
.auth-right-wrap {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
padding: 72px 32px 32px;
|
|
25
|
+
overflow-x: hidden;
|
|
26
|
+
/* stylelint-disable-next-line declaration-block-no-redundant-longhand-properties -- Keep an old Chromium-compatible overflow fallback. */
|
|
27
|
+
overflow-y: auto;
|
|
28
|
+
animation: slideInRight 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.auth-right-wrap .form {
|
|
32
|
+
width: 100%;
|
|
33
|
+
max-width: 440px;
|
|
34
|
+
padding: 40px 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.auth-right-wrap .title {
|
|
38
|
+
font-size: 36px;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
color: var(--art-gray-900);
|
|
41
|
+
}
|
|
9
42
|
|
|
10
|
-
|
|
11
|
-
|
|
43
|
+
.auth-right-wrap .sub-title {
|
|
44
|
+
margin-top: 10px;
|
|
45
|
+
font-size: 14px;
|
|
46
|
+
color: var(--art-gray-600);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.auth-right-wrap .custom-height {
|
|
50
|
+
height: 40px !important;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* stylelint-disable-next-line media-feature-range-notation -- Support legacy Chromium. */
|
|
54
|
+
@media (max-width: 767px) {
|
|
55
|
+
.auth-right-wrap {
|
|
56
|
+
padding-right: 28px;
|
|
57
|
+
padding-left: 28px;
|
|
58
|
+
animation: none;
|
|
12
59
|
}
|
|
13
60
|
|
|
14
|
-
.title {
|
|
15
|
-
|
|
61
|
+
.auth-right-wrap .title {
|
|
62
|
+
font-size: 30px;
|
|
16
63
|
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* stylelint-disable-next-line media-feature-range-notation -- Support legacy Chromium. */
|
|
67
|
+
@media (max-width: 639px) {
|
|
68
|
+
.auth-right-wrap {
|
|
69
|
+
padding-right: 28px;
|
|
70
|
+
padding-left: 28px;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
17
73
|
|
|
18
|
-
|
|
19
|
-
|
|
74
|
+
/* stylelint-disable-next-line media-feature-range-notation -- Support legacy Chromium. */
|
|
75
|
+
@media (max-height: 720px) {
|
|
76
|
+
.auth-right-wrap {
|
|
77
|
+
align-items: flex-start;
|
|
78
|
+
padding-top: 56px;
|
|
20
79
|
}
|
|
21
80
|
|
|
22
|
-
.
|
|
23
|
-
|
|
81
|
+
.auth-right-wrap .form {
|
|
82
|
+
padding-top: 24px;
|
|
83
|
+
padding-bottom: 24px;
|
|
24
84
|
}
|
|
25
85
|
}
|
|
26
86
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<template #name="{ row }">
|
|
28
28
|
<div class="service-name">
|
|
29
29
|
<span class="service-name__icon" aria-hidden="true">
|
|
30
|
-
<
|
|
30
|
+
<ArtSvgIcon icon="ri:link" />
|
|
31
31
|
</span>
|
|
32
32
|
<div class="service-name__content">
|
|
33
33
|
<strong>{{ row.name }}</strong>
|
|
@@ -51,8 +51,7 @@
|
|
|
51
51
|
</template>
|
|
52
52
|
|
|
53
53
|
<script setup lang="ts">
|
|
54
|
-
import {
|
|
55
|
-
import { ElButton, ElIcon, ElMessage, ElTag } from 'element-plus'
|
|
54
|
+
import { ElButton, ElMessage, ElTag } from 'element-plus'
|
|
56
55
|
import { KvSearchTablePage } from '@kevairy/components'
|
|
57
56
|
import { searchItems, statusMeta } from './search.config'
|
|
58
57
|
import { serviceTableColumns } from './table.config'
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { expect, test } from '@playwright/test'
|
|
2
|
+
import { skipInitialGuide } from './helpers/guide'
|
|
2
3
|
|
|
3
|
-
test('redirects anonymous users
|
|
4
|
+
test('redirects anonymous users, signs in and supports skipping and replaying onboarding', async ({
|
|
5
|
+
page
|
|
6
|
+
}) => {
|
|
4
7
|
await page.goto('/#/dashboard/console')
|
|
5
8
|
|
|
6
9
|
await expect(page).toHaveURL(/#\/auth\/login\?redirect=/)
|
|
@@ -9,6 +12,53 @@ test('redirects anonymous users and signs in to the configured home page', async
|
|
|
9
12
|
await page.getByRole('button', { name: '进入系统(Mock)' }).click()
|
|
10
13
|
|
|
11
14
|
await expect(page).toHaveURL(/#\/dashboard\/console/)
|
|
12
|
-
|
|
15
|
+
const homeHeading = page.getByRole('heading', { name: __DISPLAY_NAME_LITERAL__ })
|
|
16
|
+
await expect(homeHeading).toBeVisible()
|
|
13
17
|
await expect(page).toHaveTitle(/__DISPLAY_NAME_REGEX__/)
|
|
18
|
+
|
|
19
|
+
await skipInitialGuide(page)
|
|
20
|
+
await page.reload()
|
|
21
|
+
await expect(homeHeading).toBeVisible()
|
|
22
|
+
await page.locator('.user-menu-avatar').hover()
|
|
23
|
+
await page.getByText('新手引导', { exact: true }).click()
|
|
24
|
+
await skipInitialGuide(page)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
test('keeps the login form usable in a short compatibility viewport', async ({ page }) => {
|
|
28
|
+
await page.setViewportSize({ width: 1024, height: 600 })
|
|
29
|
+
await page.goto('/#/auth/login')
|
|
30
|
+
|
|
31
|
+
await expect(page.getByRole('button', { name: '进入系统(Mock)' })).toBeVisible()
|
|
32
|
+
await page.locator('.auth-right-wrap').evaluate(async (element) => {
|
|
33
|
+
await Promise.all(element.getAnimations().map((animation) => animation.finished))
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const metrics = await page.evaluate(() => {
|
|
37
|
+
const pageRoot = document.querySelector<HTMLElement>('.auth-page')
|
|
38
|
+
const panel = document.querySelector<HTMLElement>('.auth-right-panel')
|
|
39
|
+
const scroller = document.querySelector<HTMLElement>('.auth-right-wrap')
|
|
40
|
+
const form = document.querySelector<HTMLElement>('.auth-right-wrap .form')
|
|
41
|
+
const leftView = document.querySelector<HTMLElement>('.login-left-view')
|
|
42
|
+
const formRect = form?.getBoundingClientRect()
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
pageWidth: pageRoot?.getBoundingClientRect().width ?? 0,
|
|
46
|
+
panelWidth: panel?.getBoundingClientRect().width ?? 0,
|
|
47
|
+
formWidth: formRect?.width ?? 0,
|
|
48
|
+
formLeft: formRect?.left ?? -1,
|
|
49
|
+
formRight: formRect?.right ?? Number.POSITIVE_INFINITY,
|
|
50
|
+
scrollable: (scroller?.scrollHeight ?? 0) >= (scroller?.clientHeight ?? 0),
|
|
51
|
+
leftViewDisplay: leftView ? getComputedStyle(leftView).display : null
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
expect(metrics.leftViewDisplay).toBe('none')
|
|
56
|
+
// 浏览器的子像素布局会带来浮点误差,边界测量允许 1px 容差。
|
|
57
|
+
const pixelTolerance = 1
|
|
58
|
+
expect(Math.abs(metrics.panelWidth - metrics.pageWidth)).toBeLessThanOrEqual(pixelTolerance)
|
|
59
|
+
expect(metrics.formWidth).toBeLessThanOrEqual(440 + pixelTolerance)
|
|
60
|
+
expect(metrics.formLeft).toBeGreaterThanOrEqual(-pixelTolerance)
|
|
61
|
+
expect(metrics.formRight).toBeLessThanOrEqual(metrics.pageWidth + pixelTolerance)
|
|
62
|
+
expect(metrics.scrollable).toBe(true)
|
|
63
|
+
await expect(page.getByRole('button', { name: '进入系统(Mock)' })).toBeVisible()
|
|
14
64
|
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { expect, type Page } from '@playwright/test'
|
|
2
|
+
|
|
3
|
+
/** 通过真实入口跳过首次引导,等待遮罩释放页面操作。 */
|
|
4
|
+
export async function skipInitialGuide(page: Page): Promise<void> {
|
|
5
|
+
const guide = page.getByRole('dialog').filter({ hasText: '欢迎使用' })
|
|
6
|
+
await expect(guide).toBeVisible()
|
|
7
|
+
await guide.getByRole('button', { name: '跳过', exact: true }).click()
|
|
8
|
+
await expect(page.locator('.driver-overlay')).toBeHidden()
|
|
9
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { expect, test, type Page } from '@playwright/test'
|
|
2
|
+
import { skipInitialGuide } from './helpers/guide'
|
|
2
3
|
|
|
3
4
|
const openSearchTable = async (page: Page) => {
|
|
4
5
|
await page.goto('/#/examples/search-table')
|
|
@@ -9,6 +10,7 @@ const openSearchTable = async (page: Page) => {
|
|
|
9
10
|
await expect(page).toHaveURL(/#\/examples\/search-table/)
|
|
10
11
|
await expect(page.getByText('服务目录', { exact: true })).toBeVisible()
|
|
11
12
|
await expect(page.getByText('共 68 项')).toBeVisible()
|
|
13
|
+
await skipInitialGuide(page)
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
test('supports search, reset, pagination, errors, selection and keyboard toolbar actions', async ({
|
|
@@ -22,6 +24,8 @@ test('supports search, reset, pagination, errors, selection and keyboard toolbar
|
|
|
22
24
|
const searchTablePage = document.querySelector<HTMLElement>('.search-table-page')
|
|
23
25
|
const pagination = document.querySelector<HTMLElement>('.kv-table .pagination')
|
|
24
26
|
const toolbarButton = document.querySelector<HTMLElement>('.toolbar-button')
|
|
27
|
+
const elementTable = document.querySelector<HTMLElement>('.kv-table .el-table')
|
|
28
|
+
const elementPagination = document.querySelector<HTMLElement>('.kv-table .el-pagination')
|
|
25
29
|
const toolbarButtonRect = toolbarButton?.getBoundingClientRect()
|
|
26
30
|
|
|
27
31
|
return {
|
|
@@ -37,7 +41,11 @@ test('supports search, reset, pagination, errors, selection and keyboard toolbar
|
|
|
37
41
|
paginationClientWidth: pagination?.clientWidth ?? 0,
|
|
38
42
|
paginationScrollWidth: pagination?.scrollWidth ?? 0,
|
|
39
43
|
toolbarButtonWidth: toolbarButtonRect?.width ?? 0,
|
|
40
|
-
toolbarButtonHeight: toolbarButtonRect?.height ?? 0
|
|
44
|
+
toolbarButtonHeight: toolbarButtonRect?.height ?? 0,
|
|
45
|
+
elementTablePosition: elementTable ? getComputedStyle(elementTable).position : null,
|
|
46
|
+
elementPaginationDisplay: elementPagination
|
|
47
|
+
? getComputedStyle(elementPagination).display
|
|
48
|
+
: null
|
|
41
49
|
}
|
|
42
50
|
})
|
|
43
51
|
|
|
@@ -48,6 +56,8 @@ test('supports search, reset, pagination, errors, selection and keyboard toolbar
|
|
|
48
56
|
expect(layout.paginationScrollWidth).toBeLessThanOrEqual(layout.paginationClientWidth)
|
|
49
57
|
expect(layout.toolbarButtonWidth).toBe(32)
|
|
50
58
|
expect(layout.toolbarButtonHeight).toBe(32)
|
|
59
|
+
expect(layout.elementTablePosition).toBe('relative')
|
|
60
|
+
expect(layout.elementPaginationDisplay).toBe('flex')
|
|
51
61
|
|
|
52
62
|
const keyword = page.getByPlaceholder('服务名称或编码')
|
|
53
63
|
await keyword.fill('SERVICE_001')
|
package/template/vite.config.ts
CHANGED
|
@@ -4,7 +4,6 @@ import path from 'path'
|
|
|
4
4
|
import { fileURLToPath } from 'url'
|
|
5
5
|
import Components from 'unplugin-vue-components/vite'
|
|
6
6
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
7
|
-
import ElementPlus from 'unplugin-element-plus/vite'
|
|
8
7
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
9
8
|
import tailwindcss from '@tailwindcss/vite'
|
|
10
9
|
// import { visualizer } from 'rollup-plugin-visualizer'
|
|
@@ -72,7 +71,7 @@ export default ({ mode }: { mode: string }) => {
|
|
|
72
71
|
AutoImport({
|
|
73
72
|
imports: ['vue', 'vue-router', 'pinia', '@vueuse/core'],
|
|
74
73
|
dts: 'src/types/import/auto-imports.d.ts',
|
|
75
|
-
resolvers: [ElementPlusResolver({ importStyle:
|
|
74
|
+
resolvers: [ElementPlusResolver({ importStyle: false })],
|
|
76
75
|
eslintrc: {
|
|
77
76
|
enabled: true,
|
|
78
77
|
filepath: './eslint-auto-import.json',
|
|
@@ -82,11 +81,7 @@ export default ({ mode }: { mode: string }) => {
|
|
|
82
81
|
// 自动按需导入组件
|
|
83
82
|
Components({
|
|
84
83
|
dts: 'src/types/import/components.d.ts',
|
|
85
|
-
resolvers: [ElementPlusResolver({ importStyle:
|
|
86
|
-
}),
|
|
87
|
-
// 按需定制主题配置
|
|
88
|
-
ElementPlus({
|
|
89
|
-
useSource: false
|
|
84
|
+
resolvers: [ElementPlusResolver({ importStyle: false })]
|
|
90
85
|
})
|
|
91
86
|
// 打包分析
|
|
92
87
|
// visualizer({
|
|
@@ -144,6 +139,9 @@ function splitVendorChunk(id: string) {
|
|
|
144
139
|
if (!moduleId.includes('/node_modules/')) return
|
|
145
140
|
|
|
146
141
|
if (moduleId.includes('/echarts/') || moduleId.includes('/zrender/')) return 'vendor-echarts'
|
|
142
|
+
// Iconify 运行时与离线图标集数据(@iconify-json/* 体积大且稳定,独立分包利于长期缓存)
|
|
143
|
+
// 注意:需置于 vue 分支之前,因为 /@iconify/vue/ 路径本身包含子串 /vue/
|
|
144
|
+
if (moduleId.includes('/@iconify/') || moduleId.includes('/@iconify-json/')) return 'vendor-icons'
|
|
147
145
|
if (
|
|
148
146
|
moduleId.includes('/vue/') ||
|
|
149
147
|
moduleId.includes('/@vue/') ||
|