Browse Source

fix: 免费游戏模块增加

Before 8 months ago
parent
commit
88ba13815a

+ 10 - 1
messages/br.json

@@ -210,6 +210,7 @@
     "Telegram":"Telegram",
     "Twitter":"Twitter",
     "Email":"Email",
+    "Mais": "Mais",
     "content1":"Compartilhe este link de indicação com seus amigos",
     "https":"https://www.BCWIN777.bet/br/m/r/xxxxxx",
     "Cópia":"Cópia",
@@ -224,7 +225,15 @@
     "title4":"Unlimited development of subordinates",
     "content4-1":"Você receberá uma porcentagem de comissão diferente toda vez que um jogador indicado por você fizer uma aposta, ",
     "red":"ganhar ou perder",
-    "content4-2":"O sistema calcula a comissão a cada 3 minutos."
+    "content4-2":"O sistema calcula a comissão a cada 3 minutos.",
+    "modalTitle": "Definição",
+    "modalTips": "Aviso: Os dados de hoje são atualizados a cada 3 minutos",
+    "todayDesc1": "Inscrições - Número de usuários registrados",
+    "todayDesc2": "Novos Jogadores - Novos jogadores pagantes entre os usuários registrados de hoje",
+    "todayDesc3": "Aposta válidas em equiper[num] - Total de valor de apostas válidas provenientes de indicações e contribuições de suas equipes. num - Número total de indicações e membros de suas equipes que contribuíram com apostas válidas.",
+    "totalDesc1" : "Inscrições - Número de usuários registrados totais",
+    "totalDesc2" : "Jogadores totais - Número total de indicações e membros de suas equipes que contribuíram com apostas válidas",
+    "totalDesc3" : "Aposta válidas total - Total do valor de apostas válidas provenientes de indicações e contribuições de suas equipes"
   },
   "ReferralsPage":{
     "Conta":"Conta",

+ 6 - 2
messages/en.json

@@ -210,6 +210,7 @@
     "Telegram":"Telegram",
     "Twitter":"Twitter",
     "Email":"Email",
+    "Mais": "Mais",
     "content1":"Compartilhe este link de indicação com seus amigos",
     "https":"https://www.BCWIN777.bet/br/m/r/xxxxxx",
     "Cópia":"Cópia",
@@ -225,11 +226,14 @@
     "content4-1":"Você receberá uma porcentagem de comissão diferente toda vez que um jogador indicado por você fizer uma aposta, ",
     "red":"ganhar ou perder",
     "content4-2":"O sistema calcula a comissão a cada 3 minutos.",
-    "todayTitle": "Definição",
+    "modalTitle": "Definição",
+    "modalTips": "Aviso: Os dados de hoje são atualizados a cada 3 minutos",
     "todayDesc1": "Inscrições - Número de usuários registrados",
     "todayDesc2": "Novos Jogadores - Novos jogadores pagantes entre os usuários registrados de hoje",
     "todayDesc3": "Aposta válidas em equiper[num] - Total de valor de apostas válidas provenientes de indicações e contribuições de suas equipes. num - Número total de indicações e membros de suas equipes que contribuíram com apostas válidas.",
-    "todayTips": "Aviso: Os dados de hoje são atualizados a cada 3 minutos"
+    "totalDesc1" : "Inscrições - Número de usuários registrados totais",
+    "totalDesc2" : "Jogadores totais - Número total de indicações e membros de suas equipes que contribuíram com apostas válidas",
+    "totalDesc3" : "Aposta válidas total - Total do valor de apostas válidas provenientes de indicações e contribuições de suas equipes"
   },
   "ReferralsPage":{
     "Conta":"Conta",

File diff suppressed because it is too large
+ 0 - 422
messages/es.json


+ 5 - 0
src/api/home.ts

@@ -22,6 +22,11 @@ export interface GroupType {
      * 展示风格 展示风格,1:横排,2:竖排,3:竖排-分类左边-连续,4:竖排-分类左边-拆开
      */
     style_type: number;
+    /**
+     * @description 分组类型
+     *   1 普通游戏(现金+ 彩金) 2:免费币 3:重玩币"
+     */
+    bet_type: 1 | 2 | 3;
 }
 
 /**

+ 20 - 20
src/app/[locale]/(TabBar)/[[...share]]/@actionWidget/Service.tsx

@@ -17,7 +17,7 @@ interface Props {
 }
 const ServiceWidget: FC<Props> = (props) => {
     const token = getToken();
-    const [isShowRedIcon, setIsShowRedIcon] = useState(false);
+    const [packets, setPackets] = useState<any[]>([]);
     const { services, socials } = props;
     const defaultService = services.find((item) => item.is_suspend === 1);
 
@@ -50,9 +50,8 @@ const ServiceWidget: FC<Props> = (props) => {
             let isHasStartAct = actList.filter((aItem: any) => {
                 return aItem.is_start && !aItem.is_receive;
             });
-            let isShowRed = isHasStartAct.length > 0;
-            console.log(`🚀🚀🚀🚀🚀-> in Service.tsx on 54`, isShowRed);
-            setIsShowRedIcon(isShowRed);
+            console.log(`🚀🚀🚀🚀🚀-> in Service.tsx on 53`, isHasStartAct);
+            setPackets(isHasStartAct);
         } catch (error) {
             console.log("redPacketInfo===>error:", error);
         }
@@ -70,22 +69,23 @@ const ServiceWidget: FC<Props> = (props) => {
     return (
         <>
             {/* 红包雨icon */}
