Quellcode durchsuchen

feat: 修改BUG

year vor 2 Monaten
Ursprung
Commit
15fbda9048
1 geänderte Dateien mit 10 neuen und 3 gelöschten Zeilen
  1. 10 3
      src/app/[locale]/(TabBar)/deposit/page.tsx

+ 10 - 3
src/app/[locale]/(TabBar)/deposit/page.tsx

@@ -8,9 +8,7 @@ import Left from "./Left";
 
 const Deposit = () => {
     const searchParams = useSearchParams();
-    const [actIdx, setActIdx] = React.useState(
-        searchParams.get("target_id") ? Number(searchParams) : 0
-    );
+    const [actIdx, setActIdx] = React.useState(0);
     const [shopTypeList, setShopTypeList] = React.useState<any[]>([]);
     const [currentChannel, setCurrentChannel] = React.useState<any>({});
     const [shopInfo, setShopInfo] = React.useState<ShopInfo | null>(null);
@@ -37,6 +35,15 @@ const Deposit = () => {
         const res = await getShopListApi();
         if (res?.code === 200 && res?.data) {
             setShopTypeList(res?.data || []);
+
+            if (searchParams.get("target_id")) {
+                const act = res.data.findIndex(
+                    (item: any) => item.id == searchParams.get("target_id")
+                );
+                setActIdx(act);
+                doChangeChannel(res?.data[act]?.pay_channel[0]);
+                return;
+            }
             if (res?.data[actIdx]?.pay_channel[0]) {
                 doChangeChannel(res?.data[actIdx]?.pay_channel[0]);
             }