@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.
Files changed (48) hide show
  1. package/package.json +1 -1
  2. package/template/.agents/skills/kevairy-ui/SKILL.md +36 -0
  3. package/template/.agents/skills/kevairy-ui/agents/openai.yaml +4 -0
  4. package/template/.agents/skills/kevairy-ui/references/component-catalog.md +45 -0
  5. package/template/.env +4 -0
  6. package/template/.prettierignore +2 -0
  7. package/template/AGENTS.md +15 -0
  8. package/template/_gitignore +4 -0
  9. package/template/package.json +11 -1
  10. package/template/scripts/gen-offline-icons.mjs +84 -0
  11. package/template/src/components/core/forms/art-wang-editor/index.vue +0 -5
  12. package/template/src/components/core/layouts/art-guide/index.vue +123 -0
  13. package/template/src/components/core/layouts/art-header-bar/index.vue +26 -26
  14. package/template/src/components/core/layouts/art-header-bar/widget/ArtUserMenu.vue +17 -1
  15. package/template/src/components/core/layouts/art-screen-lock/index.vue +325 -0
  16. package/template/src/components/core/layouts/art-settings-panel/widget/SettingActions.vue +0 -1
  17. package/template/src/components/core/media/art-cutter-img/index.vue +0 -1
  18. package/template/src/components/core/media/art-video-player/index.vue +0 -10
  19. package/template/src/components/core/views/login/AuthTopBar.vue +56 -6
  20. package/template/src/components/core/views/login/LoginLeftView.vue +24 -42
  21. package/template/src/config/index.ts +4 -1
  22. package/template/src/config/modules/component.ts +14 -0
  23. package/template/src/config/modules/guide.ts +122 -0
  24. package/template/src/config/modules/headerBar.ts +4 -0
  25. package/template/src/config/setting.ts +2 -2
  26. package/template/src/hooks/core/useGuide.ts +116 -0
  27. package/template/src/hooks/core/useHeaderBar.ts +6 -0
  28. package/template/src/locales/index.ts +0 -1
  29. package/template/src/locales/langs/en.json +66 -5
  30. package/template/src/locales/langs/zh.json +66 -5
  31. package/template/src/main.ts +3 -0
  32. package/template/src/store/modules/lock.ts +125 -0
  33. package/template/src/store/modules/setting.ts +8 -15
  34. package/template/src/store/modules/user.ts +3 -0
  35. package/template/src/types/config/index.ts +4 -0
  36. package/template/src/types/import/components.d.ts +2 -0
  37. package/template/src/utils/http/index.ts +3 -1
  38. package/template/src/utils/socket/index.ts +27 -2
  39. package/template/src/utils/sys/mittBus.ts +5 -0
  40. package/template/src/utils/ui/iconify-loader.ts +32 -18
  41. package/template/src/utils/ui/offline-icons.json +77 -0
  42. package/template/src/views/auth/login/index.vue +4 -4
  43. package/template/src/views/auth/login/style.css +74 -14
  44. package/template/src/views/examples/search-table/index.vue +2 -3
  45. package/template/tests/e2e/auth.spec.ts +52 -2
  46. package/template/tests/e2e/helpers/guide.ts +9 -0
  47. package/template/tests/e2e/search-table.spec.ts +11 -1
  48. package/template/vite.config.ts +5 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevairy/template",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Project template consumed by @kevairy/cli",
