+
{
+ Toast.show({
+ icon: "success",
+ content: "请下载安装app后进行申请入驻",
+ position: "top",
+ });
+ }}
+ >
+
+
{
diff --git a/app/page.js b/app/page.js
index 796e3a1..b692dae 100644
--- a/app/page.js
+++ b/app/page.js
@@ -7,14 +7,7 @@ import React, {
useImperativeHandle,
forwardRef,
} from "react";
-import {
- Tabs,
- Swiper,
- Toast,
- InfiniteScroll,
- List,
- Image,
-} from "antd-mobile";
+import { Tabs, Swiper, Toast, InfiniteScroll, List, Image } from "antd-mobile";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faRefresh } from "@fortawesome/free-solid-svg-icons";
import PostItem from "../components/PostItem";
@@ -24,10 +17,9 @@ import PostItemSkeleton from "@/components/skeletons/PostItemSkeleton";
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 { get } from "@/utils/storeInfo";
+import { useSearchParams } from "next/navigation";
import StreamerNavigator from "@/components/StreamerNavigator";
-import { checkAuth } from "@/utils/auth";
const variables = {
"@active-line-color": "#f00", // 将主题色改为红色
};
@@ -44,7 +36,6 @@ export default function Home() {
const searchParams = useSearchParams();
const swiperRef = useRef(null);
const [activeIndex, setActiveIndex] = useState(0);
- const [visible, setVisible] = useState(false);
const [scrollHeight, setScrollHeight] = useState(0);
// 获取屏幕高度
@@ -52,11 +43,6 @@ export default function Home() {
useEffect(() => {
setScrollHeight(window.innerHeight);
// getData(0)
- checkAuth().then(res=>{
- if(res && get("inviter")){
- setVisible(true)
- }
- })
}, []);
const childrenFunc = () => {
if (!activeIndex) {
@@ -93,7 +79,9 @@ export default function Home() {
href="search"
className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full"
>
-
+
-
+
);
}
@@ -154,7 +142,7 @@ const RecommPostList = forwardRef(({ scrollHeight }, ref) => {
// throw new Error("刷新失败");
const list = await getRecommPostList(1);
setCommenPostList(list);
- setHasMore(true)
+ setHasMore(true);
}
async function loadMore() {
const list = await getRecommPostList(0);
@@ -193,7 +181,7 @@ const RecommPostList = forwardRef(({ scrollHeight }, ref) => {
)}
{commenPostList?.map((item) => (
-
+
))}
{commenPostList?.length == 0 && !loading && (
@@ -217,9 +205,11 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
const [followPostList, setFollowPostList] = useState([]);
const [currentTime, setCurrentTime] = useState();
const [offset, setOffset] = useState(0);
+ const [ids, setIds] = useState([]);
useEffect(() => {
- getFollowPostList().then((res) => {
- setFollowPostList(res);
+ getFollowIds().then((res) => {
+ setIds(res)
+ getFollowPostList(res,0)
});
}, []);
useImperativeHandle(
@@ -237,33 +227,46 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
// });
// throw new Error("刷新失败");
// getRecommPostList(1);
- const list = await getFollowPostList(1);
- setFollowPostList(list);
+ await getFollowPostList(ids,0);
}
async function loadMore() {
- const list = await getFollowPostList();
- const newList = [...followPostList, ...list];
- setOffset(newList.length / 4);
- setFollowPostList(newList);
+ await getFollowPostList(ids,offset);
+ // const newList = [...followPostList, ...list];
+ // setFollowPostList(newList);
}
- const getFollowPostList = async () => {
+ const getFollowIds = async () => {
setLoading(true);
setCurrentTime(Math.floor(new Date().getTime() / 1000));
- const data = await requireAPI("POST", "/api/account_relation/list_follow", {
- body: { offset, limit: 4 },
- }, true);
- setHasMore(data.data.list.length > 0);
+ const data = await requireAPI(
+ "POST",
+ "/api/account_relation/list_follow",
+ {
+ body: { offset, limit: 4 },
+ },
+ true
+ );
+ return data;
+ };
+ const getFollowPostList = async (data,offset) => {
+
if (data.data.list.length > 0) {
//查关注主播展示资料
- const followsResponse =
- await requireAPI("POST", "/api/moment/list_by_mids", {
+ const followsResponse = await requireAPI(
+ "POST",
+ "/api/moment/list_by_mids",
+ {
body: {
offset,
limit: 4,
ct_upper_bound: currentTime,
mids: data.data.list?.map((item) => item.obj_mid),
},
- });
+ }
+ );
+ // debugger;
+ console.log("offset",followsResponse.data.offset)
+ setOffset(followsResponse.data.offset);
+ setHasMore(followsResponse.data.more);
setLoading(false);
if (data.ret == -1) {
Toast.show({
@@ -272,12 +275,13 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
position: "top",
});
} else {
- return followsResponse.data.list;
+ setFollowPostList(old=>[...old,...followsResponse.data.list]);
}
} else {
setLoading(false);
}
};
+
return (
+
铁粉空间APP可以下载啦~
diff --git a/app/my/page.js b/app/my/page.js index 0c99076..4566822 100644 --- a/app/my/page.js +++ b/app/my/page.js @@ -322,6 +322,31 @@ const My = () => { className="h-4 text-gray-300" /> */} +
+
+ 申请入驻
+
+
{/* */}
@@ -293,13 +297,13 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
)}
{followPostList?.map((item, index) => (
-
+
))}
{!followPostList?.length && (
@@ -311,4 +315,4 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
{/* */}
);
-});
\ No newline at end of file
+});
diff --git a/components/StreamerNavigator/index.js b/components/StreamerNavigator/index.js
index 885ecdc..804768a 100644
--- a/components/StreamerNavigator/index.js
+++ b/components/StreamerNavigator/index.js
@@ -6,9 +6,7 @@ import {getStreamer} from "@/api/streamer";
import { useRouter } from "next/navigation";
import {remove} from "@/utils/storeInfo"
export default function StreamerNavigator({
- visible,
userId,
- setVisible
}) {
const [streamerInfo,setStreamerInfo] = useState(null);
const router = useRouter();
@@ -20,10 +18,10 @@ export default function StreamerNavigator({
},[])
const handleCloseMask = ()=>{
remove("inviter")
- setVisible(false)
+ setStreamerInfo(null)
}
return (
- {
fetch(url, mergedOptions)
.then((response) => {
- // 检查响应状态码
- if (!response.ok) {
- throw new Error(`HTTP error! status: ${response.status}`);
- }
+ // // 检查响应状态码
+ // if (!response.ok) {
+ // throw new Error(`HTTP error! status: ${response.status}`);
+ // }
// 解析 JSON 响应
return response.json();
})