浏览代码

Merge branch 'dev' of http://192.168.0.111:3000/bcwin/site_front into dev

XianCH 6 月之前
父节点
当前提交
b37ceec9ad

+ 1 - 1
messages/en.json

@@ -27,7 +27,7 @@
     "desc2": "1. Este produto é para uso de usuários maiores de 18 anos e é destinado apenas para fins de entretenimento. ",
     "desc3":  "2. este jogo contém compras no app.",
     "desc4": "3. O fato de um jogador jogar ou ganhar em um jogo de apostas sociais não significa que ele ganhará em apostas com dinheiro real e jogos relacionados no futuro.",
-    "prize": "Grandes Vitórias Recentes",
+    "prize": "The latest big win",
 
     "gameTag":"Games",
     "cancel": "Cancelar",

二进制
public/slots/0.png


二进制
public/slots/1.png


二进制
public/slots/2.png


二进制
public/slots/3.png


二进制
public/slots/4.png


二进制
public/slots/5.png


二进制
public/slots/6.png


二进制
public/slots/7.png


二进制
public/slots/8.png


二进制
public/slots/9.png


二进制
public/slots/aura.png


二进制
public/slots/button.png


二进制
public/slots/light-1.png


二进制
public/slots/light-2.png


二进制
public/slots/ratio/0.png


二进制
public/slots/ratio/1.png


二进制
public/slots/ratio/2.png


二进制
public/slots/ratio/3.png


二进制
public/slots/ratio/4.png


二进制
public/slots/ratio/5.png


二进制
public/slots/ratio/6.png


二进制
public/slots/ratio/7.png


二进制
public/slots/ratio/8.png


二进制
public/slots/ratio/9.png


二进制
public/slots/ratio/X.png


二进制
public/slots/slots-bg.png


二进制
public/slots/will-bg.png


二进制
public/slots/will-light1.png


二进制
public/slots/will-light2.png


二进制
public/slots/will-light3.png


+ 75 - 44
src/app/[locale]/(TabBar)/sports/SportsClient.tsx

