Quellcode durchsuchen

fix: 删除老虎机防抖事件

Before vor 6 Monaten
Ursprung
Commit
9f42d90f97
1 geänderte Dateien mit 8 neuen und 8 gelöschten Zeilen
  1. 8 8
      src/components/ModalPopup/SlotsModal/index.tsx

+ 8 - 8
src/components/ModalPopup/SlotsModal/index.tsx

@@ -1,6 +1,6 @@
 "use client";
 import { getGiveReceiveApi, SlotParams, SlotType } from "@/api/slots";
-import { debounce, flatPoint } from "@/utils/methods";
+import { flatPoint } from "@/utils/methods";
 import { SlotMachine } from "@lucky-canvas/react";
 import { Mask, Toast } from "antd-mobile";
 import clsx from "clsx";
@@ -195,7 +195,7 @@ const SlotsClient: FC<SlotsClientProps> = (props) => {
         // getSlots();
     }, []);
     // 开始旋转
-    const handler = debounce(() => {
+    const handler = () => {
         // 按下动画
         if (params && !params.activity_id && !params.start_time) return;
         if (rotating.current) return;
@@ -218,27 +218,27 @@ const SlotsClient: FC<SlotsClientProps> = (props) => {
         slotsRef.current?.play();
 
         const Interval = setInterval(() => {
-            const num = Math.floor(Math.random() * 99) + 1
-            setRatio(() => (numberPadding(num, 2)))
-        }, 500)
+            const num = Math.floor(Math.random() * 99) + 1;
+            setRatio(() => numberPadding(num, 2));
+        }, 500);
 
         // 数据获取
         getGiveReceiveApi(params as SlotParams)
             .then((res) => {
                 setTimeout(() => {
-                    Interval && clearInterval(Interval)
+                    Interval && clearInterval(Interval);
                     const rollover = flatPoint(res.data.rollover / 100);
                     slotsRef.current?.stop(numberPadding(res.data.amount));
                     setRatio(numberPadding(rollover > 100 ? 99 : rollover, 2));
                 }, 3000);
             })
             .catch((error) => {
-                Interval && clearInterval(Interval)
+                Interval && clearInterval(Interval);
                 slotsRef.current.init();
                 rotating.current = false;
                 Toast.show(t(`code.${error.data.code}`));
             });
-    }, 300);
+    };
     // 结束旋转
     const endHandler = (prize: any) => {
         // rotating.current = false;