Skip to content

Commit 595cc26

Browse files
committed
fix(docs): reduce welcome screen delay and add localStorage check
1 parent ab3a111 commit 595cc26

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

docs/.vitepress/theme/components/WelcomeScreen.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const runLoop = () => {
2525
timers.push(
2626
setTimeout(() => {
2727
phase.value = 'fade'
28-
}, 6200)
28+
}, 5800)
2929
)
3030
timers.push(
3131
setTimeout(() => {

docs/index.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ layout: home
66
import { onMounted } from 'vue'
77
import { withBase } from 'vitepress'
88

9+
const WELCOME_SEEN_KEY = 'easy-vibe-welcome-seen'
10+
911
onMounted(() => {
1012
// 语言映射:浏览器语言代码 -> 网站路径
1113
const langMap = {
@@ -44,8 +46,23 @@ onMounted(() => {
4446
targetLang = '/zh-cn/'
4547
}
4648

49+
const targetPath = withBase(targetLang)
50+
let hasSeenWelcome = false
51+
try {
52+
hasSeenWelcome = window.localStorage.getItem(WELCOME_SEEN_KEY) === '1'
53+
} catch {
54+
hasSeenWelcome = false
55+
}
56+
57+
if (!hasSeenWelcome) {
58+
window.location.replace(
59+
withBase(`/welcome/?next=${encodeURIComponent(targetPath)}`)
60+
)
61+
return
62+
}
63+
4764
// 立即跳转,不显示任何内容
4865
// 使用 withBase 自动处理 base 路径(根据 config.mjs 中的配置)
49-
window.location.replace(withBase(targetLang))
66+
window.location.replace(targetPath)
5067
})
5168
</script>

0 commit comments

Comments
 (0)