tiefen_space_h5/app/layout.js

254 lines
8.8 KiB
JavaScript
Raw Permalink Normal View History

2024-07-06 11:05:19 +08:00
"use client";
2024-06-25 20:18:37 +08:00
import { Inter } from "next/font/google";
import React, { useEffect } from "react";
import { usePathname } from "next/navigation";
2024-06-25 20:18:37 +08:00
import "./globals.css";
import BottomNav from "../components/BottomNav";
2024-07-08 20:07:36 +08:00
import { Provider } from "react-redux";
import store from "../store";
2024-07-12 22:52:48 +08:00
import withAuth from "@/components/WithAuth";
import InOtherApp from "@/components/InOtherApp";
2024-06-25 20:18:37 +08:00
const inter = Inter({ subsets: ["latin"] });
2024-06-24 22:12:13 +08:00
2024-07-22 16:07:41 +08:00
const metadata = {
2024-06-26 19:46:31 +08:00
title: "铁粉空间",
description: "与Ta永不失联",
keywords: [
"铁粉空间",
"铁粉空间APP",
"社交",
"网红",
"粉丝",
"创作者",
"变现",
"平台",
"铁粉",
"空间",
],
};
2024-08-05 14:46:42 +08:00
// export const viewport = {
// width: "device-width",
// initialScale: 1,
// maximumScale: 1,
// userScalable: 0,
// };
2024-06-24 22:12:13 +08:00
export default function RootLayout({ children }) {
const pathname = usePathname();
2024-08-15 20:29:15 +08:00
useEffect(() => {
// 禁止双指放大
window.onload = function () {
2024-08-15 21:03:10 +08:00
if (typeof window !== "undefined") {
document.addEventListener("touchstart", function (event) {
if (event.touches.length > 1) {
2024-08-15 20:29:15 +08:00
event.preventDefault();
}
2024-08-15 21:03:10 +08:00
});
var lastTouchEnd = 0;
document.addEventListener(
"touchend",
function (event) {
var now = new Date().getTime();
if (now - lastTouchEnd <= 300) {
event.preventDefault();
}
lastTouchEnd = now;
},
false
);
document.addEventListener("gesturestart", function (event) {
event.preventDefault();
});
}
2024-08-15 20:29:15 +08:00
};
}, []);
useEffect(() => {
const timer = setTimeout(() => {
window.scrollTo({
top: 0,
left: 0,
behavior: "smooth", // 可选,平滑滚动效果
});
clearTimeout(timer);
}, 100);
2024-08-15 20:29:15 +08:00
}, [pathname]);
2024-06-24 22:12:13 +08:00
return (
2024-07-24 20:20:09 +08:00
<html
lang="zh-CN"
className="bg-deepBg h-full"
data-prefers-color-scheme="dark"
>
<head>
2024-07-22 16:07:41 +08:00
<title>{metadata.title}</title>
2024-07-24 20:20:09 +08:00
<link rel="icon" href="/favicon.ico" type="image/x-icon"></link>
2024-07-25 19:52:30 +08:00
<link
rel="shortcut icon"
href="/favicon.ico"
type="image/x-icon"
></link>
2024-07-24 20:20:09 +08:00
<link rel="icon" href="/favicon.png" type="image/png"></link>
2024-08-06 16:21:34 +08:00
{/* <meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/> */}
2024-07-24 20:20:09 +08:00
<meta
name="description"
content={metadata.description}
keywords={metadata.keywords}
/>
2024-07-25 19:52:30 +08:00
<meta charSet="UTF-8" />
{/* <!-- 自定义应用图标可用 --> */}
<link
rel="apple-touch-icon-precomposed"
sizes="120x120"
href="favicon.ico"
/>
{/* <!-- 全屏设置 --> */}
<meta
name="viewport"
2024-08-06 16:21:34 +08:00
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui,viewport-fit=cover"
2024-07-25 19:52:30 +08:00
/>
2024-08-15 20:29:15 +08:00
2024-08-06 16:21:34 +08:00
<meta name="apple-touch-fullscreen" content="yes" />
2024-07-25 19:52:30 +08:00
{/* <!-- 网站开启对 web app 程序的支持 具体表现为去除浏览器地址栏和底部导航栏 :先保存为桌面书签,然后通过书签打开即可生效--> */}
<meta name="apple-mobile-web-app-capable" content="yes" />
{/* <!-- 用来定义顶部状态栏的形式默认是default为白色 black为黑色 black-translucent为灰色半透明会占据屏幕的约20px不同的设备可能会有差异--> */}
{/* <!-- 在定义了apple-mobile-web-app-capable的前提下设置状态栏的属性值apple-mobile-web-app-status-bar-style才有效 --> */}
2024-08-13 12:34:50 +08:00
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
2024-08-06 16:21:34 +08:00
{/* <!-- apple-touch-startup-image用来配置启动动画 --> */}
{/* <!-- 这里要注意,这里图片的尺寸要和设备的静态图片显示尺寸完全对应,差一个像素都会导致启动动画无法显示 --> */}
{/* <!-- 下面列举了iPhone的所有尺寸ps:为了方便大家就全部贴出来了!!) --> */}
{/* <!-- iPhone 678 startup image @2x--> */}
<link
href={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/images/launchPage/750_1334.png"
}
media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image"
/>
{/* <!-- iPhone 678p startup image @3x--> */}
<link
href={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/images/launchPage/1242_2208.png"
}
media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3)"
rel="apple-touch-startup-image"
/>
{/* <!-- iPhone X Xs startup image @3x--> */}
<link
href={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/images/launchPage/1125_2436.png"
}
media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3)"
rel="apple-touch-startup-image"
/>
{/* <!-- iPhone XR startup image @2X --> */}
<link
href={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/images/launchPage/828_1792.png"
}
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image"
/>
{/* <!-- iPhone XR Max startup image @3x--> */}
<link
href={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/images/launchPage/640_960.png"
}
media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image"
/>
<link
href={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/images/launchPage/640_1136.png"
}
media="(device-width: 320px) and (device-height: 568) and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image"
/>
<link
href={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/images/launchPage/1080_1920.png"
}
media="(device-width: 360px) and (device-height: 640px) and (-webkit-device-pixel-ratio: 3)"
rel="apple-touch-startup-image"
/>
<link
href={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/images/launchPage/1080_2340.png"
}
media="(device-width: 360px) and (device-height: 780px) and (-webkit-device-pixel-ratio: 3)"
rel="apple-touch-startup-image"
/>
<link
href={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/images/launchPage/1170_2532.png"
}
media="(device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3)"
rel="apple-touch-startup-image"
/>
<link
href={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/images/launchPage/1179_2556.png"
}
media="(device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3)"
rel="apple-touch-startup-image"
/>
<link
href={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/images/launchPage/1242_2688.png"
}
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3)"
rel="apple-touch-startup-image"
/>
<link
href={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/images/launchPage/1284_2778.png"
}
media="(device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3)"
rel="apple-touch-startup-image"
/>
<link
href={
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/images/launchPage/1290_2796.png"
}
media="(device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3)"
rel="apple-touch-startup-image"
/>
2024-07-24 20:20:09 +08:00
</head>
<body className={`${inter.className} h-full`}>
2024-07-22 19:43:20 +08:00
<main className={`w-full bg-deepBg h-full`}>
2024-08-15 20:29:15 +08:00
<div id="maskDomBox"></div>
<InOtherApp />
2024-08-07 18:08:33 +08:00
{withAuth(
<Provider store={store}>
<div>
{children}
{/* <ImagesMask ref={imagesMaskRef} /> */}
</div>
</Provider>
)}
2024-07-12 22:52:48 +08:00
{/* <Provider store={store}>{children}</Provider> */}
2024-07-02 15:09:48 +08:00
</main>
<footer className="fixed bottom-0 w-screen bg-black">
2024-07-08 20:07:36 +08:00
<div>
<BottomNav />
</div>
</footer>
</body>
2024-06-24 22:12:13 +08:00
</html>
2024-06-25 20:18:37 +08:00
);
2024-06-24 22:12:13 +08:00
}