-            {isShowRedIcon && (
-                <div
-                    className={
-                        "flex h-[0.54rem] w-[0.54rem] items-center" +
-                        " absolute bottom-[2.04rem] right-[0.12rem] z-50 cursor-pointer justify-center"
-                    }
-                >
-                    <img
-                        className={"h-[0.3889rem] w-[0.3889rem]"}
-                        src="/hby/red-icon.png"
-                        onClick={() => {
-                            RedPacketModalRef.current?.onOpen();
-                        }}
-                    />
-                </div>
-            )}
+            {packets.map((item, index) => {
+                return (
+                    <div
+                        key={index}
+                        className={`absolute right-[0.12rem] z-50 flex h-[0.54rem] w-[0.54rem] cursor-pointer items-center justify-center`}
+                        style={{ bottom: `${2.04 + index * 0.5}rem` }}
+                    >
+                        <img
+                            className={"h-[0.3889rem] w-[0.3889rem]"}
+                            src="/hby/red-icon.png"
+                            onClick={() => {
+                                RedPacketModalRef.current?.onOpen(index);
+                            }}
+                        />
+                    </div>
+                );
+            })}
 
             {/* 红包弹窗 */}
             {/*{isShowRedPacket && (*/}

+ 8 - 0
src/app/[locale]/(TabBar)/[[...share]]/_home/HomeTabs.tsx

