main #39

Merged
yezian merged 2 commits from main into space_domain 2025-02-11 19:32:47 +08:00
1 changed files with 102 additions and 104 deletions

View File

@ -51,6 +51,7 @@ export default function Space() {
}, []);
useEffect(() => {
firstRequest();
setDataList([]);
}, [activeIndex]);
const firstRequest = () => {
resetOffset();
@ -65,7 +66,6 @@ export default function Space() {
};
const resetOffset = () => {
setOffset(0);
// setDataList([]);
};
const getSpaceList = async () => {
// setLoading(true);
@ -136,7 +136,7 @@ export default function Space() {
onChange={(key) => {
const index = tabItems.findIndex((item) => item.key === key);
setActiveIndex(index);
// swiperRef.current?.swipeTo(index);
swiperRef.current?.swipeTo(index);
}}
>
{tabItems.map((item) => (
@ -155,132 +155,131 @@ export default function Space() {
<OwnIcon src="/icons/search.png" className="w-9 h-9" />
</Link>
</div>
{}
<Swiper
direction="horizontal"
indicator={() => null}
// ref={swiperRef}
ref={swiperRef}
defaultIndex={activeIndex}
allowTouchMove={false}
onIndexChange={(index) => {
setActiveIndex(index);
}}
>
<Swiper.Item>
{!activeIndex && (
<div>
{!loading ? (
// <div className="px-4 pb-8">
<div>
{!loading ? (
// <div className="px-4 pb-8">
// </div>
<>
{dataList?.length > 0 ? (
<div className="px-4 pb-20">
<ul className="grid grid-cols-2 gap-2 overflow-y-auto">
{dataList?.map((item) => (
<li key={item.id}>
<VisitingCard data={item} />
</li>
))}
<li onClick={() => router.push("/search")}>
// </div>
<>
{dataList?.length > 0 ? (
<div className="px-4 pb-20">
<ul className="grid grid-cols-2 gap-2 overflow-y-auto">
{dataList?.map((item) => (
<li key={item.id}>
<VisitingCard data={item} />
</li>
))}
<li onClick={() => router.push("/search")}>
<div
// onPress={() => navigation.navigate("Stream")}
// onClick={}
className="w-full h-52"
>
<div
// onPress={() => navigation.navigate("Stream")}
// onClick={}
className="w-full h-52"
className="h-full flex flex-col rounded-lg overflow-hidden bg-[#FFFFFF1A] bg-no-repeat bg-right-bottom bg-40%"
style={{
backgroundImage: `url(${
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/icons/magnifier.png"
})`,
}}
>
<div
className="h-full flex flex-col rounded-lg overflow-hidden bg-[#FFFFFF1A] bg-no-repeat bg-right-bottom bg-40%"
style={{
backgroundImage: `url(${
process.env.NEXT_PUBLIC_WEB_ASSETS_URL +
"/icons/magnifier.png"
})`,
}}
>
{/* <div className="w-full z-0"></div>
{/* <div className="w-full z-0"></div>
<div
className="w-full z-0 h-[42px]"
></div> */}
<div className="flex flex-col w-full h-full px-[22px] py-[30px]">
<p className="text-white font-medium text-lg">
发现更多
</p>
<p className="text-[#FFFFFF40] font-sm">
缘分就在不经意间
</p>
<OwnIcon
className="w-full h-full"
outClassName="w-[32px] h-[32px] mt-4"
src="/icons/rightarrow_border.png"
/>
</div>
<div className="flex flex-col w-full h-full px-[22px] py-[30px]">
<p className="text-white font-medium text-lg">
发现更多
</p>
<p className="text-[#FFFFFF40] font-sm">
缘分就在不经意间
</p>
<OwnIcon
className="w-full h-full"
outClassName="w-[32px] h-[32px] mt-4"
src="/icons/rightarrow_border.png"
/>
</div>
</div>
</li>
</ul>
</div>
) : (
<div
className={`flex flex-col items-center justify-center`}
style={{ height: `calc(100vh - 120px)` }}
>
<Empty type="nospace" />
<div className="flex flex-col mt-6">
<Link
href="search"
className="bg-[#FFFFFF40] px-12 py-2 rounded-full text-base text-white"
>
搜索空间
</Link>
{/* <Link
</div>
</li>
</ul>
</div>
) : (
<div
className={`flex flex-col items-center justify-center`}
style={{ height: `calc(100vh - 120px)` }}
>
<Empty type="nospace" />
<div className="flex flex-col mt-6">
<Link
href="search"
className="bg-[#FFFFFF40] px-12 py-2 rounded-full text-base text-white"
>
搜索空间
</Link>
{/* <Link
href="search"
className="bg-[#FFFFFF40] px-12 py-2 rounded-full text-base text-white mt-2"
>
查看推荐
</Link> */}
</div>
</div>
)}
</>
) : (
<div
className="w-full text-center flex items-center justify-center h-screen"
// style={{ height: scrollHeight - 60 + "px" }}
>
<SpinLoading />
</div>
)}
</div>
)}
</div>
)}
</>
) : (
<div
className="w-full text-center flex items-center justify-center h-screen"
// style={{ height: scrollHeight - 60 + "px" }}
>
<SpinLoading />
</div>
)}
</div>
</Swiper.Item>
<Swiper.Item>
{!!activeIndex && (
<div className="px-4 pb-20">
<List className="scrollbarBox_hidden">
{loading && !dataList.length && (
<>
<PostItemSkeleton />
<PostItemSkeleton />
<PostItemSkeleton />
<PostItemSkeleton />
</>
)}
{dataList?.map((item, index) => (
<List.Item className="!p-0" key={item.id + "_" + index}>
<PostItem
type="space"
data={item}
date={new Date(item.ct * 1000)}
/>
</List.Item>
))}
<InfiniteScroll loadMore={loadMore} hasMore={hasMore}>
<InfiniteScrollContent
hasMore={hasMore}
isEmpty={dataList.length === 0}
showNoMore={!dataList.length}
<div className="px-4 pb-20">
<List className="scrollbarBox_hidden">
{loading && !dataList.length && (
<>
<PostItemSkeleton />
<PostItemSkeleton />
<PostItemSkeleton />
<PostItemSkeleton />
</>
)}
{dataList?.map((item, index) => (
<List.Item className="!p-0" key={item.id + "_" + index}>
<PostItem
type="space"
data={item}
date={new Date(item.ct * 1000)}
/>
</InfiniteScroll>
</List>
{/* {!dataList?.length && (
</List.Item>
))}
<InfiniteScroll loadMore={loadMore} hasMore={hasMore}>
<InfiniteScrollContent
hasMore={hasMore}
isEmpty={dataList.length === 0}
showNoMore={!dataList.length}
/>
</InfiniteScroll>
</List>
{/* {!dataList?.length && (
<div
className={`flex flex-col items-center justify-center`}
style={{ height: `${scrollHeight}px` }}
@ -288,8 +287,7 @@ export default function Space() {
<Empty type="nodata" />
</div>
)} */}
</div>
)}
</div>
</Swiper.Item>
</Swiper>
<div