From f742787044180cb3f7b0f624db3ed2314e9415fb Mon Sep 17 00:00:00 2001 From: mtvpls <247332661+mtvpls@users.noreply.github.com> Date: Sat, 18 Jul 2026 12:20:15 +0800 Subject: [PATCH] =?UTF-8?q?ios=20pwa=E6=B2=89=E6=B5=B8=E5=BC=8F=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/generate-manifest.js | 3 +-- src/app/layout.tsx | 6 ++++++ src/app/music/MusicClient.tsx | 7 +++++-- src/components/MobileHeader.tsx | 27 +++++++++++++++------------ src/components/PageLayout.tsx | 2 +- src/components/books/BooksLayout.tsx | 11 +++++++++-- src/components/manga/MangaLayout.tsx | 7 +++++-- 7 files changed, 42 insertions(+), 21 deletions(-) diff --git a/scripts/generate-manifest.js b/scripts/generate-manifest.js index 7484f6b..15ed02c 100644 --- a/scripts/generate-manifest.js +++ b/scripts/generate-manifest.js @@ -14,6 +14,7 @@ const manifestPath = path.join(publicDir, 'manifest.json'); const siteName = process.env.NEXT_PUBLIC_SITE_NAME || 'MoonTVPlus'; // manifest.json 模板 +// Apple 状态栏等配置应写在 HTML meta(layout appleWebApp),非标准 manifest 字段浏览器会忽略 const manifestTemplate = { name: siteName, short_name: siteName, @@ -22,8 +23,6 @@ const manifestTemplate = { scope: '/', display: 'standalone', background_color: '#000000', - 'apple-mobile-web-app-capable': 'yes', - 'apple-mobile-web-app-status-bar-style': 'black', icons: [ { src: '/icons/icon-192x192.png', diff --git a/src/app/layout.tsx b/src/app/layout.tsx index a482b6e..96ac487 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -40,6 +40,12 @@ export async function generateMetadata(): Promise { title: siteName, description: '影视聚合', manifest: '/manifest.json', + // iOS 添加到主屏幕:沉浸式状态栏(需配合 viewport-fit=cover + 顶部 safe-area) + appleWebApp: { + capable: true, + statusBarStyle: 'black-translucent', + title: siteName, + }, }; } diff --git a/src/app/music/MusicClient.tsx b/src/app/music/MusicClient.tsx index 4d9bb62..ec6c952 100644 --- a/src/app/music/MusicClient.tsx +++ b/src/app/music/MusicClient.tsx @@ -2093,7 +2093,10 @@ export default function MusicClient({ children: _children }: { children?: React. )} {/* Header */} -
+
@@ -2118,7 +2121,7 @@ export default function MusicClient({ children: _children }: { children?: React.
{/* Main Content */} -
+
{_children}
diff --git a/src/components/MobileHeader.tsx b/src/components/MobileHeader.tsx index 639b7ca..8e1ee6f 100644 --- a/src/components/MobileHeader.tsx +++ b/src/components/MobileHeader.tsx @@ -15,8 +15,11 @@ interface MobileHeaderProps { const MobileHeader = ({ showBackButton = false }: MobileHeaderProps) => { const { siteName } = useSite(); return ( -
-
+
+
{/* 左侧:搜索按钮、返回按钮和设置按钮 */}
{
-
- {/* 中间:Logo(绝对居中) */} -
- - {siteName} - + {/* 中间:Logo(相对内容行居中,避免被 safe-area 顶偏) */} +
+ + {siteName} + +
); diff --git a/src/components/PageLayout.tsx b/src/components/PageLayout.tsx index 86f43c5..da58b5a 100644 --- a/src/components/PageLayout.tsx +++ b/src/components/PageLayout.tsx @@ -107,7 +107,7 @@ const PageLayout = ({ children, activePath = '/', hideNavigation = false }: Page {/* 主内容 */}
-
+
{isRead || pathname === '/books/detail' ? (
{children}
diff --git a/src/components/manga/MangaLayout.tsx b/src/components/manga/MangaLayout.tsx index e0028c0..bbdc556 100644 --- a/src/components/manga/MangaLayout.tsx +++ b/src/components/manga/MangaLayout.tsx @@ -64,7 +64,10 @@ export default function MangaLayout({ children }: MangaLayoutProps) { return (
-
+
{meta.backHref ? ( @@ -154,7 +157,7 @@ export default function MangaLayout({ children }: MangaLayoutProps) {