修复广场关注
This commit is contained in:
parent
a8ac8007bf
commit
7a80240273
|
@ -77,23 +77,23 @@ export default function RootLayout({ children }) {
|
|||
{/* <!-- 这里要注意,这里图片的尺寸要和设备的静态图片显示尺寸完全对应,差一个像素都会导致启动动画无法显示 --> */}
|
||||
{/* <!-- 下面列举了iPhone的所有尺寸(ps:为了方便大家就全部贴出来了!!) --> */}
|
||||
{/* <!-- iPhone 678 startup image @2x--> */}
|
||||
<link href={"/images/launchPage/750_1334.png"} media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image"/>
|
||||
<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={"/images/launchPage/1242_2208.png"} media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3)" rel="apple-touch-startup-image"/>
|
||||
<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={"/images/launchPage/1125_2436.png"} media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3)" rel="apple-touch-startup-image"/>
|
||||
<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={"/images/launchPage/828_1792.png"} media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image"/>
|
||||
<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={"/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={"/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={"/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={"/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={"/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={"/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={"/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={"/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={"/images/launchPage/1290_2796.png"} media="(device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3)" rel="apple-touch-startup-image"/>
|
||||
<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"/>
|
||||
</head>
|
||||
<body className={`${inter.className} h-full`}>
|
||||
<main className={`w-full bg-deepBg h-full`}>
|
||||
|
|
|
@ -19,7 +19,7 @@ import { saveUserInfo, removeUserInfo } from "@/utils/storeInfo";
|
|||
import { connect } from "react-redux";
|
||||
import { cryptoPassword } from "@/utils/crypto";
|
||||
import requireAPI from "@/utils/requireAPI";
|
||||
import { signOut, signIn } from "@/utils/auth";
|
||||
import { signOut, signIn,checkAuth } from "@/utils/auth";
|
||||
/*
|
||||
params格式:
|
||||
{
|
||||
|
@ -55,8 +55,16 @@ function Login({ handleLogin }) {
|
|||
setDeviceType("pc");
|
||||
}
|
||||
handleLogin({ isSignin: false, userToken: null });
|
||||
signOut();
|
||||
removeUserInfo();
|
||||
checkAuth().then(res=>{
|
||||
if(res){
|
||||
router.push("/")
|
||||
}else{
|
||||
removeUserInfo();
|
||||
// signOut();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
let interval;
|
||||
|
@ -448,7 +456,7 @@ const LoginBtn = ({ loginInfo, setLoginInfo, type, handleSubmit }) => {
|
|||
const BottomBox = () => {
|
||||
const router = useRouter();
|
||||
return (
|
||||
<div className="fixed bottom-0 w-full p-6 ">
|
||||
<div className="w-full p-6 ">
|
||||
<div className="p-3 rounded-md flex justify-between items-center bg-[#ffffff17]">
|
||||
<div>
|
||||
<p className="">铁粉空间APP可以下载啦~</p>
|
||||
|
|
|
@ -322,6 +322,31 @@ const My = () => {
|
|||
className="h-4 text-gray-300"
|
||||
/>
|
||||
</li> */}
|
||||
<li
|
||||
className="flex justify-between items-center p-3 py-2"
|
||||
onClick={() => {
|
||||
Toast.show({
|
||||
icon: "success",
|
||||
content: "请下载安装app后进行申请入驻",
|
||||
position: "top",
|
||||
});
|
||||
}}
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<Image
|
||||
className="mr-2"
|
||||
width={32}
|
||||
src={process.env.NEXT_PUBLIC_WEB_ASSETS_URL+"/icons/32DP/join.png"}
|
||||
placeholder=""
|
||||
/>
|
||||
<span className="text-base">申请入驻</span>
|
||||
</div>
|
||||
<FontAwesomeIcon
|
||||
icon={faAngleRight}
|
||||
size="sm"
|
||||
className="h-4 text-gray-300"
|
||||
/>
|
||||
</li>
|
||||
<li
|
||||
className="flex justify-between items-center p-3 py-2"
|
||||
onClick={() => {
|
||||
|
|
86
app/page.js
86
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"
|
||||
>
|
||||
<Image src={process.env.NEXT_PUBLIC_WEB_ASSETS_URL+"/icons/search.png"} />
|
||||
<Image
|
||||
src={process.env.NEXT_PUBLIC_WEB_ASSETS_URL + "/icons/search.png"}
|
||||
/>
|
||||
</Link>
|
||||
</div>
|
||||
<Swiper
|
||||
|
@ -125,7 +113,7 @@ export default function Home() {
|
|||
>
|
||||
<FontAwesomeIcon icon={faRefresh} size="xl" />
|
||||
</div>
|
||||
<StreamerNavigator visible={visible} setVisible={setVisible} userId={Number(get("inviter"))}/>
|
||||
<StreamerNavigator userId={Number(get("inviter"))} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -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) => (
|
||||
<List.Item key={item.id} className="!p-0">
|
||||
<PostItem type="post" data={item} date={new Date(item.ct*1000)}/>
|
||||
<PostItem type="post" data={item} date={new Date(item.ct * 1000)} />
|
||||
</List.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 (
|
||||
<div className="px-4 pb-20">
|
||||
{/* <PullToRefresh onRefresh={doRefresh}> */}
|
||||
|
@ -293,13 +297,13 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
|
|||
)}
|
||||
{followPostList?.map((item, index) => (
|
||||
<List.Item key={item.id + "_" + index} className="!p-0">
|
||||
<PostItem type="post" data={item} date={new Date(item.ct*1000)}/>
|
||||
<PostItem type="post" data={item} date={new Date(item.ct * 1000)} />
|
||||
</List.Item>
|
||||
))}
|
||||
{!followPostList?.length && (
|
||||
<div
|
||||
className={`flex flex-col items-center justify-center`}
|
||||
style={{ height: `${scrollHeight-98}px` }}
|
||||
style={{ height: `${scrollHeight - 98}px` }}
|
||||
>
|
||||
<Empty type="nodata" />
|
||||
</div>
|
||||
|
@ -311,4 +315,4 @@ const FollowPostList = forwardRef(({ scrollHeight }, ref) => {
|
|||
{/* </PullToRefresh> */}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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 (
|
||||
<Mask visible={visible} onMaskClick={handleCloseMask}>
|
||||
<Mask visible={(!!streamerInfo)} onMaskClick={handleCloseMask}>
|
||||
<div
|
||||
className="fixed top-[20%] left-[12.5%] w-3/4 flex-1 justify-center items-center "
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ const nextConfig = {
|
|||
return [
|
||||
{
|
||||
source: "/api/:path*",
|
||||
destination: "https://h5api.tiefen.fun/api/:path*",
|
||||
destination: "https://testapi.tiefen.fun/api/:path*",
|
||||
},
|
||||
];
|
||||
},
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
import { setCookie, deleteCookie, getCookie } from "cookies-next";
|
||||
import requireAPI from "./requireAPI";
|
||||
import {get} from "./storeInfo"
|
||||
import { get } from "./storeInfo";
|
||||
export async function checkAuth() {
|
||||
try {
|
||||
const data = await requireAPI("POST", `/api/login/validate`);
|
||||
if (data.ret === -1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return data.ret === 1;
|
||||
} catch (e) {
|
||||
console.warn(e);
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,9 +20,9 @@ export function signOut() {
|
|||
deleteCookie("mid");
|
||||
}
|
||||
|
||||
export function checkRole(){
|
||||
const account = get("account");
|
||||
const role = account.role;
|
||||
const isVip = account.is_a_member;
|
||||
return (role !== 0 || isVip === 1);
|
||||
};
|
||||
export function checkRole() {
|
||||
const account = get("account");
|
||||
const role = account?.role;
|
||||
const isVip = account?.is_a_member;
|
||||
return role !== 0 || isVip === 1;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ export default function customFetch(method, url, options = {}, mid) {
|
|||
newBody.mid = mid;
|
||||
}
|
||||
const body = JSON.stringify({ ...base, ...newBody });
|
||||
// console.log("newBody", body,url);
|
||||
console.log("newBody", body,url);
|
||||
|
||||
// 合并选项
|
||||
const mergedOptions = { ...defaultOptions, body };
|
||||
|
@ -33,10 +33,10 @@ export default function customFetch(method, url, options = {}, mid) {
|
|||
return new Promise((resolve, reject) => {
|
||||
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();
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue