瀏覽代碼

feat: 修改

year 2 月之前
父節點
當前提交
815d02d73a

+ 3 - 2
messages/br.json

@@ -185,11 +185,12 @@
         "boundsBtn": "Ouro de cor esvaziado",
         "cancel": "cancelar",
         "sure": "A certeza",
-        "clean": "Não ativar o modo de bônus?",
+        "clean": "Esvaziar o bônus ou não? ",
         "switchOpen": "Ativar o modo sem bônus ou não? ",
         "switchClose": "Desligue o modo sem bônus ou não? ",
         "bouns6001": "Condições não satisfeitas",
-        "bouns6002": "No Bouns está aberto, não é possível receber"
+        "bouns6002": "No Bouns está aberto, não é possível receber",
+        "success": "Sucesso"
     },
     "DepositPage": {
         "Montante": "Montante",

+ 1 - 1
src/api/user.ts

@@ -135,7 +135,7 @@ export const getUserInfoApi = () => {
 };
 
 export interface Wallet {
-    is_open_no_bonus?: boolean;
+    is_open_no_bonus?: 0 | 1;
     /**
      * 用户头像
      */

+ 1 - 0
src/components/Footer/index.tsx

@@ -80,6 +80,7 @@ const Footer: FC = () => {
         }));
 
     const setWallet = useWalletStore((state) => state.setWallet);
+
     const { run } = useRequest(getGlobalNoticeApi, {
         pollingInterval: 10000,
         manual: true,

+ 1 - 1
src/components/HeaderBack/index.tsx

@@ -87,7 +87,7 @@ const HeaderBack: FC<PropsWithChildren<HeaderBackProps>> = ({
             <div className={styles.content}>{children}</div>
             {getToken() && (
                 <div>
-                    {!wallet.is_open_no_bonus && (
+                    {wallet.is_open_no_bonus === 1 && (
                         <img src="/img/no_bouns.png" alt="" className="h-[20px]" />
                     )}
                 </div>

+ 13 - 2
src/components/ModalPopup/WalletDescribeModal/index.tsx

@@ -1,4 +1,5 @@
-import { Wallet, cleanBounsApi, toggleUserBounsApi } from "@/api/user";
+import { Wallet, cleanBounsApi, getUserMoneyApi, toggleUserBounsApi } from "@/api/user";
+import { useWalletStore } from "@/stores/useWalletStore";
 import { percentage } from "@/utils/methods";
 import { Dialog, ProgressBar, Switch, Toast } from "antd-mobile";
 import { useTranslations } from "next-intl";
@@ -70,8 +71,11 @@ export const BalanceContent = (props: { wallet: Wallet }) => {
 
 export const BonusContent = (props: { wallet: Wallet; handleAcquire?: any }) => {
     const { wallet, handleAcquire } = props;
-    const [switchValue, setSwitchValue] = React.useState<boolean>(wallet.is_open_no_bonus || false);
+    const [switchValue, setSwitchValue] = React.useState<boolean>(
+        wallet.is_open_no_bonus === 1 || false
+    );
     const [isLoading, setIsLoading] = React.useState<boolean>(false);
+    const { setWallet } = useWalletStore((state) => ({ setWallet: state.setWallet }));
     const t = useTranslations("ProfilePage");
 
     const changeValue = async (value: boolean) => {
@@ -113,6 +117,7 @@ export const BonusContent = (props: { wallet: Wallet; handleAcquire?: any }) =>
         });
         if (!confirmRes) return;
         const res = await cleanBounsApi(1);
+
         if (res?.code && [6001, 6002].includes(res?.data?.code)) {
             const str = t(`bouns${res?.data?.code}`);
             Toast.show({
@@ -120,6 +125,12 @@ export const BonusContent = (props: { wallet: Wallet; handleAcquire?: any }) =>
                 icon: "fail",
             });
         }
+        Toast.show({
+            content: t("success"),
+            icon: "success",
+        });
+        const walletRes = await getUserMoneyApi();
+        setWallet(walletRes?.data);
     };
 
     return (