@@ -105,9 +105,17 @@ interface Props {
 }
 const Tabs: FC<Props> = (props) => {
     const { tabs } = props;
+
     const tabData = [...tabs, ...buttonGroup];
     const [active, setActive] = useState<number>(0);
+    const router = useRouter();
     const selectHandler = (item: TabItemType, index: number) => {
+        if (item.bet_type === 2) {
+            router.push(
+                `/gameList/?type=${item.bet_type}&&gameListFlag=${item.category[0].jump_id}`
+            );
+            return;
+        }
         setActive(index);
     };
 

+ 1 - 2
src/app/[locale]/(TabBar)/[[...share]]/page.tsx

@@ -9,7 +9,6 @@ const getGames = async () => {
         .request<GroupType[]>({
             url: "/v1/api/front/game_list",
             method: "POST",
-            body: JSON.stringify({ template_key: "g_temp_9" }),
             next: { revalidate: TIME },
         })
         .then((res) => {
@@ -20,7 +19,7 @@ const getGames = async () => {
 
 export default async function Page() {
     const group = await getGames();
-    
+
     return (
         <>
             <HomeTabs tabs={group} />

+ 2 - 2
src/app/[locale]/(TabBar)/gameList/[[...gameListFlag]]/page.tsx

@@ -7,7 +7,7 @@ import { useSetState } from "ahooks";
 import { InfiniteScroll } from "antd-mobile";
 import { FC, useRef } from "react";
 interface Props {
-    searchParams: { gameListFlag: string };
+    searchParams: { gameListFlag: string; type: 1 | 2 | 3 };
 }
 
 const GameListFlag: FC<Props> = (props) => {
@@ -37,7 +37,7 @@ const GameListFlag: FC<Props> = (props) => {
     };
     return (
         <Box>
-            <GroupCard data={target.games} row={1} />
+            <GroupCard data={target.games} row={1} group={{ bet_type: +searchParams.type }} />
             <InfiniteScroll loadMore={loadMore} hasMore={!target.page.is_end!} />
         </Box>
     );

+ 0 - 3
src/app/[locale]/providers.tsx

@@ -3,7 +3,6 @@ import Sidebar from "@/components/Layout/Sidebar";
 import Loading from "@/components/Loading";
 import { useSystemStore } from "@/stores/useSystemStore";
 import { setHtmlFontSize } from "@/utils";
-import { setCookies } from "@/utils/Cookies";
 import { ConfigProvider, Dialog } from "antd-mobile";
 import enUS from "antd-mobile/es/locales/en-US";
 import { useLocale } from "next-intl";
@@ -102,8 +101,6 @@ const Layout = ({ children, themeProps }: ProvidersProps) => {
     useLayoutEffect(() => {
         // 调用响应式方法
         setHtmlFontSize();
-        // 多语言兼容, 因为管理系统的静态数据是pt,但是页面路由需要br,  所以需要一致
-        setCookies("language", local === "br" ? "pt" : local);
     }, []);
 
     return (

+ 25 - 10
src/components/Box/RedPacketModal.tsx

@@ -361,7 +361,7 @@ const HbyInfo2 = (props: any) => {
 type Props = {};
 export type RedPacketModalProps = {
     onClose: () => void;
-    onOpen: () => void;
+    onOpen: (index?: number) => void;
 };
 
 /**
@@ -386,11 +386,16 @@ const RedPacketModal = forwardRef<RedPacketModalProps, Props>(function RedPacket
 
     const [redPacketInfo, setRedPacketInfo] = useState<any>({});
     const [redAmount, setRedAmount] = useState<any>(0);
+    const activeIndex = useRef<number | null>(null);
     const token = getToken();
     useImperativeHandle(ref, () => {
         return {
             onClose: () => setVisible(false),
-            onOpen: () => {
+            onOpen: (index?: number) => {
+                if (index !== null && index !== undefined) {
+                    activeIndex.current = index;
+                }
+
                 getRedPacketInfo().then((res) => {
                     setVisible(true);
                 });
@@ -412,21 +417,31 @@ const RedPacketModal = forwardRef<RedPacketModalProps, Props>(function RedPacket
                 actList = redPacketInfo.data;
             }
             // 是否有已开始但是没领过的红包
-            let isHasStartAct = actList.filter((aItem: any) => {
+            let packets = actList.filter((aItem: any) => {
                 return !!aItem.is_start && !aItem.is_receive;
             });
-            console.log(`🚀🚀🚀🚀🚀-> in RedPacketModal.tsx on 427`, actList);
 
-            let isShowRed = isHasStartAct.length > 0;
-            let isShowRedDetail = isHasStartAct.length === 0;
-            let redInfo = isShowRed ? isHasStartAct[0] : {};
-            let curAct = !!isShowRedDetail ? findCurrentActivity(actList) : actList[0];
-            let iconList = JSON.parse(curAct.icon);
+            let current = null;
+            if (activeIndex.current !== null && activeIndex.current !== undefined) {
+                current = packets[activeIndex.current];
+            } else {
+                current = findCurrentActivity(packets);
+            }
+
+            let isShowRed = packets.length > 0;
+            let isShowRedDetail = packets.length === 0;
+            //
+            // let redInfo = isShowRed ? isHasStartAct[0] : {};
+            // if (activeIndex.current !== undefined && activeIndex.current !== null) {
+            //     redInfo = isHasStartAct[activeIndex.current];
+            // }
+            // let curAct = isShowRedDetail ? findCurrentActivity(actList) : actList[0];
+            let iconList = JSON.parse(current.icon);
 
             setIconLists(iconList);
+            setRedPacketInfo(current);
             setIsShowRed(isShowRed);
             setIsShowRedDetail(isShowRedDetail);
-            setRedPacketInfo(redInfo);
         } catch (error) {
             console.log("redPacketInfo===>error:", error);
         }

+ 6 - 6
src/components/Header/HerderTitle.tsx

@@ -19,12 +19,12 @@ const languages = [
         desc: "Br",
         value: "br",
     },
-    {
-        icon: "/svg/ES.svg",
-        title: "(+34)",
-        desc: "Es",
-        value: "es",
-    },
+    // {
+    //     icon: "/svg/ES.svg",
+    //     title: "(+34)",
+    //     desc: "Es",
+    //     value: "es",
+    // },
     {
         icon: "/svg/UK.svg",
         title: "(+1)",

+ 2 - 2
src/middleware.ts

@@ -15,7 +15,7 @@ function localMiddleware() {
     return async (request: NextRequest, _next: NextFetchEvent) => {
         const handleI18nRouting = createMiddleware({
             locales: locales,
-            defaultLocale: locales.at(2)!,
+            defaultLocale: locales.at(-1)!,
         });
         return handleI18nRouting(request);
     };
@@ -31,5 +31,5 @@ export default stackMiddleware([authMiddleware, localMiddleware]);
 // 创建一个正则表达式对象
 export const config = {
     // todo use this to match the path
-    matcher: ["/", "/(zh|en|es|br)/:path*"],
+    matcher: ["/", "/(en|br)/:path*"],
 };

+ 1 - 4
src/utils/client/axios.ts

@@ -45,10 +45,7 @@ export default class Request {
                     config = requestInterceptor(config);
                     // header请求头添加token
                     config.headers["Token"] = getToken() || "";
-                    config.headers["language"] =
-                        getCookies("language") === "br"
-                            ? "pt"
-                            : getCookies("language") || locales.at(2);
+                    config.headers["language"] = getCookies("language") || locales.at(-1);
                     if (config && config?.toast) {
                         Toast.show({
                             icon: "loading",

+ 1 - 4
src/utils/server/index.ts

@@ -56,10 +56,7 @@ class Server {
                 headers: {
                     Token: cookies().get("Token")?.value || "",
                     "Content-Type": "application/json",
-                    language:
-                        cookies().get("language")?.value === "br"
-                            ? "pt"
-                            : cookies().get("language")?.value || locales.at(2)!,
+                    language: cookies().get("language")?.value || locales.at(-1)!,
                     ...headers,
                 },
                 body: params,

Some files were not shown because too many files changed in this diff