5
5
  "keywords": [
6
6
  "vue",
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: kevairy-ui
3
+ description: Guide Vue 3 admin UI work toward @kevairy/components and established Kevairy template patterns. Use when creating, changing, reviewing, or refactoring pages, forms, tables, search and filter flows, dialogs, statuses, cards, data display, composables, or shared UI in a project generated from the Kevairy template.
4
+ ---
5
+
6
+ # Kevairy UI
7
+
8
+ ## Workflow
9
+
10
+ 1. Read [the component catalog](references/component-catalog.md) before choosing shared UI building blocks.
11
+ 2. Inspect `package.json` for the installed `@kevairy/components` version.
12
+ 3. Search the project for an existing page pattern or component before adding a new abstraction. Prefer examples under `src/views/examples` and existing components under `src/components`.
13
+ 4. Select implementations in this order:
14
+ - Use `@kevairy/components` for reusable business UI, tables, search, dialogs, status, and shared data-display patterns.
15
+ - Reuse existing `Art*` components for template-specific layout, navigation, authentication, and application shell behavior.
16
+ - Compose Element Plus primitives only when the first two layers do not provide the required behavior.
17
+ - Create a local component only for project-specific behavior or a documented capability gap.
18
+ 5. Verify exact APIs in the [online component documentation](https://kevairy.top/components/) or the installed package types. Do not guess props, slots, events, exposed methods, or request contracts.
19
+ 6. Keep `@kevairy/components/style.css` imported once in `src/main.ts`; do not import it in individual pages.
20
+ 7. Run focused tests and `pnpm typecheck`. Run `pnpm build` when changing dependencies, shared UI composition, or build-facing code.
21
+
22
+ ## Source-of-truth rules
23
+
24
+ - Treat the installed package exports and type declarations as authoritative for the project's pinned version.
25
+ - Treat `https://kevairy.top/components/` as the usage and API guide for the latest published documentation.
26
+ - When documentation and installed types differ, implement against the installed version and state the mismatch.
27
+ - Import UI components and their types from `@kevairy/components`.
28
+ - Import non-UI composables, contracts, and pure utilities from `@kevairy/components/core` when the module should avoid UI dependencies.
29
+ - Avoid wrappers that merely rename a Kevairy component without adding project-specific behavior.
30
+
31
+ ## Documentation routing
32
+
33
+ - Components: `https://kevairy.top/components/`
34
+ - Template architecture and project patterns: `https://kevairy.top/template/`
35
+ - Scaffold usage: `https://kevairy.top/scaffold/`
36
+ - Use the local catalog for selection, then open only the relevant online API page.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: 'Kevairy UI'
3
+ short_description: '优先使用 Kevairy 组件与页面模式开发 Vue 后台'
4
+ default_prompt: 'Use $kevairy-ui to build this Vue admin UI with the appropriate Kevairy components.'
@@ -0,0 +1,45 @@
1
+ # Kevairy component catalog
2
+
3
+ Use this catalog to choose a capability before reading its exact API documentation. Check the installed `@kevairy/components` version before implementation.
4
+
5
+ ## Selection order
6
+
7
+ 1. Prefer a complete Kevairy page or pattern component.
8
+ 2. Compose lower-level Kevairy components when the complete pattern is too opinionated.
9
+ 3. Reuse existing template `Art*` components for application-shell concerns.
10
+ 4. Use Element Plus primitives for uncovered low-level behavior.
11
+ 5. Add a local component only for project-specific behavior or a documented gap.
12
+
13
+ ## Components
14
+
15
+ | Need | Prefer | Documentation |
16
+ | --- | --- | --- |
17
+ | Complete searchable and pageable list page | `KvSearchTablePage` | https://kevairy.top/components/api/kv-search-table-page |
18
+ | Search and table composition with custom state control | `KvSearchTable` | https://kevairy.top/components/api/kv-search-table |
19
+ | Base table rendering | `KvTable` | https://kevairy.top/components/api/kv-table |
20
+ | Column visibility, density, refresh, and fullscreen controls | `KvTableToolbar` | https://kevairy.top/components/api/kv-table-toolbar |
21
+ | Config-driven search form | `KvSearchBar` | https://kevairy.top/components/api/kv-search-bar |
22
+ | Draggable or resizable dialog | `KvDialog` | https://kevairy.top/components/api/kv-dialog |
23
+ | Dictionary value as a styled tag | `KvDictTag` | https://kevairy.top/components/api/kv-dict-tag |
24
+ | Section heading with optional actions | `KvSectionTitle` | https://kevairy.top/components/api/kv-section-title |
25
+ | Loading, empty, error, or other feedback state | `KvStatus` | https://kevairy.top/components/api/kv-status |
26
+ | Expandable card collection | `KvExpandableCardList` | https://kevairy.top/components/api/kv-expandable-card-list |
27
+ | Inline text difference display | `KvInlineDiff` | https://kevairy.top/components/api/kv-inline-diff |
28
+
29
+ ## Composables and utilities
30
+
31
+ | Need | Prefer | Documentation |
32
+ | --- | --- | --- |
33
+ | Pageable request state without the complete page UI | `usePagedTable` | https://kevairy.top/components/composables/use-paged-table |
34
+ | Normalize or remove empty search values | Search parameter utilities | https://kevairy.top/components/utilities/search-params |
35
+ | Calculate responsive form or grid spans | Responsive utilities | https://kevairy.top/components/utilities/responsive |
36
+
37
+ Import non-UI capabilities from `@kevairy/components/core` when the consumer should not resolve UI and drag dependencies.
38
+
39
+ ## Page patterns
40
+
41
+ - Search-table page organization: https://kevairy.top/template/page-patterns/search-table
42
+ - Template architecture and extension boundaries: https://kevairy.top/template/architecture
43
+ - Component installation and imports: https://kevairy.top/components/getting-started
44
+
45
+ For a standard list page, start with `KvSearchTablePage` and split business configuration into search configuration, table-column configuration, and a service adapter. Preserve the request result contract `{ records, total }` unless the installed API says otherwise.
package/template/.env CHANGED
@@ -18,5 +18,9 @@ VITE_WITH_CREDENTIALS = false
18
18
  # Authorization 头前缀;接入业务后端时可按约定设置为 Bearer 等值。
19
19
  VITE_AUTH_SCHEME =
20
20
 
21
+ # 网络类错误(超时/5xx)的最大重试次数,默认 0(不重试)。
22
+ # 注意:POST 等非幂等请求重试有重复提交风险,开启前请确认后端幂等性。
23
+ VITE_HTTP_MAX_RETRIES = 0
24
+
21
25
  # 是否打开路由信息
22
26
  VITE_OPEN_ROUTE_INFO = false
@@ -1,3 +1,5 @@
1
1
  **/node_modules/*
2
2
  **/dist/*
3
3
  **/src/main.ts
4
+ # 建行对接父页面演示工具为独立 vendored 文件,保持与源仓库一致,不纳入 prettier 重排
5
+ **/public/ccb-parent-demo.html
@@ -0,0 +1,15 @@
1
+ # Kevairy 项目开发指南
2
+
3
+ ## UI 开发
4
+
5
+ - 创建、修改、审查或重构页面、表单、表格、搜索、弹窗、状态展示和公共 UI 时,必须使用 `$kevairy-ui` Skill。
6
+ - 开始实现前先检查 `@kevairy/components` 是否已有对应能力,不要重复实现通用组件。
7
+ - 通用业务 UI 优先使用 `@kevairy/components`;布局、导航、认证等模板框架能力优先复用现有 `Art*` 组件;两者均不满足时才直接组合 Element Plus 或创建项目级组件。
8
+ - 不要凭记忆猜测 Props、Slots、Events、Expose 或类型。先查看 [Kevairy 组件文档](https://kevairy.top/components/),再核对当前安装版本导出的类型。
9
+ - 在线文档与当前安装版本不一致时,以 `package.json` 中的版本及其类型声明为准。
10
+ - `@kevairy/components/style.css` 只在应用入口导入一次,页面中不要重复导入。
11
+
12
+ ## 验证
13
+
14
+ - 修改完成后运行与变更相称的检查,至少包含 `pnpm typecheck`。
15
+ - 涉及构建、依赖或公共组件组合时,同时运行相关测试和 `pnpm build`。
@@ -6,6 +6,7 @@ dist-ssr
6
6
  *.local
7
7
  .tmp-audit/
8
8
  .cursorrules
9
+ .pnpm-store/
9
10
 
10
11
  # Auto-generated files
11
12
  **/src/types/import/auto-imports.d.ts
@@ -17,3 +18,6 @@ test-results
17
18
  playwright-report
18
19
  coverage
19
20
  **/.vitepress/cache
21
+
22
+ # Local docs (never tracked by git)
23
+ local-docs/
@@ -12,12 +12,13 @@
12
12
  "@e965/xlsx": "0.20.3",
13
13
  "@element-plus/icons-vue": "2.3.2",
14
14
  "@iconify/vue": "5.0.1",
15
- "@kevairy/components": "0.2.0",
15
+ "@kevairy/components": "0.2.1",
16
16
  "@tailwindcss/vite": "4.3.3",
17
17
  "@vueuse/core": "13.9.0",
18
18
  "@wangeditor/editor": "5.1.23",
19
19
  "@wangeditor/editor-for-vue": "5.1.12",
20
20
  "axios": "1.19.0",
21
+ "driver.js": "1.9.0",
21
22
  "echarts": "6.1.0",
22
23
  "element-plus": "2.14.4",
23
24
  "file-saver": "2.0.5",
@@ -52,6 +53,15 @@
52
53
  "stylelint-config-standard": "40.0.0",
53
54
  "stylelint-order": "8.1.1",
54
55
  "typescript-eslint": "8.67.0",
56
+ "@iconify-json/fluent": "1.2.59",
57
+ "@iconify-json/icon-park-outline": "1.2.4",
58
+ "@iconify-json/iconamoon": "1.2.2",
59
+ "@iconify-json/ix": "1.2.13",
60
+ "@iconify-json/ri": "1.2.10",
61
+ "@iconify-json/solar": "1.2.13",
62
+ "@iconify-json/system-uicons": "1.2.4",
63
+ "@iconify-json/vaadin": "1.2.1",
64
+ "@iconify/utils": "3.1.7",
55
65
  "@playwright/test": "1.62.1",
56
66
  "@types/node": "24.13.3",
57
67
  "@vitejs/plugin-vue": "6.0.8",
@@ -0,0 +1,84 @@
1
+ /**
2
+ * 离线图标生成脚本
3
+ *
4
+ * 扫描 src 下所有 Iconify 图标名,对“非全量注册”的图标集(ri 以外)按实际用到的
5
+ * 图标精确提取,生成精简的 offline-icons.json,供 iconify-loader 在内网 / 离线环境
6
+ * 下注册,避免运行时从 CDN 拉取图标数据。
7
+ *
8
+ * - ri(Remix Icon):在 iconify-loader 中全量注册,覆盖动态菜单图标,无需在此提取
9
+ * - 其余图标集:仅提取项目实际用到的图标,体积极小(几 KB)
10
+ *
11
+ * 何时重新运行:当新增 / 修改了“非 ri 图标集”的图标时,执行 `pnpm gen:icons` 更新。
12
+ * 新增图标前需先安装对应图标集:`pnpm add -D @iconify-json/<prefix>`
13
+ *
14
+ * @module scripts/gen-offline-icons
15
+ */
16
+ import { readdirSync, readFileSync, writeFileSync, statSync } from 'node:fs'
17
+ import { createRequire } from 'node:module'
18
+ import path from 'node:path'
19
+ import { fileURLToPath } from 'node:url'
20
+ import { getIcons } from '@iconify/utils'
21
+
22
+ const require = createRequire(import.meta.url)
23
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
24
+ const SRC_DIR = path.resolve(__dirname, '../src')
25
+ const OUT_FILE = path.resolve(SRC_DIR, 'utils/ui/offline-icons.json')
26
+
27
+ /** 全量注册的图标集,无需精确提取 */
28
+ const FULL_COLLECTIONS = new Set(['ri'])
29
+
30
+ /** 匹配 Iconify 图标名 "prefix:name" */
31
+ const ICON_RE = /["'`]([a-z][a-z0-9]*(?:-[a-z0-9]+)*):([a-z0-9]+(?:-[a-z0-9]+)*)["'`]/g
32
+ const SOURCE_EXT = /\.(vue|ts|tsx|js|mjs)$/
33
+
34
+ /** @type {Map<string, Set<string>>} */
35
+ const usedIcons = new Map()
36
+
37
+ function scanDir(dir) {
38
+ for (const entry of readdirSync(dir)) {
39
+ if (entry === 'node_modules') continue
40
+ const full = path.join(dir, entry)
41
+ if (statSync(full).isDirectory()) {
42
+ scanDir(full)
43
+ } else if (SOURCE_EXT.test(entry)) {
44
+ const content = readFileSync(full, 'utf8')
45
+ for (const m of content.matchAll(ICON_RE)) {
46
+ const [, prefix, name] = m
47
+ if (FULL_COLLECTIONS.has(prefix)) continue
48
+ if (!usedIcons.has(prefix)) usedIcons.set(prefix, new Set())
49
+ usedIcons.get(prefix).add(name)
50
+ }
51
+ }
52
+ }
53
+ }
54
+
55
+ scanDir(SRC_DIR)
56
+
57
+ const collections = []
58
+ const extracted = []
59
+ const skipped = []
60
+
61
+ for (const [prefix, names] of [...usedIcons].sort()) {
62
+ let data
63
+ try {
64
+ data = require(`@iconify-json/${prefix}/icons.json`)
65
+ } catch {
66
+ // 无对应图标集包:多为 tailwind 变体(hover:/dark:)、v-model(update:)等误匹配,跳过
67
+ skipped.push(prefix)
68
+ continue
69
+ }
70
+ const subset = getIcons(data, [...names])
71
+ if (subset) {
72
+ collections.push(subset)
73
+ extracted.push(`${prefix} → ${[...names].join(', ')}`)
74
+ }
75
+ }
76
+
77
+ writeFileSync(OUT_FILE, JSON.stringify(collections, null, 2) + '\n', 'utf8')
78
+
79
+ console.log(`[gen-offline-icons] 已提取 ${extracted.length} 个图标集:`)
80
+ for (const item of extracted) console.log(` ✓ ${item}`)
81
+ if (skipped.length) {
82
+ console.log(`[gen-offline-icons] 跳过 ${skipped.length} 个非图标前缀(tailwind 变体 / 误匹配)`)
83
+ }
84
+ console.log(`[gen-offline-icons] 输出 → ${path.relative(process.cwd(), OUT_FILE)}`)
@@ -174,11 +174,6 @@
174
174
  const onCreateEditor = (editor: IDomEditor) => {
175
175
  editorRef.value = editor
176
176
 
177
- // 监听全屏事件
178
- editor.on('fullScreen', () => {
179
- console.log('编辑器进入全屏模式')
180
- })
181
-
182
177
  // 确保在编辑器创建后应用自定义图标
183
178
  applyCustomIcons()
184
179
  }
@@ -0,0 +1,123 @@
1
+ <!-- 新手引导 -->
2
+ <template>
3
+ <!-- 引导弹窗由 driver.js 命令式渲染到 body,本组件无可见输出,
4
+ 仅承载启动/销毁生命周期与全局样式,故根节点恒不渲染 -->
5
+ <span v-if="false" />
6
+ </template>
7
+
8
+ <script setup lang="ts">
9
+ import 'driver.js/dist/driver.css'
10
+ import { useGuide } from '@/hooks/core/useGuide'
11
+ import { useSettingStore } from '@/store/modules/setting'
12
+ import { mittBus } from '@/utils/sys'
13
+ import AppConfig from '@/config'
14
+
15
+ defineOptions({ name: 'ArtGuide' })
16
+
17
+ const settingStore = useSettingStore()
18
+ const { start, destroy } = useGuide()
19
+
20
+ onMounted(() => {
21
+ // 用户菜单「新手引导」入口:手动重新播放
22
+ mittBus.on('startGuide', start)
23
+
24
+ // 首次进入且功能开启时自动播放;延迟等待顶栏各按钮渲染完成
25
+ if (AppConfig.features.guide && !settingStore.hasCompletedGuide) {
26
+ nextTick(() => {
27
+ setTimeout(start, 600)
28
+ })
29
+ }
30
+ })
31
+
32
+ onUnmounted(() => {
33
+ mittBus.off('startGuide', start)
34
+ destroy()
35
+ })
36
+ </script>
37
+
38
+ <style>
39
+ /* driver.js 将弹窗挂载到 body 下,需使用全局样式并适配明暗主题。
40
+ 所有覆盖选择器均为 (0,2,0) 权重,高于 driver.css 默认的 (0,1,0),
41
+ 且不依赖样式加载顺序即可生效。 */
42
+
43
+ /* 弹窗容器:背景/文字/边框跟随主题变量自动切换 */
44
+ .driver-popover.art-guide-popover {
45
+ max-width: 320px;
46
+ background-color: var(--default-box-color);
47
+ border: 1px solid var(--default-border);
48
+ border-radius: 8px;
49
+ box-shadow: 0 6px 24px rgb(0 0 0 / 12%);
50
+ }
51
+
52
+ .art-guide-popover .driver-popover-title {
53
+ font-size: 16px;
54
+ color: var(--art-gray-900);
55
+ }
56
+
57
+ .art-guide-popover .driver-popover-description {
58
+ font-size: 13px;
59
+ line-height: 1.6;
60
+ color: var(--art-gray-600);
61
+ }
62
+
63
+ .art-guide-popover .driver-popover-progress-text {
64
+ font-size: 12px;
65
+ color: var(--art-gray-500);
66
+ }
67
+
68
+ /* 关闭按钮 */
69
+ .art-guide-popover .driver-popover-close-btn {
70
+ color: var(--art-gray-500);
71
+ }
72
+
73
+ .art-guide-popover .driver-popover-close-btn:hover,
74
+ .art-guide-popover .driver-popover-close-btn:focus {
75
+ color: var(--art-gray-900);
76
+ }
77
+
78
+ /* 底部按钮:上一步为描边,下一步/开始使用为主题色 */
79
+ .art-guide-popover .driver-popover-footer-btn {
80
+ padding: 5px 12px;
81
+ color: var(--art-gray-700);
82
+ background-color: var(--default-box-color);
83
+ border: 1px solid var(--default-border);
84
+ border-radius: 6px;
85
+ }
86
+
87
+ .art-guide-popover .driver-popover-footer-btn:hover,
88
+ .art-guide-popover .driver-popover-footer-btn:focus {
89
+ background-color: var(--art-gray-200);
90
+ }
91
+
92
+ .art-guide-popover .driver-popover-next-btn,
93
+ .art-guide-popover .driver-popover-done-btn {
94
+ color: #fff;
95
+ background-color: var(--el-color-primary);
96
+ border-color: var(--el-color-primary);
97
+ }
98
+
99
+ .art-guide-popover .driver-popover-next-btn:hover,
100
+ .art-guide-popover .driver-popover-next-btn:focus,
101
+ .art-guide-popover .driver-popover-done-btn:hover,
102
+ .art-guide-popover .driver-popover-done-btn:focus {
103
+ background-color: var(--el-color-primary-light-3);
104
+ border-color: var(--el-color-primary-light-3);
105
+ }
106
+
107
+ /* 箭头:跟随容器背景色(每个方位仅一条可见边框) */
108
+ .art-guide-popover .driver-popover-arrow-side-bottom {
109
+ border-bottom-color: var(--default-box-color);
110
+ }
111
+
112
+ .art-guide-popover .driver-popover-arrow-side-top {
113
+ border-top-color: var(--default-box-color);
114
+ }
115
+
116
+ .art-guide-popover .driver-popover-arrow-side-left {
117
+ border-left-color: var(--default-box-color);
118
+ }
119
+
120
+ .art-guide-popover .driver-popover-arrow-side-right {
121
+ border-right-color: var(--default-box-color);
122
+ }
123
+ </style>
@@ -64,7 +64,7 @@
64
64
  <!-- 搜索 -->
65
65
  <div
66
66
  v-if="shouldShowGlobalSearch"
67
- class="flex-cb w-40 h-9 px-2.5 c-p border border-g-400 rounded-custom-sm max-md:!hidden"
67
+ class="global-search-entry flex-cb w-40 h-9 px-2.5 c-p border border-g-400 rounded-custom-sm max-md:!hidden"
68
68
  @click="openSearchDialog"
69
69
  >
70
70
  <div class="flex-c">
@@ -83,7 +83,7 @@
83
83
  v-if="shouldShowFullscreen"
84
84
  :icon="isFullscreen ? 'ri:fullscreen-exit-line' : 'ri:fullscreen-fill'"
85
85
  :class="[!isFullscreen ? 'full-screen-btn' : 'exit-full-screen-btn', 'ml-3']"
86
- class="max-md:!hidden"
86
+ class="fullscreen-entry max-md:!hidden"
87
87
  @click="toggleFullScreen"
88
88
  />
89
89
 
@@ -130,31 +130,29 @@
130
130
  </ArtIconButton>
131
131
 
132
132
  <!-- 设置按钮 -->
133
- <div v-if="shouldShowSettings">
134
- <ElPopover :visible="showSettingGuide" placement="bottom-start" :width="190" :offset="0">
135
- <template #reference>
136
- <div class="flex-cc">
137
- <ArtIconButton icon="ri:settings-line" class="setting-btn" @click="openSetting" />
138
- </div>
139
- </template>
140
- <template #default>
141
- <p
142
- >{{ $t('topBar.guide.title')
143
- }}<span :style="{ color: systemThemeColor }"> {{ $t('topBar.guide.theme') }} </span
144
- >、 <span :style="{ color: systemThemeColor }"> {{ $t('topBar.guide.menu') }} </span
145
- >{{ $t('topBar.guide.description') }}
146
- </p>
147
- </template>
148
- </ElPopover>
149
- </div>
133
+ <ArtIconButton
134
+ v-if="shouldShowSettings"
135
+ icon="ri:settings-line"
136
+ class="setting-btn"
137
+ @click="openSetting"
138
+ />
150
139
 
151
140
  <!-- 主题切换按钮 -->
152
141
  <ArtIconButton
153
142
  v-if="shouldShowThemeToggle"
143
+ class="theme-toggle-btn"
154
144
  @click="themeAnimation"
155
145
  :icon="isDark ? 'ri:sun-fill' : 'ri:moon-line'"
156
146
  />
157
147
 
148
+ <!-- 锁屏按钮 -->
149
+ <ArtIconButton
150
+ v-if="shouldShowScreenLock"
151
+ icon="ri:lock-line"
152
+ class="screen-lock-btn"
153
+ @click="openLockScreen"
154
+ />
155
+
158
156
  <!-- 用户头像、菜单 -->
159
157
  <ArtUserMenu />
160
158
  </div>
@@ -210,11 +208,11 @@
210
208
  shouldShowLanguage,
211
209
  shouldShowSettings,
212
210
  shouldShowThemeToggle,
211
+ shouldShowScreenLock,
213
212
  fastEnterMinWidth: headerBarFastEnterMinWidth
214
213
  } = useHeaderBar()
215
214
 
216
- const { menuOpen, systemThemeColor, showSettingGuide, menuType, isDark, tabStyle } =
217
- storeToRefs(settingStore)
215
+ const { menuOpen, menuType, isDark, tabStyle } = storeToRefs(settingStore)
218
216
 
219
217
  const { language } = storeToRefs(userStore)
220
218
  const { menuList } = storeToRefs(menuStore)
@@ -296,11 +294,6 @@
296
294
  */
297
295
  const openSetting = (): void => {
298
296
  mittBus.emit('openSetting')
299
-
300
- // 隐藏设置引导提示
301
- if (showSettingGuide.value) {
302
- settingStore.hideSettingGuide()
303
- }
304
297
  }
305
298
 
306
299
  /**
@@ -341,6 +334,13 @@
341
334
  const openChat = (): void => {
342
335
  mittBus.emit('openChat')
343
336
  }
337
+
338
+ /**
339
+ * 打开锁屏界面
340
+ */
341
+ const openLockScreen = (): void => {
342
+ mittBus.emit('openLockScreen')
343
+ }
344
344
  </script>
345
345
 
346
346
  <style lang="scss" scoped>
@@ -13,7 +13,7 @@
13
13
  >
14
14
  <template #reference>
15
15
  <img
16
- class="size-8.5 mr-5 c-p rounded-full max-sm:w-6.5 max-sm:h-6.5 max-sm:mr-[16px]"
16
+ class="user-menu-avatar size-8.5 mr-5 c-p rounded-full max-sm:w-6.5 max-sm:h-6.5 max-sm:mr-[16px]"
17
17
  :src="userInfo.avatar || AppConfig.assets.defaultAvatar"
18
18
  :alt="userInfo.userName || '用户头像'"
19
19
  />
@@ -34,6 +34,10 @@
34
34
  </div>
35
35
  </div>
36
36
  <ul class="py-4 mt-3 border-t border-g-300/80">
37
+ <div class="btn-item c-p" @click="openGuide">
38
+ <ArtSvgIcon icon="ri:guide-line" />
39
+ <span>{{ $t('topBar.user.guide') }}</span>
40
+ </div>
37
41
  <div class="log-out c-p" @click="loginOut">
38
42
  {{ $t('topBar.user.logout') }}
39
43
  </div>
@@ -48,6 +52,7 @@
48
52
  import { ElMessageBox } from 'element-plus'
49
53
  import { useUserStore } from '@/store/modules/user'
50
54
  import { signOut } from '@/services/auth'
55
+ import { mittBus } from '@/utils/sys'
51
56
  import AppConfig from '@/config'
52
57
 
53
58
  defineOptions({ name: 'ArtUserMenu' })
@@ -58,6 +63,17 @@
58
63
  const { getUserInfo: userInfo } = storeToRefs(userStore)
59
64
  const userMenuPopover = ref()
60
65
 
66
+ /**
67
+ * 打开新手引导
68
+ * 先关闭用户菜单,再触发引导,避免弹层遮挡高亮区域
69
+ */
70
+ const openGuide = (): void => {
71
+ closeUserMenu()
72
+ setTimeout(() => {
73
+ mittBus.emit('startGuide')
74
+ }, 200)
75
+ }
76
+
61
77
  /**
62
78
  * 用户登出确认
63
79
  */