@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
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 新手引导步骤配置
|
|
3
|
+
*
|
|
4
|
+
* 集中定义 driver.js 引导的步骤,供 useGuide 消费。
|
|
5
|
+
* 迁移到其他应用时,通常只需调整此文件的步骤与锚点选择器。
|
|
6
|
+
*
|
|
7
|
+
* ## 设计说明
|
|
8
|
+
*
|
|
9
|
+
* - 每一步通过 `element` 指定 CSS 选择器锚点;为空表示居中欢迎弹窗
|
|
10
|
+
* - `feature` 关联 AppConfig.features 开关,未启用的功能对应步骤会被自动跳过
|
|
11
|
+
* - 运行时若锚点元素不存在(如按钮被隐藏),该步同样会被过滤
|
|
12
|
+
* - 标题与描述使用 i18n key,由 useGuide 结合当前语言渲染
|
|
13
|
+
*
|
|
14
|
+
* @module config/modules/guide
|
|
15
|
+
* @author Art Design Pro Team
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { AppFeatureConfig } from '@/types'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 引导步骤配置项
|
|
22
|
+
*/
|
|
23
|
+
export interface GuideStepConfig {
|
|
24
|
+
/** 目标元素 CSS 选择器;缺省表示不聚焦元素的居中弹窗 */
|
|
25
|
+
element?: string
|
|
26
|
+
/** 关联的功能开关,未启用时跳过该步 */
|
|
27
|
+
feature?: keyof AppFeatureConfig
|
|
28
|
+
/** 标题的 i18n key */
|
|
29
|
+
titleKey: string
|
|
30
|
+
/** 描述的 i18n key */
|
|
31
|
+
descKey: string
|
|
32
|
+
/** 弹窗相对锚点的方位 */
|
|
33
|
+
side?: 'top' | 'bottom' | 'left' | 'right'
|
|
34
|
+
/** 弹窗与锚点的对齐方式 */
|
|
35
|
+
align?: 'start' | 'center' | 'end'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 顶栏核心引导步骤
|
|
40
|
+
*
|
|
41
|
+
* 顺序与顶栏从左到右的按钮排布保持一致;
|
|
42
|
+
* 实际播放步骤由 useGuide 依据功能开关与元素存在性动态过滤。
|
|
43
|
+
*/
|
|
44
|
+
export const guideSteps: GuideStepConfig[] = [
|
|
45
|
+
{
|
|
46
|
+
titleKey: 'guide.welcome.title',
|
|
47
|
+
descKey: 'guide.welcome.desc'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
element: '.global-search-entry',
|
|
51
|
+
feature: 'globalSearch',
|
|
52
|
+
titleKey: 'guide.search.title',
|
|
53
|
+
descKey: 'guide.search.desc',
|
|
54
|
+
side: 'bottom',
|
|
55
|
+
align: 'center'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
element: '.fullscreen-entry',
|
|
59
|
+
feature: 'fullscreen',
|
|
60
|
+
titleKey: 'guide.fullscreen.title',
|
|
61
|
+
descKey: 'guide.fullscreen.desc',
|
|
62
|
+
side: 'bottom',
|
|
63
|
+
align: 'center'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
element: '.language-btn',
|
|
67
|
+
feature: 'language',
|
|
68
|
+
titleKey: 'guide.language.title',
|
|
69
|
+
descKey: 'guide.language.desc',
|
|
70
|
+
side: 'bottom',
|
|
71
|
+
align: 'center'
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
element: '.notice-button',
|
|
75
|
+
feature: 'notification',
|
|
76
|
+
titleKey: 'guide.notification.title',
|
|
77
|
+
descKey: 'guide.notification.desc',
|
|
78
|
+
side: 'bottom',
|
|
79
|
+
align: 'center'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
element: '.chat-button',
|
|
83
|
+
feature: 'chat',
|
|
84
|
+
titleKey: 'guide.chat.title',
|
|
85
|
+
descKey: 'guide.chat.desc',
|
|
86
|
+
side: 'bottom',
|
|
87
|
+
align: 'center'
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
element: '.setting-btn',
|
|
91
|
+
feature: 'settings',
|
|
92
|
+
titleKey: 'guide.settings.title',
|
|
93
|
+
descKey: 'guide.settings.desc',
|
|
94
|
+
side: 'bottom',
|
|
95
|
+
align: 'center'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
element: '.theme-toggle-btn',
|
|
99
|
+
feature: 'themeToggle',
|
|
100
|
+
titleKey: 'guide.theme.title',
|
|
101
|
+
descKey: 'guide.theme.desc',
|
|
102
|
+
side: 'bottom',
|
|
103
|
+
align: 'center'
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
element: '.screen-lock-btn',
|
|
107
|
+
feature: 'screenLock',
|
|
108
|
+
titleKey: 'guide.lock.title',
|
|
109
|
+
descKey: 'guide.lock.desc',
|
|
110
|
+
side: 'bottom',
|
|
111
|
+
align: 'center'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
element: '.user-menu-avatar',
|
|
115
|
+
titleKey: 'guide.userMenu.title',
|
|
116
|
+
descKey: 'guide.userMenu.desc',
|
|
117
|
+
side: 'bottom',
|
|
118
|
+
align: 'end'
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
export default guideSteps
|
|
@@ -58,6 +58,10 @@ export const headerBarConfig: HeaderBarFeatureConfig = {
|
|
|
58
58
|
themeToggle: {
|
|
59
59
|
enabled: AppConfig.features.themeToggle,
|
|
60
60
|
description: '主题切换功能(明暗主题)'
|
|
61
|
+
},
|
|
62
|
+
screenLock: {
|
|
63
|
+
enabled: AppConfig.features.screenLock,
|
|
64
|
+
description: '锁屏功能,独立密码本地校验'
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
|
|
@@ -57,8 +57,6 @@ export const SETTING_DEFAULT_CONFIG = {
|
|
|
57
57
|
showLanguage: false,
|
|
58
58
|
/** 是否显示进度条 */
|
|
59
59
|
showNprogress: true,
|
|
60
|
-
/** 是否显示设置引导 */
|
|
61
|
-
showSettingGuide: false,
|
|
62
60
|
/** 是否显示节日文本 */
|
|
63
61
|
showFestivalText: false,
|
|
64
62
|
/** 是否显示水印 */
|
|
@@ -73,6 +71,8 @@ export const SETTING_DEFAULT_CONFIG = {
|
|
|
73
71
|
refresh: false,
|
|
74
72
|
/** 是否加载节日烟花 */
|
|
75
73
|
holidayFireworksLoaded: false,
|
|
74
|
+
/** 新手引导是否已完成 */
|
|
75
|
+
hasCompletedGuide: false,
|
|
76
76
|
/** 边框模式 */
|
|
77
77
|
boxBorderMode: true,
|
|
78
78
|
/** 页面过渡效果 */
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useGuide - 新手引导逻辑
|
|
3
|
+
*
|
|
4
|
+
* 基于 driver.js 封装新手引导的启动与销毁,步骤内容集中来自 config/modules/guide。
|
|
5
|
+
*
|
|
6
|
+
* ## 主要功能
|
|
7
|
+
*
|
|
8
|
+
* 1. 步骤构建 - 依据功能开关与锚点元素存在性动态过滤步骤
|
|
9
|
+
* 2. 国际化 - 标题/描述/按钮文案结合当前语言实时渲染
|
|
10
|
+
* 3. 生命周期 - 启动时创建实例,销毁时标记引导已完成
|
|
11
|
+
* 4. 单例保护 - 重复启动前销毁旧实例,避免遮罩叠加
|
|
12
|
+
*
|
|
13
|
+
* ## 使用示例
|
|
14
|
+
*
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const { start, destroy } = useGuide()
|
|
17
|
+
*
|
|
18
|
+
* // 启动引导(首次自动或用户手动触发)
|
|
19
|
+
* start()
|
|
20
|
+
*
|
|
21
|
+
* // 组件卸载时销毁
|
|
22
|
+
* destroy()
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @module useGuide
|
|
26
|
+
* @author Art Design Pro Team
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
import { driver } from 'driver.js'
|
|
30
|
+
import type { DriveStep, Driver, Popover } from 'driver.js'
|
|
31
|
+
import { useI18n } from 'vue-i18n'
|
|
32
|
+
import { guideSteps } from '@/config/modules/guide'
|
|
33
|
+
import { useSettingStore } from '@/store/modules/setting'
|
|
34
|
+
import AppConfig from '@/config'
|
|
35
|
+
|
|
36
|
+
export function useGuide() {
|
|
37
|
+
const { t } = useI18n()
|
|
38
|
+
const settingStore = useSettingStore()
|
|
39
|
+
|
|
40
|
+
/** driver.js 实例,未启动时为 null */
|
|
41
|
+
let driverInstance: Driver | null = null
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 构建实际播放的步骤
|
|
45
|
+
*
|
|
46
|
+
* 过滤规则:
|
|
47
|
+
* - 关联了 feature 但该功能未启用 -> 跳过
|
|
48
|
+
* - 声明了 element 但页面上找不到该锚点 -> 跳过
|
|
49
|
+
* 居中欢迎弹窗(无 element、无 feature)始终保留。
|
|
50
|
+
*/
|
|
51
|
+
const buildSteps = (): DriveStep[] => {
|
|
52
|
+
return guideSteps
|
|
53
|
+
.filter((step) => !step.feature || AppConfig.features[step.feature])
|
|
54
|
+
.filter((step) => !step.element || document.querySelector(step.element))
|
|
55
|
+
.map((step) => {
|
|
56
|
+
const popover: Popover = {
|
|
57
|
+
title: t(step.titleKey),
|
|
58
|
+
description: t(step.descKey)
|
|
59
|
+
}
|
|
60
|
+
if (step.side) popover.side = step.side
|
|
61
|
+
if (step.align) popover.align = step.align
|
|
62
|
+
|
|
63
|
+
const driveStep: DriveStep = { popover }
|
|
64
|
+
if (step.element) driveStep.element = step.element
|
|
65
|
+
return driveStep
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 销毁当前引导实例(若存在)
|
|
71
|
+
*/
|
|
72
|
+
const destroy = (): void => {
|
|
73
|
+
if (driverInstance) {
|
|
74
|
+
driverInstance.destroy()
|
|
75
|
+
driverInstance = null
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 启动新手引导
|
|
81
|
+
*
|
|
82
|
+
* 每次启动都会重新构建步骤,确保功能开关、锚点与语言为最新状态。
|
|
83
|
+
* 引导结束(完成或跳过)时通过 onDestroyed 标记 hasCompletedGuide。
|
|
84
|
+
*/
|
|
85
|
+
const start = (): void => {
|
|
86
|
+
// 避免重复实例叠加遮罩
|
|
87
|
+
destroy()
|
|
88
|
+
|
|
89
|
+
const steps = buildSteps()
|
|
90
|
+
if (steps.length === 0) return
|
|
91
|
+
|
|
92
|
+
driverInstance = driver({
|
|
93
|
+
steps,
|
|
94
|
+
showProgress: true,
|
|
95
|
+
allowClose: true,
|
|
96
|
+
stagePadding: 6,
|
|
97
|
+
stageRadius: 8,
|
|
98
|
+
popoverClass: 'art-guide-popover',
|
|
99
|
+
nextBtnText: t('guide.buttons.next'),
|
|
100
|
+
prevBtnText: t('guide.buttons.prev'),
|
|
101
|
+
doneBtnText: t('guide.buttons.done'),
|
|
102
|
+
closeBtnLabel: t('guide.buttons.close'),
|
|
103
|
+
onDestroyed: () => {
|
|
104
|
+
settingStore.completeGuide()
|
|
105
|
+
driverInstance = null
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
driverInstance.drive()
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
start, // 启动引导
|
|
114
|
+
destroy // 销毁引导
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -108,6 +108,11 @@ export function useHeaderBar() {
|
|
|
108
108
|
return isFeatureEnabled('themeToggle')
|
|
109
109
|
})
|
|
110
110
|
|
|
111
|
+
// 检查锁屏按钮是否显示
|
|
112
|
+
const shouldShowScreenLock = computed(() => {
|
|
113
|
+
return isFeatureEnabled('screenLock')
|
|
114
|
+
})
|
|
115
|
+
|
|
111
116
|
// 获取快速入口的最小宽度
|
|
112
117
|
const fastEnterMinWidth = computed(() => {
|
|
113
118
|
const config = getFeatureConfig('fastEnter')
|
|
@@ -184,6 +189,7 @@ export function useHeaderBar() {
|
|
|
184
189
|
shouldShowLanguage, // 是否显示语言切换
|
|
185
190
|
shouldShowSettings, // 是否显示设置面板
|
|
186
191
|
shouldShowThemeToggle, // 是否显示主题切换
|
|
192
|
+
shouldShowScreenLock, // 是否显示锁屏按钮
|
|
187
193
|
|
|
188
194
|
// 配置相关
|
|
189
195
|
fastEnterMinWidth, // 快速入口最小宽度
|
|
@@ -22,13 +22,74 @@
|
|
|
22
22
|
"userCenter": "User center",
|
|
23
23
|
"docs": "Document",
|
|
24
24
|
"github": "Github",
|
|
25
|
+
"lockScreen": "Lock screen",
|
|
26
|
+
"guide": "Guide",
|
|
25
27
|
"logout": "Log out"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"lockScreen": {
|
|
31
|
+
"locked": "Screen Locked",
|
|
32
|
+
"setPasswordTitle": "Set Lock Password",
|
|
33
|
+
"setPasswordTip": "First time using screen lock, please set an independent unlock password",
|
|
34
|
+
"passwordPlaceholder": "Enter lock password",
|
|
35
|
+
"newPasswordPlaceholder": "Set lock password",
|
|
36
|
+
"confirmPasswordPlaceholder": "Re-enter password",
|
|
37
|
+
"unlock": "Unlock",
|
|
38
|
+
"confirm": "Confirm",
|
|
39
|
+
"passwordRequired": "Please enter password",
|
|
40
|
+
"passwordMismatch": "Passwords do not match",
|
|
41
|
+
"wrongPassword": "Incorrect password, please try again",
|
|
42
|
+
"setSuccess": "Lock password set successfully",
|
|
43
|
+
"unlockSuccess": "Unlocked",
|
|
44
|
+
"switchAccount": "Switch account",
|
|
45
|
+
"enterToUnlock": "Press Enter to unlock"
|
|
46
|
+
},
|
|
47
|
+
"guide": {
|
|
48
|
+
"buttons": {
|
|
49
|
+
"prev": "Previous",
|
|
50
|
+
"next": "Next",
|
|
51
|
+
"done": "Get Started",
|
|
52
|
+
"close": "Skip"
|
|
53
|
+
},
|
|
54
|
+
"welcome": {
|
|
55
|
+
"title": "Welcome",
|
|
56
|
+
"desc": "Take a minute to learn the core features in the top bar. You can replay this guide anytime from the avatar menu."
|
|
57
|
+
},
|
|
58
|
+
"search": {
|
|
59
|
+
"title": "Global Search",
|
|
60
|
+
"desc": "Quickly search menus and pages. Shortcut: Ctrl/Cmd + K."
|
|
61
|
+
},
|
|
62
|
+
"fullscreen": {
|
|
63
|
+
"title": "Fullscreen",
|
|
64
|
+
"desc": "Enter or exit browser fullscreen for more workspace."
|
|
65
|
+
},
|
|
66
|
+
"language": {
|
|
67
|
+
"title": "Language",
|
|
68
|
+
"desc": "Switch between interface languages."
|
|
69
|
+
},
|
|
70
|
+
"notification": {
|
|
71
|
+
"title": "Notifications",
|
|
72
|
+
"desc": "View system notifications and messages."
|
|
73
|
+
},
|
|
74
|
+
"chat": {
|
|
75
|
+
"title": "Chat",
|
|
76
|
+
"desc": "Open the chat window for real-time communication."
|
|
77
|
+
},
|
|
78
|
+
"settings": {
|
|
79
|
+
"title": "Settings",
|
|
80
|
+
"desc": "Customize theme, menu layout and interface preferences."
|
|
81
|
+
},
|
|
82
|
+
"theme": {
|
|
83
|
+
"title": "Theme Toggle",
|
|
84
|
+
"desc": "Quickly switch between light and dark themes."
|
|
85
|
+
},
|
|
86
|
+
"lock": {
|
|
87
|
+
"title": "Screen Lock",
|
|
88
|
+
"desc": "Lock the screen for privacy, unlock with an independent password."
|
|
26
89
|
},
|
|
27
|
-
"
|
|
28
|
-
"title": "
|
|
29
|
-
"
|
|
30
|
-
"menu": "Open top menu",
|
|
31
|
-
"description": "More configurations"
|
|
90
|
+
"userMenu": {
|
|
91
|
+
"title": "User Menu",
|
|
92
|
+
"desc": "View your profile, replay the guide, or log out."
|
|
32
93
|
}
|
|
33
94
|
},
|
|
34
95
|
"common": {
|
|
@@ -22,13 +22,74 @@
|
|
|
22
22
|
"userCenter": "个人中心",
|
|
23
23
|
"docs": "使用文档",
|
|
24
24
|
"github": "Github",
|
|
25
|
+
"lockScreen": "锁屏",
|
|
26
|
+
"guide": "新手引导",
|
|
25
27
|
"logout": "退出登录"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"lockScreen": {
|
|
31
|
+
"locked": "屏幕已锁定",
|
|
32
|
+
"setPasswordTitle": "设置锁屏密码",
|
|
33
|
+
"setPasswordTip": "首次使用锁屏,请设置一个独立的解锁密码",
|
|
34
|
+
"passwordPlaceholder": "请输入锁屏密码",
|
|
35
|
+
"newPasswordPlaceholder": "请设置锁屏密码",
|
|
36
|
+
"confirmPasswordPlaceholder": "请再次输入密码",
|
|
37
|
+
"unlock": "解锁",
|
|
38
|
+
"confirm": "确认设置",
|
|
39
|
+
"passwordRequired": "请输入密码",
|
|
40
|
+
"passwordMismatch": "两次输入的密码不一致",
|
|
41
|
+
"wrongPassword": "密码错误,请重新输入",
|
|
42
|
+
"setSuccess": "锁屏密码设置成功",
|
|
43
|
+
"unlockSuccess": "已解锁",
|
|
44
|
+
"switchAccount": "切换账号",
|
|
45
|
+
"enterToUnlock": "按 Enter 键解锁"
|
|
46
|
+
},
|
|
47
|
+
"guide": {
|
|
48
|
+
"buttons": {
|
|
49
|
+
"prev": "上一步",
|
|
50
|
+
"next": "下一步",
|
|
51
|
+
"done": "开始使用",
|
|
52
|
+
"close": "跳过"
|
|
53
|
+
},
|
|
54
|
+
"welcome": {
|
|
55
|
+
"title": "欢迎使用",
|
|
56
|
+
"desc": "花一分钟了解顶栏的核心功能,随时可从右上角头像菜单重新查看。"
|
|
57
|
+
},
|
|
58
|
+
"search": {
|
|
59
|
+
"title": "全局搜索",
|
|
60
|
+
"desc": "快速搜索菜单与页面,支持快捷键 Ctrl/Cmd + K。"
|
|
61
|
+
},
|
|
62
|
+
"fullscreen": {
|
|
63
|
+
"title": "全屏模式",
|
|
64
|
+
"desc": "一键进入或退出浏览器全屏,获得更大的操作空间。"
|
|
65
|
+
},
|
|
66
|
+
"language": {
|
|
67
|
+
"title": "语言切换",
|
|
68
|
+
"desc": "在多种界面语言之间切换。"
|
|
69
|
+
},
|
|
70
|
+
"notification": {
|
|
71
|
+
"title": "通知中心",
|
|
72
|
+
"desc": "查看系统通知与消息提醒。"
|
|
73
|
+
},
|
|
74
|
+
"chat": {
|
|
75
|
+
"title": "消息聊天",
|
|
76
|
+
"desc": "打开聊天窗口,进行实时沟通。"
|
|
77
|
+
},
|
|
78
|
+
"settings": {
|
|
79
|
+
"title": "系统设置",
|
|
80
|
+
"desc": "自定义主题、菜单布局与界面显示等偏好。"
|
|
81
|
+
},
|
|
82
|
+
"theme": {
|
|
83
|
+
"title": "主题切换",
|
|
84
|
+
"desc": "在明亮与暗色主题之间快速切换。"
|
|
85
|
+
},
|
|
86
|
+
"lock": {
|
|
87
|
+
"title": "锁屏",
|
|
88
|
+
"desc": "锁定屏幕保护隐私,使用独立密码解锁。"
|
|
26
89
|
},
|
|
27
|
-
"
|
|
28
|
-
"title": "
|
|
29
|
-
"
|
|
30
|
-
"menu": "开启顶栏菜单",
|
|
31
|
-
"description": "等更多配置"
|
|
90
|
+
"userMenu": {
|
|
91
|
+
"title": "用户菜单",
|
|
92
|
+
"desc": "查看个人信息、重新观看引导或退出登录。"
|
|
32
93
|
}
|
|
33
94
|
},
|
|
34
95
|
"common": {
|
package/template/src/main.ts
CHANGED
|
@@ -4,14 +4,17 @@ import { initStore } from './store' // Store
|
|
|
4
4
|
import { initRouter } from './router' // Router
|
|
5
5
|
import language from './locales' // 国际化
|
|
6
6
|
import '@styles/core/tailwind.css' // tailwind
|
|
7
|
+
import 'element-plus/dist/index.css' // Element Plus 基础样式(覆盖组件包内部依赖)
|
|
7
8
|
import '@styles/index.scss' // 样式
|
|
8
9
|
import '@kevairy/components/style.css' // 公共组件样式
|
|
9
10
|
import '@utils/sys/console.ts' // 控制台输出内容
|
|
10
11
|
import { setupGlobDirectives } from './directives'
|
|
11
12
|
import { setupErrorHandle } from './utils/sys/error-handle'
|
|
12
13
|
import { initializeApp } from './bootstrap/initializeApp'
|
|
14
|
+
import { setupOfflineIcons } from '@utils/ui/iconify-loader' // 离线图标集(内网可用)
|
|
13
15
|
|
|
14
16
|
initializeApp()
|
|
17
|
+
setupOfflineIcons()
|
|
15
18
|
|
|
16
19
|
const app = createApp(App)
|
|
17
20
|
initStore(app)
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 锁屏状态管理模块
|
|
3
|
+
*
|
|
4
|
+
* 管理锁屏的锁定状态与「独立锁屏密码」。
|
|
5
|
+
*
|
|
6
|
+
* ## 主要功能
|
|
7
|
+
*
|
|
8
|
+
* - 锁定 / 解锁状态管理
|
|
9
|
+
* - 独立锁屏密码的设置与校验(与登录密码无关)
|
|
10
|
+
* - 密码以哈希形式本地存储,避免明文落盘
|
|
11
|
+
*
|
|
12
|
+
* ## 使用场景
|
|
13
|
+
*
|
|
14
|
+
* - 顶栏锁屏按钮触发锁定
|
|
15
|
+
* - 锁屏界面校验密码后解锁
|
|
16
|
+
* - 退出登录时解除锁定状态
|
|
17
|
+
*
|
|
18
|
+
* ## 持久化
|
|
19
|
+
*
|
|
20
|
+
* - 使用 localStorage 存储
|
|
21
|
+
* - 存储键:sys-v{version}-lock
|
|
22
|
+
* - 持久化 isLocked 与 passwordHash,刷新页面后仍保持锁定
|
|
23
|
+
*
|
|
24
|
+
* @module store/modules/lock
|
|
25
|
+
* @author Art Design Pro Team
|
|
26
|
+
*/
|
|
27
|
+
import { defineStore } from 'pinia'
|
|
28
|
+
import { ref, computed } from 'vue'
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 对锁屏密码做哈希,避免明文存储。
|
|
32
|
+
* 优先使用 Web Crypto 的 SHA-256;在不支持的安全上下文下降级为 FNV-1a。
|
|
33
|
+
* @param password 明文密码
|
|
34
|
+
* @returns 哈希字符串
|
|
35
|
+
*/
|
|
36
|
+
async function hashPassword(password: string): Promise<string> {
|
|
37
|
+
try {
|
|
38
|
+
if (globalThis.crypto?.subtle) {
|
|
39
|
+
const data = new TextEncoder().encode(password)
|
|
40
|
+
const digest = await crypto.subtle.digest('SHA-256', data)
|
|
41
|
+
return Array.from(new Uint8Array(digest))
|
|
42
|
+
.map((byte) => byte.toString(16).padStart(2, '0'))
|
|
43
|
+
.join('')
|
|
44
|
+
}
|
|
45
|
+
} catch {
|
|
46
|
+
// 忽略异常,走降级方案
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// 降级:FNV-1a 32 位哈希(仅用于不支持 Web Crypto 的环境)
|
|
50
|
+
let hash = 0x811c9dc5
|
|
51
|
+
for (let i = 0; i < password.length; i++) {
|
|
52
|
+
hash ^= password.charCodeAt(i)
|
|
53
|
+
hash = Math.imul(hash, 0x01000193) >>> 0
|
|
54
|
+
}
|
|
55
|
+
return `fnv-${hash.toString(16)}`
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* 锁屏状态管理
|
|
60
|
+
* 管理锁定状态与独立锁屏密码
|
|
61
|
+
*/
|
|
62
|
+
export const useLockStore = defineStore(
|
|
63
|
+
'lockStore',
|
|
64
|
+
() => {
|
|
65
|
+
/** 是否处于锁定状态 */
|
|
66
|
+
const isLocked = ref(false)
|
|
67
|
+
/** 锁屏密码哈希(独立于登录密码,仅本地存储) */
|
|
68
|
+
const passwordHash = ref('')
|
|
69
|
+
|
|
70
|
+
/** 是否已设置锁屏密码 */
|
|
71
|
+
const hasPassword = computed(() => Boolean(passwordHash.value))
|
|
72
|
+
|
|
73
|
+
/** 进入锁定状态 */
|
|
74
|
+
const lock = () => {
|
|
75
|
+
isLocked.value = true
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** 解除锁定状态(保留已设置的密码) */
|
|
79
|
+
const unlock = () => {
|
|
80
|
+
isLocked.value = false
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 设置锁屏密码(存储哈希)
|
|
85
|
+
* @param password 明文密码
|
|
86
|
+
*/
|
|
87
|
+
const setPassword = async (password: string) => {
|
|
88
|
+
passwordHash.value = await hashPassword(password)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* 校验解锁密码是否正确
|
|
93
|
+
* @param password 待校验的明文密码
|
|
94
|
+
* @returns 是否匹配
|
|
95
|
+
*/
|
|
96
|
+
const verifyPassword = async (password: string): Promise<boolean> => {
|
|
97
|
+
if (!passwordHash.value) return false
|
|
98
|
+
return (await hashPassword(password)) === passwordHash.value
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** 清空锁屏状态与密码 */
|
|
102
|
+
const reset = () => {
|
|
103
|
+
isLocked.value = false
|
|
104
|
+
passwordHash.value = ''
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
isLocked,
|
|
109
|
+
passwordHash,
|
|
110
|
+
hasPassword,
|
|
111
|
+
lock,
|
|
112
|
+
unlock,
|
|
113
|
+
setPassword,
|
|
114
|
+
verifyPassword,
|
|
115
|
+
reset
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
persist: {
|
|
120
|
+
key: 'lock',
|
|
121
|
+
storage: localStorage,
|
|
122
|
+
pick: ['isLocked', 'passwordHash']
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
)
|
|
@@ -82,8 +82,6 @@ export const useSettingStore = defineStore(
|
|
|
82
82
|
const showLanguage = ref(SETTING_DEFAULT_CONFIG.showLanguage)
|
|
83
83
|
/** 是否显示进度条 */
|
|
84
84
|
const showNprogress = ref(SETTING_DEFAULT_CONFIG.showNprogress)
|
|
85
|
-
/** 是否显示设置引导 */
|
|
86
|
-
const showSettingGuide = ref(SETTING_DEFAULT_CONFIG.showSettingGuide)
|
|
87
85
|
/** 是否显示节日文本 */
|
|
88
86
|
const showFestivalText = ref(SETTING_DEFAULT_CONFIG.showFestivalText)
|
|
89
87
|
/** 是否显示水印 */
|
|
@@ -100,6 +98,8 @@ export const useSettingStore = defineStore(
|
|
|
100
98
|
const refresh = ref(SETTING_DEFAULT_CONFIG.refresh)
|
|
101
99
|
/** 是否加载节日烟花 */
|
|
102
100
|
const holidayFireworksLoaded = ref(SETTING_DEFAULT_CONFIG.holidayFireworksLoaded)
|
|
101
|
+
/** 新手引导是否已完成(控制首次自动播放) */
|
|
102
|
+
const hasCompletedGuide = ref(SETTING_DEFAULT_CONFIG.hasCompletedGuide)
|
|
103
103
|
|
|
104
104
|
// 样式设置
|
|
105
105
|
/** 边框模式 */
|
|
@@ -290,17 +290,11 @@ export const useSettingStore = defineStore(
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
/**
|
|
293
|
-
*
|
|
293
|
+
* 标记新手引导已完成
|
|
294
|
+
* 首次自动播放结束或用户手动关闭后调用,避免重复自动弹出
|
|
294
295
|
*/
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* 显示设置引导
|
|
301
|
-
*/
|
|
302
|
-
const openSettingGuide = () => {
|
|
303
|
-
showSettingGuide.value = true
|
|
296
|
+
const completeGuide = () => {
|
|
297
|
+
hasCompletedGuide.value = true
|
|
304
298
|
}
|
|
305
299
|
|
|
306
300
|
/**
|
|
@@ -393,7 +387,7 @@ export const useSettingStore = defineStore(
|
|
|
393
387
|
showLanguage,
|
|
394
388
|
showNprogress,
|
|
395
389
|
colorWeak,
|
|
396
|
-
|
|
390
|
+
hasCompletedGuide,
|
|
397
391
|
pageTransition,
|
|
398
392
|
tabStyle,
|
|
399
393
|
menuOpen,
|
|
@@ -427,8 +421,7 @@ export const useSettingStore = defineStore(
|
|
|
427
421
|
setLanguage,
|
|
428
422
|
setNprogress,
|
|
429
423
|
setColorWeak,
|
|
430
|
-
|
|
431
|
-
openSettingGuide,
|
|
424
|
+
completeGuide,
|
|
432
425
|
setPageTransition,
|
|
433
426
|
setTabStyle,
|
|
434
427
|
setMenuOpen,
|
|
@@ -41,6 +41,7 @@ import { AppRouteRecord } from '@/types/router'
|
|
|
41
41
|
import { setPageTitle } from '@/utils/router'
|
|
42
42
|
import { resetRouterState } from '@/router/guards/beforeEach'
|
|
43
43
|
import { useMenuStore } from './menu'
|
|
44
|
+
import { useLockStore } from './lock'
|
|
44
45
|
import { StorageConfig } from '@/utils/storage/storage-config'
|
|
45
46
|
|
|
46
47
|
/**
|
|
@@ -143,6 +144,8 @@ export const useUserStore = defineStore(
|
|
|
143
144
|
sessionStorage.removeItem('iframeRoutes')
|
|
144
145
|
// 清空主页路径
|
|
145
146
|
useMenuStore().setHomePath('')
|
|
147
|
+
// 解除锁屏状态并清除独立锁屏密码,避免下次登录被遗留的锁定态拦截
|
|
148
|
+
useLockStore().reset()
|
|
146
149
|
// 重置路由状态
|
|
147
150
|
resetRouterState(500)
|
|
148
151
|
if (!redirectToLogin) return
|