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: (