Skip to content

Commit f1f90eb

Browse files
committed
upd: Adjust page layout and optimize mobile device detection logic
1 parent 3c1139a commit f1f90eb

11 files changed

Lines changed: 337 additions & 141 deletions

File tree

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="UTF-8" />
55
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
66
<link rel="icon" href="/favicon_mac.ico" />
7+
<link rel="stylesheet" href="./src/client/index.less">
78
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
89
<meta name="description" content="为编程初学者而生">
910
<title>Algo Bootstrap</title>

src/client/components/beams.vue

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -492,16 +492,22 @@ onMounted(async () => {
492492
gsap.registerPlugin(ScrollTrigger);
493493
}
494494
495-
gsap.to(".beams-container", {
496-
scrollTrigger: {
497-
trigger: ".beams-container",
498-
start: "top top",
499-
end: "bottom top",
500-
scrub: 1,
495+
// 设置滚动时的透明度变化:顶部时不透明度为1,向下滚动时降低到0.1
496+
gsap.fromTo(".beams-container",
497+
{
498+
opacity: 1, // 初始状态:完全不透明
501499
},
502-
opacity: .1,
503-
duration: 1,
504-
});
500+
{
501+
opacity: 0.1, // 结束状态:几乎透明
502+
scrollTrigger: {
503+
trigger: "body", // 以整个页面作为触发器
504+
start: "top top", // 从页面顶部开始
505+
end: "bottom top", // 到页面底部结束
506+
scrub: true, // 跟随滚动
507+
invalidateOnRefresh: true, // 刷新时重新计算
508+
}
509+
}
510+
);
505511
}
506512
});
507513
@@ -517,6 +523,8 @@ onUnmounted(() => {
517523
top: 0;
518524
width: 100%;
519525
height: 100%;
526+
opacity: 1; /* 初始透明度为完全不透明 */
527+
z-index: -1; /* 确保在其他内容后面 */
520528
}
521529
</style>
522530

src/client/components/download-button.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ export default class DownloadButton extends Vue {
1616
@Prop({ type: Boolean, default: false }) isHome: Boolean;
1717
@Prop({ type: String, required: true }) version!: string;
1818
19-
// 检测是否为移动设备
19+
// 检测是否为移动设备 - 使用传入的平台信息而不是直接检测 userAgent
20+
// 避免 SSR 水合不匹配问题
2021
get isMobileDevice(): boolean {
21-
if (typeof navigator === 'undefined') return false;
22-
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
22+
// 基于传入的平台信息判断,而不是 navigator.userAgent
23+
// 只有 windows 和 mac 被认为是桌面平台
24+
return this.platform !== 'windows' && this.platform !== 'mac';
2325
}
2426
2527
get isSupportedPlatform(): boolean {
@@ -95,7 +97,7 @@ export default class DownloadButton extends Vue {
9597
<span class="download-all-platforms" v-if="isSupportedPlatform && isHome">
9698
下载 <router-link class="link" :to="{ name: 'Releases' }">其他平台</router-link> 版本
9799
</span>
98-
<span class="download-all-platforms" v-if="isUnsupportedPlatform && isHome">仅支持 Windows 和 macOS.</span>
100+
<span class="download-all-platforms" v-if="isUnsupportedPlatform && isHome">仅支持 Windows 和 macOS</span>
99101
</div>
100102
</template>
101103

src/client/components/guide.vue

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,22 @@ export default class Guide extends Vue {
2626
const videoContainer = this.$refs['guide-video'] as HTMLElement;
2727
const video = videoContainer?.querySelector('video') as HTMLVideoElement | null;
2828
29-
const textObserver = new IntersectionObserver(
30-
(entries) => {
31-
entries.forEach((entry) => {
32-
if (entry.isIntersecting) {
33-
texts.forEach((text) => {
34-
text.classList.add('text-show');
35-
});
36-
if (video && video.paused) {
37-
video.play();
38-
}
39-
} else {
40-
if (video && !video.paused) {
41-
video.pause();
42-
}
29+
const textObserver = new IntersectionObserver((entries) => {
30+
entries.forEach((entry) => {
31+
if (entry.isIntersecting) {
32+
texts.forEach((text) => {
33+
text.classList.add('text-show');
34+
});
35+
if (video && video.paused) {
36+
video.play();
4337
}
44-
});
45-
},
46-
{
47-
threshold: 0.2,
48-
},
49-
);
38+
} else {
39+
if (video && !video.paused) {
40+
video.pause();
41+
}
42+
}
43+
});
44+
});
5045
5146
textObserver.observe(guide);
5247
}
@@ -86,7 +81,7 @@ export default class Guide extends Vue {
8681
}
8782
8883
@media screen and (max-width: 768px) {
89-
width: 80%;
84+
width: 90%;
9085
}
9186
height: auto;
9287
display: flex;

src/client/components/home-footer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ footer {
5353
height: auto;
5454
margin-bottom: 50px;
5555
user-select: none;
56+
margin-top: 60px;
5657
5758
@media screen and (max-width: 768px) {
5859
height: auto;
5960
padding: 40px 0;
60-
margin-top: 50px;
6161
}
6262
display: flex;
6363
flex-direction: column;

0 commit comments

Comments
 (0)