feat: 添加 AoyagiReisho 书法字体并优化表单反馈

- 使用 next/font/local 加载 AoyagiReisho.ttf 字体
- 为标题红色高亮文字应用书法字体样式
- 优化联系表单提交反馈,添加成功/失败提示
- 修复 section 参数滚动定位的时序问题
This commit is contained in:
张翔
2026-04-21 11:18:29 +08:00
parent 2fc1a586f8
commit 933a831ab3
9 changed files with 52 additions and 34 deletions
+25 -11
View File
@@ -51,17 +51,31 @@ function HomeContent() {
useEffect(() => {
const section = searchParams.get('section');
if (section) {
const timer = setTimeout(() => {
const targetElement = document.getElementById(section);
if (targetElement) {
targetElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
}, 100);
return () => clearTimeout(timer);
}
return undefined;
if (!section) {return;}
const maxAttempts = 50;
const interval = 100;
let attempts = 0;
const scrollToSection = () => {
const targetElement = document.getElementById(section);
if (targetElement) {
targetElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
return true;
}
return false;
};
if (scrollToSection()) {return;}
const timer = setInterval(() => {
attempts++;
if (scrollToSection() || attempts >= maxAttempts) {
clearInterval(timer);
}
}, interval);
return () => clearInterval(timer);
}, [searchParams]);
return (