@kevairy/template 0.1.2 → 0.1.4

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 (95) hide show
  1. package/package.json +1 -1
  2. package/template/.env +4 -0
  3. package/template/.env.production +6 -0
  4. package/template/.prettierignore +2 -0
  5. package/template/_gitignore +4 -1
  6. package/template/package.json +10 -0
  7. package/template/scripts/gen-offline-icons.mjs +84 -0
  8. package/template/src/adapters/auth/index.ts +1 -1
  9. package/template/src/adapters/auth/types.ts +6 -1
  10. package/template/src/api/auth.ts +3 -2
  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 +131 -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-page-content/index.vue +8 -1
  16. package/template/src/components/core/layouts/art-screen-lock/index.vue +325 -0
  17. package/template/src/components/core/layouts/art-settings-panel/widget/SettingActions.vue +0 -1
  18. package/template/src/components/core/media/art-cutter-img/index.vue +0 -1
  19. package/template/src/components/core/media/art-video-player/index.vue +0 -10
  20. package/template/src/config/index.ts +8 -1
  21. package/template/src/config/modules/component.ts +14 -0
  22. package/template/src/config/modules/guide.ts +122 -0
  23. package/template/src/config/modules/headerBar.ts +4 -0
  24. package/template/src/config/setting.ts +2 -2
  25. package/template/src/directives/core/access.ts +125 -0
  26. package/template/src/directives/core/auth.ts +7 -62
  27. package/template/src/directives/core/roles.ts +5 -83
  28. package/template/src/env.d.ts +1 -0
  29. package/template/src/hooks/core/useAuth.ts +2 -74
  30. package/template/src/hooks/core/useGuide.ts +122 -0
  31. package/template/src/hooks/core/useHeaderBar.ts +6 -0
  32. package/template/src/hooks/core/usePermission.ts +41 -0
  33. package/template/src/hooks/index.ts +1 -0
  34. package/template/src/locales/index.ts +0 -1
  35. package/template/src/locales/langs/en.json +77 -6
  36. package/template/src/locales/langs/zh.json +77 -6
  37. package/template/src/main.ts +19 -9
  38. package/template/src/router/core/IframeRouteManager.ts +4 -2
  39. package/template/src/router/core/MenuProcessor.ts +5 -40
  40. package/template/src/router/core/RoutePermissionValidator.ts +6 -149
  41. package/template/src/router/core/access.ts +79 -0
  42. package/template/src/router/guards/afterEach.ts +6 -10
  43. package/template/src/router/guards/beforeEach.ts +143 -100
  44. package/template/src/router/guards/error.ts +42 -0
  45. package/template/src/router/index.ts +2 -0
  46. package/template/src/router/modules/examples.ts +4 -3
  47. package/template/src/router/routes/staticRoutes.ts +5 -3
  48. package/template/src/services/auth.ts +32 -10
  49. package/template/src/services/permission.ts +21 -0
  50. package/template/src/store/modules/lock.ts +125 -0
  51. package/template/src/store/modules/menu.ts +28 -8
  52. package/template/src/store/modules/setting.ts +8 -15
  53. package/template/src/store/modules/user.ts +73 -33
  54. package/template/src/store/modules/worktab.ts +1 -1
  55. package/template/src/types/api/api.d.ts +4 -1
  56. package/template/src/types/config/index.ts +9 -0
  57. package/template/src/types/directive/directive.d.ts +1 -0
  58. package/template/src/types/import/components.d.ts +2 -0
  59. package/template/src/types/router/index.ts +6 -0
  60. package/template/src/utils/http/contract.ts +51 -19
  61. package/template/src/utils/http/error.ts +73 -26
  62. package/template/src/utils/http/index.ts +160 -165
  63. package/template/src/utils/http/request-manager.ts +124 -0
  64. package/template/src/utils/http/status.ts +1 -0
  65. package/template/src/utils/permission/index.ts +66 -0
  66. package/template/src/utils/session.ts +24 -0
  67. package/template/src/utils/socket/index.ts +27 -2
  68. package/template/src/utils/storage/storage-config.ts +15 -0
  69. package/template/src/utils/storage/storage.ts +5 -3
  70. package/template/src/utils/sys/diagnostics.ts +180 -0
  71. package/template/src/utils/sys/error-handle.ts +56 -126
  72. package/template/src/utils/sys/mittBus.ts +5 -0
  73. package/template/src/utils/sys/recovery.ts +31 -0
  74. package/template/src/utils/ui/iconify-loader.ts +32 -18
  75. package/template/src/utils/ui/offline-icons.json +77 -0
  76. package/template/src/views/examples/permissions/index.vue +69 -13
  77. package/template/src/views/examples/search-table/index.vue +2 -3
  78. package/template/src/views/exception/403/index.vue +33 -0
  79. package/template/src/views/exception/500/index.vue +52 -10
  80. package/template/tests/e2e/auth.spec.ts +24 -6
  81. package/template/tests/e2e/helpers/guide.ts +9 -0
  82. package/template/tests/e2e/permissions.spec.ts +53 -0
  83. package/template/tests/e2e/search-table.spec.ts +2 -0
  84. package/template/tests/e2e/session-recovery.spec.ts +49 -0
  85. package/template/tests/unit/diagnostics/diagnostics.spec.ts +132 -0
  86. package/template/tests/unit/diagnostics/router.spec.ts +84 -0
  87. package/template/tests/unit/http/auth-lifecycle.spec.ts +203 -0
  88. package/template/tests/unit/http/contract.spec.ts +46 -0
  89. package/template/tests/unit/http/request.spec.ts +487 -0
  90. package/template/tests/unit/permissions/guard.spec.ts +261 -0
  91. package/template/tests/unit/permissions/guide.spec.ts +30 -0
  92. package/template/tests/unit/permissions/rules.spec.ts +106 -0
  93. package/template/tests/unit/permissions/state-and-directives.spec.ts +176 -0
  94. package/template/tests/unit/router/examples.spec.ts +5 -1
  95. package/template/vite.config.ts +8 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevairy/template",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Project template consumed by @kevairy/cli",
