|
@@ -12,7 +12,7 @@ import { userInfoApi } from "@/api/login";
|
|
|
import CustomButton from "@/components/CustomButton";
|
|
|
import HeaderBack from "@/components/HeaderBack";
|
|
|
import Tabs from "@/components/Tabs";
|
|
|
-import { HeaderImageMap } from "@/enums";
|
|
|
+import { HeaderImageMap, RankSourceMap } from "@/enums";
|
|
|
import { useRouter } from "@/i18n/routing";
|
|
|
import { cryptoStr } from "@/utils";
|
|
|
import { useRequest } from "ahooks";
|
|
@@ -34,73 +34,74 @@ const Page = () => {
|
|
|
const [noMore, setNoMore] = React.useState<boolean>(false);
|
|
|
const [rankList, setRankList] = React.useState<Rank[]>([]);
|
|
|
const [rankData, setRankData] = React.useState<RankItem[]>([]);
|
|
|
+ const [currentSource, setCurrentSource] = React.useState<any>({
|
|
|
+ source: 1,
|
|
|
+ type: 1,
|
|
|
+ });
|
|
|
+ // source 来源(1现金投注2现金+彩金投注3免费币投注4重玩币投注5现金充值6邀请玩家)
|
|
|
+ // type 榜单类型(0小时榜1日榜单2周榜单3月榜)
|
|
|
|
|
|
const pageInfo = React.useRef({
|
|
|
page: 0,
|
|
|
});
|
|
|
+ const SourceObject = React.useMemo(() => {
|
|
|
+ if (!rankData?.length) return [];
|
|
|
|
|
|
- const Tab1Cfg = [
|
|
|
- {
|
|
|
- id: "1",
|
|
|
- name: (
|
|
|
- <div className="flex items-center justify-center">
|
|
|
- <img
|
|
|
- className="pic needsclick relative z-[-1] w-[46px]"
|
|
|
- src="/rank/jackpot.webp"
|
|
|
- alt=""
|
|
|
- />
|
|
|
- <div className="needsclick relative w-[80px] whitespace-normal break-all text-center text-[12px] font-black leading-[1]">
|
|
|
- Ranking de Apostas
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- ),
|
|
|
- },
|
|
|
- {
|
|
|
- id: "2",
|
|
|
- name: (
|
|
|
- <div className="flex items-center justify-center">
|
|
|
- <img
|
|
|
- className="pic needsclick relative z-[-1] w-[46px]"
|
|
|
- src="/rank/agente.webp"
|
|
|
- alt=""
|
|
|
- />
|
|
|
- <div className="needsclick relative w-[80px] whitespace-normal break-all text-center text-[12px] font-black leading-[1]">
|
|
|
- Ranking de Agentes
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- ),
|
|
|
- },
|
|
|
- ];
|
|
|
- const Tab2Cfg = [
|
|
|
- {
|
|
|
- id: "1",
|
|
|
- name: (
|
|
|
- <div className="flex flex-col items-center justify-center">
|
|
|
- <div className="text-[14px] font-black leading-[1]">DIA</div>
|
|
|
- <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>
|
|
|
+ const source: any = {};
|
|
|
+ rankData?.forEach((item) => {
|
|
|
+ if (!source[item.source]) {
|
|
|
+ source[item.source] = {};
|
|
|
+ }
|
|
|
+ source[item.source][item.type] = item;
|
|
|
+ });
|
|
|
+ return source;
|
|
|
+ }, [rankData]);
|
|
|
+
|
|
|
+ const Tab1Cfg = React.useMemo(() => {
|
|
|
+ if (!SourceObject) return [];
|
|
|
+ const result: any = [];
|
|
|
+ Object.keys(SourceObject).forEach((key) => {
|
|
|
+ const curSource = RankSourceMap.get(Number(key)) || ({} as any);
|
|
|
+ result.push({
|
|
|
+ id: key,
|
|
|
+ name: (
|
|
|
+ <div className="flex items-center justify-center">
|
|
|
+ <img
|
|
|
+ className="pic needsclick relative z-[-1] w-[46px]"
|
|
|
+ src={curSource?.img}
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ <div className="needsclick relative w-[80px] whitespace-normal break-all text-center text-[12px] font-black leading-[1]">
|
|
|
+ {curSource.text}
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- ),
|
|
|
- },
|
|
|
- {
|
|
|
- id: "2",
|
|
|
- name: (
|
|
|
- <div className="flex flex-col items-center justify-center">
|
|
|
- <div className="text-[14px] font-black leading-[1]">SEM</div>
|
|
|
- <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>
|
|
|
+ ),
|
|
|
+ });
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ }, [SourceObject]);
|
|
|
+ const Tab2Cfg = React.useMemo(() => {
|
|
|
+ if (!SourceObject[currentSource.source]) return [];
|
|
|
+ const result: any = [];
|
|
|
+ Object.keys(SourceObject[currentSource.source]).forEach((key) => {
|
|
|
+ const curType = RankSourceMap.get(Number(key)) || ({} as any);
|
|
|
+ result.push({
|
|
|
+ id: key,
|
|
|
+ name: (
|
|
|
+ <div className="flex flex-col items-center justify-center">
|
|
|
+ <div className="text-[14px] font-black leading-[1]">DIA</div>
|
|
|
+ <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>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- ),
|
|
|
- },
|
|
|
- ];
|
|
|
+ ),
|
|
|
+ });
|
|
|
+ });
|
|
|
+ return result;
|
|
|
+ }, [SourceObject, currentSource]);
|
|
|
|
|
|
const getRankData = async () => {
|
|
|
const res = await getRank();
|
|
@@ -153,6 +154,10 @@ const Page = () => {
|
|
|
return <img className="inline-block w-[.18rem]" src={`/rank/f${num}.webp`} alt=""></img>;
|
|
|
};
|
|
|
|
|
|
+ const sourceChange = (actKey: any, key: any) => {
|
|
|
+ setCurrentSource((state: any) => ({ ...state, [key]: actKey }));
|
|
|
+ };
|
|
|
+
|
|
|
return (
|
|
|
<div className={styles.page}>
|
|
|
<HeaderBack
|
|
@@ -168,7 +173,11 @@ const Page = () => {
|
|
|
<div className="h-[100%] p-[.1rem]">
|
|
|
<div className={styles.pageContainer}>
|
|
|
<div className={styles.tabTop}>
|
|
|
- <Tabs items={Tab1Cfg}></Tabs>
|
|
|
+ <Tabs
|
|
|
+ items={Tab1Cfg}
|
|
|
+ activeKey={currentSource.source}
|
|
|
+ onChanage={(val) => sourceChange(val, "source")}
|
|
|
+ ></Tabs>
|
|
|
</div>
|
|
|
<div className={styles.tabType}>
|
|
|
<Tabs items={Tab2Cfg}></Tabs>
|