|
@@ -10,6 +10,7 @@ import {
|
|
|
} from "@/api/activity";
|
|
|
import { userInfoApi } from "@/api/login";
|
|
|
import CustomButton from "@/components/CustomButton";
|
|
|
+import CutDown from "@/components/CutDown";
|
|
|
import HeaderBack from "@/components/HeaderBack";
|
|
|
import Tabs from "@/components/Tabs";
|
|
|
import { HeaderImageMap, RankSourceMap } from "@/enums";
|
|
@@ -28,7 +29,7 @@ const Page = () => {
|
|
|
});
|
|
|
const router = useRouter();
|
|
|
const [initLoading, setInitLoading] = React.useState<boolean>(true);
|
|
|
- const [areaId, setAreaId] = React.useState<number>(1);
|
|
|
+ // const [areaId, setAreaId] = React.useState<number>(1);
|
|
|
const [loading, setLoading] = React.useState<boolean>(false);
|
|
|
const [data, setData] = React.useState<RankDetail>({} as RankDetail);
|
|
|
const [noMore, setNoMore] = React.useState<boolean>(false);
|
|
@@ -85,6 +86,8 @@ const Page = () => {
|
|
|
const result: any = [];
|
|
|
Object.keys(SourceObject[currentSource.source]).forEach((key) => {
|
|
|
const curType = RankSourceMap.get(Number(key)) || ({} as any);
|
|
|
+ const curData = SourceObject[currentSource.source][key];
|
|
|
+
|
|
|
result.push({
|
|
|
id: key,
|
|
|
name: (
|
|
@@ -93,7 +96,19 @@ const Page = () => {
|
|
|
<div className="flex flex-row items-center justify-center gap-[5px] text-[12px] text-[var(--primary-button)]">
|
|
|
<i className="iconfont icon-daojishi-hui !text-[13px]"></i>
|
|
|
<div className="countdownTimer needsclick flex flex-row items-center justify-center gap-[1px]">
|
|
|
- <span>01</span>:<span>01</span>:<span>01</span>
|
|
|
+ <CutDown
|
|
|
+ endTime={(curData?.end_time * 1000 - Date.now()) / 1000}
|
|
|
+ itemStyle={{
|
|
|
+ backgroundColor: "transportant",
|
|
|
+ fontSize: "12px",
|
|
|
+ color: "var(--primary-button)",
|
|
|
+ width: "auto",
|
|
|
+ }}
|
|
|
+ splitStyle={{
|
|
|
+ margin: "0 .01rem",
|
|
|
+ color: "var(--primary-button)",
|
|
|
+ }}
|
|
|
+ ></CutDown>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -103,6 +118,16 @@ const Page = () => {
|
|
|
return result;
|
|
|
}, [SourceObject, currentSource]);
|
|
|
|
|
|
+ const areaId = React.useMemo(() => {
|
|
|
+ if (
|
|
|
+ !SourceObject ||
|
|
|
+ !SourceObject[currentSource.source] ||
|
|
|
+ !SourceObject[currentSource.source][currentSource.type]
|
|
|
+ )
|
|
|
+ return 0;
|
|
|
+ return SourceObject[currentSource.source][currentSource.type]?.area_id || 0;
|
|
|
+ }, [currentSource, SourceObject]);
|
|
|
+
|
|
|
const getRankData = async () => {
|
|
|
const res = await getRank();
|
|
|
if (res.code === 200) {
|
|
@@ -118,11 +143,14 @@ const Page = () => {
|
|
|
pageInfo.current.page = 0;
|
|
|
setRankList([]);
|
|
|
setData({} as any);
|
|
|
- // getData(areaId);
|
|
|
+ getData(areaId);
|
|
|
}, [areaId]);
|
|
|
|
|
|
const getData = async (id: number) => {
|
|
|
if (loading) return;
|
|
|
+ if (!id) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
try {
|
|
|
setLoading(true);
|
|
|
if (pageInfo.current?.page === 1) {
|
|
@@ -180,7 +208,11 @@ const Page = () => {
|
|
|
></Tabs>
|
|
|
</div>
|
|
|
<div className={styles.tabType}>
|
|
|
- <Tabs items={Tab2Cfg}></Tabs>
|
|
|
+ <Tabs
|
|
|
+ items={Tab2Cfg}
|
|
|
+ activeKey={currentSource.type}
|
|
|
+ onChanage={(val) => sourceChange(val, "type")}
|
|
|
+ ></Tabs>
|
|
|
</div>
|
|
|
<div className="min-h-[0] flex-1 overflow-auto">
|
|
|
<div
|
|
@@ -331,6 +363,7 @@ const Page = () => {
|
|
|
<InfiniteScroll
|
|
|
hasMore={!noMore}
|
|
|
loadMore={async () => {
|
|
|
+ if (loading || !pageInfo.current.page) return;
|
|
|
pageInfo.current.page++;
|
|
|
await getData(areaId);
|
|
|
}}
|