5
5
  "keywords": [
6
6
  "vue",
package/template/.env CHANGED
@@ -18,5 +18,9 @@ VITE_WITH_CREDENTIALS = false
18
18
  # Authorization 头前缀;接入业务后端时可按约定设置为 Bearer 等值。
19
19
  VITE_AUTH_SCHEME =
20
20
 
21
+ # GET/HEAD 在网络故障、超时或指定 HTTP 5xx 下的额外重试次数,默认 0。
22
+ # 写请求默认不重试;确认后端幂等后,按单请求 retry.allowUnsafe 显式开启。
23
+ VITE_HTTP_MAX_RETRIES = 0
24
+
21
25
  # 是否打开路由信息
22
26
  VITE_OPEN_ROUTE_INFO = false
@@ -5,3 +5,9 @@ VITE_BASE_URL = /
5
5
 
6
6
  # API 地址前缀
7
7
  VITE_API_URL = /api/
8
+
9
+ # CI 可注入 Git SHA / 发布编号;留空时自动使用构建时间。
10
+ VITE_BUILD_ID =
11
+
12
+ # true 生成 hidden sourcemap;上传诊断平台后必须从静态部署目录删除 .map 文件。
13
+ VITE_BUILD_SOURCEMAP = 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
@@ -6,7 +6,7 @@ dist-ssr
6
6
  *.local
7
7
  .tmp-audit/
8
8
  .cursorrules
9
- local-docs/
9
+ .pnpm-store/
10
10
 
11
11
  # Auto-generated files
12
12
  **/src/types/import/auto-imports.d.ts
@@ -18,3 +18,6 @@ test-results
18
18
  playwright-report
19
19
  coverage
20
20
  **/.vitepress/cache
21
+
22
+ # Local docs (never tracked by git)
23
+ local-docs/
@@ -18,6 +18,7 @@
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)}`)
@@ -1,6 +1,6 @@
1
1
  import { mockAuthAdapter } from './mock'
2
2
 
3
- export type { AuthAdapter } from './types'
3
+ export type { AuthAdapter, LogoutContext } from './types'
4
4
 
5
5
  /**
6
6
  * 模板固定使用 Mock。项目迁移时只在项目分支替换此处注入的实现,
@@ -3,9 +3,14 @@
3
3
  *
4
4
  * 页面、Store 和路由守卫只依赖此契约;项目接口字段必须在适配器内部转换。
5
5
  */
6
+ export interface LogoutContext {
7
+ /** HTTP 退出请求必须透传此 scope,普通请求在退出期间会被取消。 */
8
+ requestScope: symbol
9
+ }
10
+
6
11
  export interface AuthAdapter {
7
12
  readonly name: string
8
13
  login(params: Api.Auth.LoginParams): Promise<Api.Auth.LoginResponse>
9
14
  getUserInfo(): Promise<Api.Auth.UserInfo>
10
- logout(): Promise<void>
15
+ logout(context?: LogoutContext): Promise<void>
11
16
  }
@@ -1,4 +1,5 @@
1
1
  import { authAdapter } from '@/adapters/auth'
2
+ import type { LogoutContext } from '@/adapters/auth'
2
3
 
3
4
  /**
4
5
  * 登录
@@ -18,6 +19,6 @@ export function fetchGetUserInfo() {
18
19
  }
19
20
 
20
21
  /** 退出当前账号 */
21
- export function fetchLogout() {
22
- return authAdapter.logout()
22
+ export function fetchLogout(context?: LogoutContext) {
23
+ return authAdapter.logout(context)
23
24
  }
@@ -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,131 @@
1
+ <!-- 新手引导 -->
2
+ <template>
3
+ <!-- 引导弹窗由 driver.js 命令式渲染到 body,本组件无可见输出,
4
+ 仅承载启动/销毁生命周期与全局样式,故根节点恒不渲染 -->
5
+ <span v-if="false" />
6
+ </template>
7
+
8
+ <script setup lang="ts">
9
+ import { nextTick, onMounted, onUnmounted } from 'vue'
10
+ import 'driver.js/dist/driver.css'
11
+ import { useGuide } from '@/hooks/core/useGuide'
12
+ import { useSettingStore } from '@/store/modules/setting'
13
+ import { mittBus } from '@/utils/sys'
14
+ import AppConfig from '@/config'
15
+
16
+ defineOptions({ name: 'ArtGuide' })
17
+
18
+ const settingStore = useSettingStore()
19
+ const { start, destroy } = useGuide()
20
+ let startTimer: ReturnType<typeof setTimeout> | undefined
21
+ let unmounted = false
22
+
23
+ onMounted(() => {
24
+ // 用户菜单「新手引导」入口:手动重新播放
25
+ mittBus.on('startGuide', start)
26
+
27
+ // 首次进入且功能开启时自动播放;延迟等待顶栏各按钮渲染完成
28
+ if (AppConfig.features.guide && !settingStore.hasCompletedGuide) {
29
+ nextTick(() => {
30
+ if (unmounted) return
31
+ startTimer = setTimeout(() => {
32
+ if (!settingStore.hasCompletedGuide) start()
33
+ }, 600)
34
+ })
35
+ }
36
+ })
37
+
38
+ onUnmounted(() => {
39
+ unmounted = true
40
+ clearTimeout(startTimer)
41
+ mittBus.off('startGuide', start)
42
+ destroy()
43
+ })
44
+ </script>
45
+
46
+ <style>
47
+ /* driver.js 将弹窗挂载到 body 下,需使用全局样式并适配明暗主题。
48
+ 所有覆盖选择器均为 (0,2,0) 权重,高于 driver.css 默认的 (0,1,0),
49
+ 且不依赖样式加载顺序即可生效。 */
50
+
51
+ /* 弹窗容器:背景/文字/边框跟随主题变量自动切换 */
52
+ .driver-popover.art-guide-popover {
53
+ max-width: 320px;
54
+ background-color: var(--default-box-color);
55
+ border: 1px solid var(--default-border);
56
+ border-radius: 8px;
57
+ box-shadow: 0 6px 24px rgb(0 0 0 / 12%);
58
+ }
59
+
60
+ .art-guide-popover .driver-popover-title {
61
+ font-size: 16px;
62
+ color: var(--art-gray-900);
63
+ }
64
+
65
+ .art-guide-popover .driver-popover-description {
66
+ font-size: 13px;
67
+ line-height: 1.6;
68
+ color: var(--art-gray-600);
69
+ }
70
+
71
+ .art-guide-popover .driver-popover-progress-text {
72
+ font-size: 12px;
73
+ color: var(--art-gray-500);
74
+ }
75
+
76
+ /* 关闭按钮 */
77
+ .art-guide-popover .driver-popover-close-btn {
78
+ color: var(--art-gray-500);
79
+ }
80
+
81
+ .art-guide-popover .driver-popover-close-btn:hover,
82
+ .art-guide-popover .driver-popover-close-btn:focus {
83
+ color: var(--art-gray-900);
84
+ }
85
+
86
+ /* 底部按钮:上一步为描边,下一步/开始使用为主题色 */
87
+ .art-guide-popover .driver-popover-footer-btn {
88
+ padding: 5px 12px;
89
+ color: var(--art-gray-700);
90
+ background-color: var(--default-box-color);
91
+ border: 1px solid var(--default-border);
92
+ border-radius: 6px;
93
+ }
94
+
95
+ .art-guide-popover .driver-popover-footer-btn:hover,
96
+ .art-guide-popover .driver-popover-footer-btn:focus {
97
+ background-color: var(--art-gray-200);
98
+ }
99
+
100
+ .art-guide-popover .driver-popover-next-btn,
101
+ .art-guide-popover .driver-popover-done-btn {
102
+ color: #fff;
103
+ background-color: var(--el-color-primary);
104
+ border-color: var(--el-color-primary);
105
+ }
106
+
107
+ .art-guide-popover .driver-popover-next-btn:hover,
108
+ .art-guide-popover .driver-popover-next-btn:focus,
109
+ .art-guide-popover .driver-popover-done-btn:hover,
110
+ .art-guide-popover .driver-popover-done-btn:focus {
111
+ background-color: var(--el-color-primary-light-3);
112
+ border-color: var(--el-color-primary-light-3);
113
+ }
114
+
115
+ /* 箭头:跟随容器背景色(每个方位仅一条可见边框) */
116
+ .art-guide-popover .driver-popover-arrow-side-bottom {
117
+ border-bottom-color: var(--default-box-color);
118
+ }
119
+
120
+ .art-guide-popover .driver-popover-arrow-side-top {
121
+ border-top-color: var(--default-box-color);
122
+ }
123
+
124
+ .art-guide-popover .driver-popover-arrow-side-left {
125
+ border-left-color: var(--default-box-color);
126
+ }
127
+
128
+ .art-guide-popover .driver-popover-arrow-side-right {
129
+ border-right-color: var(--default-box-color);
130
+ }
131
+ </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
  */
@@ -14,7 +14,12 @@
14
14
  </div>
15
15
  </div>
16
16
 
17
- <RouterView v-if="isRefresh" v-slot="{ Component, route }" :style="contentStyle">
17
+ <RouterView
18
+ v-if="isRefresh"
19
+ :key="sessionEpoch"
20
+ v-slot="{ Component, route }"
21
+ :style="contentStyle"
22
+ >
18
23
  <!-- 缓存路由动画 -->
19
24
  <Transition :name="showTransitionMask ? '' : actualTransition" mode="out-in" appear>
20
25
  <KeepAlive :max="10" :exclude="keepAliveExclude">
@@ -53,6 +58,7 @@
53
58
  import { useAutoLayoutHeight } from '@/hooks/core/useLayoutHeight'
54
59
  import { useSettingStore } from '@/store/modules/setting'
55
60
  import { useWorktabStore } from '@/store/modules/worktab'
61
+ import { useUserStore } from '@/store/modules/user'
56
62
  import AppConfig from '@/config'
57
63
 
58
64
  defineOptions({ name: 'ArtPageContent' })
@@ -61,6 +67,7 @@
61
67
  const { containerMinHeight } = useAutoLayoutHeight()
62
68
  const { pageTransition, containerWidth, refresh } = storeToRefs(useSettingStore())
63
69
  const { keepAliveExclude } = storeToRefs(useWorktabStore())
70
+ const { sessionEpoch } = storeToRefs(useUserStore())
64
71
 
65
72
  const isRefresh = shallowRef(true)
66
73
  const isOpenRouteInfo = import.meta.env.VITE_OPEN_ROUTE_INFO