Browse Source

feat: 修改

year 1 day ago
parent
commit
e13b8cea8b
1 changed files with 14 additions and 9 deletions
  1. 14 9
      src/app/[locale]/(TabBar)/[[...share]]/_home/HomePrize.tsx

+ 14 - 9
src/app/[locale]/(TabBar)/[[...share]]/_home/HomePrize.tsx

@@ -4,6 +4,7 @@ import { Card } from "@/components/Card";
 import NoticeBox from "@/components/NoticeBox";
 import feedback from "@/feedback";
 import { useRouter } from "@/i18n/routing";
+import { useSystemStore } from "@/stores/useSystemStore";
 import { formatAmount } from "@/utils";
 import { Tabs } from "antd-mobile";
 import clsx from "clsx";
@@ -26,6 +27,8 @@ const HomePrize: FC<Props> = (props) => {
     const noticeSwiperRef = React.useRef<any>(null);
     const [act, setAct] = React.useState<number>(0);
     const feedbackDataIndexRef = React.useRef<number>(0);
+    const { isCollapse } = useSystemStore((state) => ({ isCollapse: state.isCollapse }));
+    // const {s}
     const winRef = React.useRef<any>(null);
 
     const renderData = React.useMemo(() => {
@@ -64,7 +67,9 @@ const HomePrize: FC<Props> = (props) => {
 
     React.useEffect(() => {
         if (autoPlay) {
-            doShowWin();
+            setTimeout(() => {
+                doShowWin();
+            }, 10000);
         }
         return () => {
             if (winRef.current) {
@@ -76,15 +81,12 @@ const HomePrize: FC<Props> = (props) => {
     }, [data, autoPlay]);
 
     const doShowWin = async () => {
-        if (winRef.current) {
-            clearTimeout(winRef.current);
-            winRef.current = null;
-        }
-        winRef.current = setTimeout(async () => {
-            if (feedback.hasShowDialog()) {
-                doShowWin();
-                return;
+        if (!(feedback.hasShowDialog() || !isCollapse)) {
+            if (winRef.current) {
+                clearTimeout(winRef.current);
+                winRef.current = null;
             }
+
             let curData = data[feedbackDataIndexRef.current];
             if (feedbackDataIndexRef.current > data.length) {
                 feedbackDataIndexRef.current = 0;
@@ -117,6 +119,9 @@ const HomePrize: FC<Props> = (props) => {
                 router.push("/deposit");
                 return;
             }
+        }
+
+        winRef.current = setTimeout(async () => {
             doShowWin();
         }, 10000);
     };