@@ -16,31 +16,43 @@ const SportsClient: FC<Props> = (props) => {
     const { brand_id, token } = props;
     const [currentToken, setCurrentToken] = useState(token);
 
-
     const btRef = useRef(null);
     const router = useRouter();
 
+    const isFreshRef = useRef(false);
+    const hasCleanedUp = useRef(false);
 
     useEffect(() => {
+      console.log("onLoad=====>0000");
       // @ts-ignore
       if (window.BTRenderer) {
+        console.log("onLoad=====>1111");
         onLoad();
       }
       
       // 离开体育页的时候需要kill掉
       return () => {
+        console.log("onLoad=====>killkillkillkillkill",btRef.current);
+        if(btRef.current && !hasCleanedUp.current){
           // @ts-ignore
           btRef.current?.kill();
+          btRef.current = null;
+          hasCleanedUp.current = true;
+        }
       };
     }, []);
 
     useEffect(() => {
+      console.log("onLoad=====>22222");
       // 如果token更新了才调用update
       if( currentToken !== token){
+        console.log("onLoad=====>333333");
         updateToken(token);
       }
     }, [token]);
 
+
+
     const getGameDetailApi = async () => {
         const data = await server
             .request<GameInfo>({
@@ -60,59 +72,78 @@ const SportsClient: FC<Props> = (props) => {
     };
 
     const updateToken = (newToken: string) => {
+      console.log("onLoad=====>44444-0000000");
       // @ts-ignore
         if(currentToken!== newToken){
+          console.log("onLoad=====>44444");
           setCurrentToken(newToken);
-        }
-        // @ts-ignore
-        if (window.BTRenderer) {
-          onLoad();
+          // session失效需要重新load
+          // @ts-ignore
+          if (window.BTRenderer && !!isFreshRef.current) {
+            console.log("onLoad=====>1111isFreshRef");
+            onLoad();
+          }else{
+            // 多次点击当前页面只需要跳转到首页即可
+            // 使用 updateOptions 更新当前的 BTRenderer 参数,而不是重新初始化
+            if (btRef.current) {
+              console.log("onLoad=====>55555");
+              // 更新 token 和其他配置
+              // @ts-ignore
+              btRef.current.updateOptions({
+                token: newToken, // 更新 token
+                url: '/', // 更新 URL 或其他参数
+                betSlipOffsetBottom: 80,
+                betSlipZIndex: 1000,
+                stickyTop: 0,
+                betSlipOffsetTop: 50,
+              });
+            }
+          }
+          
         }
     }
 
     const onLoad = () => {
-        // @ts-ignore
-        const bt = new BTRenderer();
-        btRef.current = bt;
-        // bt.updateOptions({url:'/'})
-        bt.initialize({
-            brand_id: brand_id,
-            token: token,//使用最新的token
-            onTokenExpired: getGameDetailApi, //过期自动更新token
-            onSessionRefresh: () => {
-              
-              // 销毁之前的实例并等待刷新完成
-              if(btRef.current){
-                // @ts-ignore
-                btRef.current?.kill();
-              }
-              
-              router.refresh()
-            },
-            themeName: "default",
-            lang: "pt-br",
-            target: document.getElementById("betby"),
-            betSlipOffsetBottom: 80,
-            // betSlipOffsetRight: 750,
+      // @ts-ignore
+      const bt = new BTRenderer();
+      btRef.current = bt;
+      console.log("onLoad=====>666666",token);
+      bt.initialize({
+          brand_id: brand_id,
+          token: token,//使用最新的token
+          onTokenExpired: getGameDetailApi, //过期自动更新token
+          onSessionRefresh: () => {
+            console.log('onLoad=====>onSessionRefresh')
+            // 销毁之前的实例并等待刷新完成
+            if(btRef.current){
+              console.log('onLoad=====>onSessionRefresh1111')
+              // @ts-ignore
+              btRef.current?.kill();
+            }
+            isFreshRef.current = true;
+            console.log('onLoad=====>onSessionRefresh11112222')
+            router.refresh()
+          },
+          themeName: "default",
+          lang: "pt-br",
+          target: document.getElementById("betby"),
+          betSlipOffsetBottom: 80,
+          // betSlipOffsetRight: 750,
 
-            betSlipZIndex: 1000,
-            stickyTop: 0,
-            betSlipOffsetTop: 50,
-            onRecharge: function () {
-                router.push("/deposit");
-            },
-            onRouteChange: function () {
-            },
-            onLogin: function () {},
-            onRegister: function () {},
-            onBetSlipStateChange: function () {},
-        });
+          betSlipZIndex: 1000,
+          stickyTop: 0,
+          betSlipOffsetTop: 50,
+          onRecharge: function () {
+              router.push("/deposit");
+          },
+          onRouteChange: function () {
+          },
+          onLogin: function () {},
+          onRegister: function () {},
+          onBetSlipStateChange: function () {},
+      });
     };
 
-    
-    
-
-
     return (
         <>    
           <div id="betby" className={"h-[100%]"}></div>

+ 1 - 1
src/app/[locale]/affiliate/summary/page.tsx

@@ -39,7 +39,7 @@ const RulesClient = () => {
             dataIndex: "bet",
             align: "center",
             render: (item: any) => (
-                <div className={"text-[0.12rem] text-[#98a7b5]"}>{item?.bet} Dez mil+</div>
+                <div className={"text-[0.12rem] text-[#98a7b5]"}>{item?.bet/ 10000} Dez mil+</div>
             ),
         },
         {

+ 77 - 6
src/components/ModalPopup/SlotsModal/index.tsx

@@ -2,9 +2,11 @@
 import { getGiveReceiveApi, SlotParams, SlotType } from "@/api/slots";
 import { flatPoint } from "@/utils/methods";
 import { SlotMachine } from "@lucky-canvas/react";
-import { Mask, Toast } from "antd-mobile";
+import { Mask, Toast, Button } from "antd-mobile";
 import clsx from "clsx";
 import { useTranslations } from "next-intl";
+import { useRouter } from "@/i18n/routing";
+import TipsModal, { ModalProps } from "@/components/TipsModal";
 import { FC, forwardRef, memo, useEffect, useImperativeHandle, useRef, useState } from "react";
 import animation from "../animations.module.scss";
 
@@ -167,10 +169,11 @@ const ColorWill = () => {
 interface SlotsClientProps {
     slotSource: SlotType;
     onRotateAfter?: () => void;
+    showTipsModal?: (data: any) => void;
 }
 
 const SlotsClient: FC<SlotsClientProps> = (props) => {
-    const { slotSource, onRotateAfter } = props;
+    const { slotSource, onRotateAfter, showTipsModal } = props;
     const slotsRef = useRef<any>(null);
     const t = useTranslations();
 
@@ -220,16 +223,35 @@ const SlotsClient: FC<SlotsClientProps> = (props) => {
         const Interval = setInterval(() => {
             const num = Math.floor(Math.random() * 99) + 1;
             setRatio(() => numberPadding(num, 2));
-        }, 500);
+        }, 200);
+
+        // setTimeout(() => {
+        //     slotsRef.current?.stop(numberPadding(5733));
+        //     setTimeout(() => {
+        //         Interval && clearInterval(Interval);
+        //         setRatio(numberPadding(73, 2));
+        //     }, 1600);
+            
+        //     setTimeout(() => {
+        //         showTipsModal && showTipsModal({amount: 5666, rollover: 38})
+        //     }, 3000);
+        // }, 3000);
 
         // 数据获取
         getGiveReceiveApi(params as SlotParams)
             .then((res) => {
                 setTimeout(() => {
-                    Interval && clearInterval(Interval);
                     const rollover = flatPoint(res.data.rollover / 100);
                     slotsRef.current?.stop(numberPadding(res.data.amount));
-                    setRatio(numberPadding(rollover > 100 ? 99 : rollover, 2));
+
+                    setTimeout(() => {
+                        Interval && clearInterval(Interval);
+                        setRatio(numberPadding(rollover > 100 ? 99 : rollover, 2));
+                    }, 1600);
+
+                    setTimeout(() => {
+                        showTipsModal && showTipsModal({amount: res.data.amount, rollover: rollover > 100 ? 99 : rollover})
+                    }, 3000);
                 }, 3000);
             })
             .catch((error) => {
@@ -293,6 +315,20 @@ const SlotsClient: FC<SlotsClientProps> = (props) => {
                             </div>
                             <div className={"z-10 flex h-[100%] items-center"}>
                                 <img src="/slots/ratio/x.png" alt="" className={"h-[0.4167rem]"} />
+
+                                {/* <div className={"w-[0.4rem] h-[0.4514rem]"} style={{position: 'relative'}}>
+                                    <img src="/slots/ratio/0.png" alt="" className={"h-[0.4514rem]"} style={{position: 'absolute', left: 0, top: 0,  opacity: ratio[0] == 0 ? 1: 0}} />
+                                    <img src="/slots/ratio/1.png" alt="" className={"h-[0.4514rem]"} style={{position: 'absolute', left: 0, top: 0, opacity: ratio[0] == 1 ? 1: 0}} />
+                                    <img src="/slots/ratio/2.png" alt="" className={"h-[0.4514rem]"} style={{position: 'absolute', left: 0, top: 0, opacity: ratio[0] == 2 ? 1: 0}} />
+                                    <img src="/slots/ratio/3.png" alt="" className={"h-[0.4514rem]"} style={{position: 'absolute', left: 0, top: 0, opacity: ratio[0] == 3 ? 1: 0}} />
+                                    <img src="/slots/ratio/4.png" alt="" className={"h-[0.4514rem]"} style={{position: 'absolute', left: 0, top: 0, opacity: ratio[0] == 4 ? 1: 0}} />
+                                    <img src="/slots/ratio/5.png" alt="" className={"h-[0.4514rem]"} style={{position: 'absolute', left: 0, top: 0, opacity: ratio[0] == 5 ? 1: 0}} />
+                                    <img src="/slots/ratio/6.png" alt="" className={"h-[0.4514rem]"} style={{position: 'absolute', left: 0, top: 0, opacity: ratio[0] == 6 ? 1: 0}} />
+                                    <img src="/slots/ratio/7.png" alt="" className={"h-[0.4514rem]"} style={{position: 'absolute', left: 0, top: 0, opacity: ratio[0] == 7 ? 1: 0}} />
+                                    <img src="/slots/ratio/8.png" alt="" className={"h-[0.4514rem]"} style={{position: 'absolute', left: 0, top: 0, opacity: ratio[0] == 8 ? 1: 0}} />
+                                    <img src="/slots/ratio/9.png" alt="" className={"h-[0.4514rem]"} style={{position: 'absolute', left: 0, top: 0, opacity: ratio[0] == 9 ? 1: 0}} />
+                                </div> */}
+
                                 {ratio.map((n, index) => (
                                     <img
                                         key={index}
@@ -381,6 +417,20 @@ const SlotsModal = forwardRef<SlotModalRefProps, Props>(function SlotsModal(prop
         onAfterHandler();
     };
 
+    // 提示框
+    const tipsRef = useRef<ModalProps>(null);
+    const [obterFree, setObterFree] = useState<any>({amount: 0, rollover: 0});
+    const showTipsModal = (data: any) => {
+        setObterFree({...data})
+        setVisible(false)
+        tipsRef.current?.onOpen();
+    }
+    const router = useRouter();
+    const goGame = () => {
+        tipsRef.current?.onClose();
+        router.push(`/freeGames`);
+    };
+
     return (
         <>
             <Mask visible={visible} destroyOnClose={true} getContainer={null}>
@@ -407,9 +457,30 @@ const SlotsModal = forwardRef<SlotModalRefProps, Props>(function SlotsModal(prop
                             <img src="/slots/will-light3.png" alt="" className={light4} />
                         </div>
                     </div>
-                    {slotSource && <SlotsClient onRotateAfter={handler} slotSource={slotSource} />}
+                    {slotSource && <SlotsClient onRotateAfter={handler} slotSource={slotSource} showTipsModal={showTipsModal}/>}
                 </div>
             </Mask>
+            <TipsModal ref={tipsRef} title={'Obter Free'}>
+                <p className={"text-left text-[0.12rem] font-medium text-[#666]"}>
+                    Ganhe moedas grátis:{obterFree.amount}
+                </p>
+                <p className={"text-left text-[0.12rem] font-medium text-[#666] mt-[.06rem]"}>
+                    Requisito de rolagem:{obterFree.rollover}X
+                </p>
+                <div className={"mt-[0.08rem] flex justify-center"}>
+                    <Button
+                        color={"primary"}
+                        className={"mx-auto"}
+                        style={{
+                            "--background-color": "var(--primary-color)",
+                            "--border-color": "var(--primary-color)",
+                        }}
+                        onClick={goGame}
+                    >
+                        Iniciar o jogo
+                    </Button>
+                </div>
+            </TipsModal>
         </>
     );
 });