diff --git a/app/globals.css b/app/globals.css index b9e4a21..63b70d9 100644 --- a/app/globals.css +++ b/app/globals.css @@ -3,18 +3,17 @@ @tailwind utilities; body{ color:#fff; - padding-bottom: constant(safe-area-inset-bottom); - padding-bottom: env(safe-area-inset-bottom); + /* padding-bottom: constant(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); */ } footer{ /* Fallback for non-iOS devices */ bottom: 0; - /* iOS 11.0+ */ - bottom: constant(safe-area-inset-bottom); + padding-bottom: constant(safe-area-inset-bottom); /* iOS 11.2+ */ - bottom: env(safe-area-inset-bottom); + padding-bottom: env(safe-area-inset-bottom); } /* :root { --foreground-rgb: 0, 0, 0; diff --git a/app/layout.js b/app/layout.js index e6b4f5a..c7bc061 100644 --- a/app/layout.js +++ b/app/layout.js @@ -74,7 +74,7 @@ export default function RootLayout({ children }) { {/* */} {/* */} {/* */} diff --git a/app/login/page.js b/app/login/page.js index 37be862..fef53df 100644 --- a/app/login/page.js +++ b/app/login/page.js @@ -15,7 +15,7 @@ import { useRouter } from "next/navigation"; import styles from "./index.module.scss"; import { JSEncrypt } from "jsencrypt"; import { handleLogin } from "@/store/actions"; -import { saveUserInfo, get } from "@/utils/storeInfo"; +import { saveUserInfo, get, save } from "@/utils/storeInfo"; import { connect } from "react-redux"; import { cryptoPassword } from "@/utils/crypto"; import requireAPI from "@/utils/requireAPI"; @@ -169,7 +169,11 @@ function Login({ handleLogin }) { saveUserInfo(data, mobilePhone, regionCode); signIn(data); handleLogin({ isSignin: true, userToken: data.data.token }); - + if(get("firstLogin")==null){ + save("firstLogin",1) + }else{ + save("firstLogin",0) + } router.push( !data?.data?.is_enabled && type != "password" ? "/my/setting/editPassword?is_enabled=" + data?.data?.is_enabled diff --git a/app/my/page.js b/app/my/page.js index 4566822..c8ac908 100644 --- a/app/my/page.js +++ b/app/my/page.js @@ -34,7 +34,7 @@ const My = () => { setUserInfo({ ...oldUserInfo, ...data.data,...account.data.account }); }; return ( -
diff --git a/app/page.js b/app/page.js index b692dae..a9d44a3 100644 --- a/app/page.js +++ b/app/page.js @@ -18,8 +18,8 @@ import Link from "next/link"; import requireAPI from "@/utils/requireAPI"; import Empty from "@/components/Empty"; import { get } from "@/utils/storeInfo"; -import { useSearchParams } from "next/navigation"; import StreamerNavigator from "@/components/StreamerNavigator"; +import AddToHome from "@/components/AddToHome"; const variables = { "@active-line-color": "#f00", // 将主题色改为红色 }; @@ -28,22 +28,15 @@ const tabItems = [ { key: "follow", title: "关注" }, ]; -// const scrollHeight = 700; -// const scrollHeight = window.innerHeight-126 export default function Home() { const recommPostRef = useRef(); const followPostRef = useRef(); - const searchParams = useSearchParams(); const swiperRef = useRef(null); const [activeIndex, setActiveIndex] = useState(0); + const [scrollHeight, setScrollHeight] = useState(0); - // 获取屏幕高度 - // const scrollHeight = 600; - useEffect(() => { - setScrollHeight(window.innerHeight); - // getData(0) - }, []); + const childrenFunc = () => { if (!activeIndex) { recommPostRef.current?.doRefresh(); @@ -52,10 +45,7 @@ export default function Home() { } }; return ( -
+
+
); } @@ -186,8 +177,8 @@ const RecommPostList = forwardRef(({ scrollHeight }, ref) => { ))} {commenPostList?.length == 0 && !loading && (
@@ -208,8 +199,8 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => { const [ids, setIds] = useState([]); useEffect(() => { getFollowIds().then((res) => { - setIds(res) - getFollowPostList(res,0) + setIds(res); + getFollowPostList(res, 0); }); }, []); useImperativeHandle( @@ -227,10 +218,10 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => { // }); // throw new Error("刷新失败"); // getRecommPostList(1); - await getFollowPostList(ids,0); + await getFollowPostList(ids, 0); } async function loadMore() { - await getFollowPostList(ids,offset); + await getFollowPostList(ids, offset); // const newList = [...followPostList, ...list]; // setFollowPostList(newList); } @@ -247,8 +238,7 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => { ); return data; }; - const getFollowPostList = async (data,offset) => { - + const getFollowPostList = async (data, offset) => { if (data.data.list.length > 0) { //查关注主播展示资料 const followsResponse = await requireAPI( @@ -264,7 +254,7 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => { } ); // debugger; - console.log("offset",followsResponse.data.offset) + console.log("offset", followsResponse.data.offset); setOffset(followsResponse.data.offset); setHasMore(followsResponse.data.more); setLoading(false); @@ -275,7 +265,7 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => { position: "top", }); } else { - setFollowPostList(old=>[...old,...followsResponse.data.list]); + setFollowPostList((old) => [...old, ...followsResponse.data.list]); } } else { setLoading(false); @@ -302,8 +292,8 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => { ))} {!followPostList?.length && (
diff --git a/app/space/page.js b/app/space/page.js index 53ee7dc..803d472 100644 --- a/app/space/page.js +++ b/app/space/page.js @@ -130,8 +130,8 @@ export default function Space() { } return (
) : (
@@ -251,8 +251,8 @@ export default function Space() { ) : (
diff --git a/components/AddToHome/index.jsx b/components/AddToHome/index.jsx new file mode 100644 index 0000000..d2096c4 --- /dev/null +++ b/components/AddToHome/index.jsx @@ -0,0 +1,42 @@ +"use client"; + +import React,{useState,useEffect} from "react"; +import { Image ,Toast} from "antd-mobile"; +import { get,save } from "@/utils/storeInfo"; +export default function AddToHome() { + const [firstLogin, setFirstLogin] = useState("0"); + useEffect(() => { + if(!(("standalone" in window.navigator) && window.navigator.standalone) + ){ + setFirstLogin(get("firstLogin")) + } + + }, []); + return ( + firstLogin=="1"?
{save("firstLogin", 0);setFirstLogin("0")}} + > +
+ 点击 + + 添加到主屏幕 +
+ +
:null + ); +} diff --git a/components/Photos/index.js b/components/Photos/index.js index 2ed1efd..703d992 100644 --- a/components/Photos/index.js +++ b/components/Photos/index.js @@ -101,7 +101,7 @@ export default function Photos({ title: "", content: (
-
+