Browse Source

fix: 更改轮盘ui,修改分量链接,短信内容

Before 7 months ago
parent
commit
52ac7076b7

+ 0 - 1
messages/br.json

@@ -405,7 +405,6 @@
     "newPwd": "Please enter a new password",
     "checkPwd": "Please enter the new password again",
     "checkPwdReg": "The password is inconsistent twice",
-    "": "You cannot set the original password",
     "passwordMinReg": "The password cannot be less than 6 digits and more than 20 digits",
     "birthday": "Birthday",
     "birthdayReg": "The birthday cannot be empty",

+ 1 - 2
src/app/[locale]/(TabBar)/[[...share]]/@actionWidget/Service.tsx

@@ -48,8 +48,7 @@ const ServiceWidget: FC<Props> = (props) => {
         // 数据存储,侧边栏使用
         setSocials(socials);
         getWheel().then((res) => {
-            console.log(`🚀🚀🚀🚀🚀-> in Service.tsx on 49`, res);
-            if (res === undefined) {
+            if (res === undefined || Array.isArray(res)) {
                 setVisibleWheel(3);
                 return res;
             }

+ 1 - 0
src/app/[locale]/(TabBar)/[[...share]]/@popupWidget/ActivityMask.tsx

@@ -25,6 +25,7 @@ const ActivityMask = () => {
             <div className={"absolute top-[18%] z-50 w-[100%]"} onClick={() => setVisible(false)}>
                 <div className={"relative flex h-[4.4653rem] w-[100%] justify-center"}>
                     <img
+                        alt={""}
                         src={"/doings/activity.png"}
                         className={"h-[100%]" + " object-contain" + " absolute"}
                     />

+ 62 - 23
src/app/[locale]/(TabBar)/[[...share]]/_home/HomePromotion.tsx

@@ -2,9 +2,10 @@
 import { PromotionRep } from "@/api/home";
 import Box from "@/components/Box";
 import { Mask } from "antd-mobile";
-import { FC, useEffect, useState } from "react";
+import { FC, MouseEvent, useEffect, useState } from "react";
 
 import dayjs from "dayjs";
+import Image from "next/image";
 import { Pagination } from "swiper/modules";
 import { Swiper, SwiperSlide } from "swiper/react";
 
@@ -37,7 +38,8 @@ const HomePromotion: FC<Props> = (props) => {
         setVisible(flag);
     }, []);
 
-    const closeHandler = () => {
+    const closeHandler = (e: MouseEvent<HTMLElement>) => {
+        e.stopPropagation();
         setVisible(false);
         if (type === 1) {
             sessionStorage.setItem("isClosePromotion", dayjs().format("YYYY-MM-DD"));
@@ -51,28 +53,38 @@ const HomePromotion: FC<Props> = (props) => {
     if (data && data.length === 0) return null;
     return (
         <div>
-            <Mask visible={visible} onMaskClick={closeHandler}>
+            <Mask visible={visible} onMaskClick={(e) => closeHandler(e)}>
                 <div
                     className={
                         "promotion-swiper absolute left-1/2 top-[18%] max-w-[3.139rem]" +
                         " -translate-x-1/2"
                     }
                 >
-                    <div></div>
-                    <div
-                        onClick={closeHandler}
-                        style={{
-                            background:
-                                "linear-gradient(45deg, deeppink, deeppink 50%, transparent 50%, transparent 100%)",
-                        }}
-                        className={
-                            "absolute right-[0px] top-[0] h-[80px] w-[80px] bg-[linear-gradient(45deg_deeppink_deeppink_50%_transparent_50%_transparent_100%)]" +
-                            " z-20" +
-                            " border-4"
-                        }
-                    >
-                        <i className={"iconfont icon-guanbi"}></i>
-                    </div>
+                    {/*<div*/}
+                    {/*    style={{*/}
+                    {/*        clipPath: "polygon(26% 0, 100% 69%, 100% 0)",*/}
+                    {/*        background: "rgba(0,0,0,0.5)",*/}
+                    {/*    }}*/}
+                    {/*    className={*/}
+                    {/*        "absolute right-[0.1111rem] top-[0.0694rem] z-[10] h-[0.5556rem] w-[0.5556rem]" +*/}
+                    {/*        " rounded-tr-[0.1389rem]"*/}
+                    {/*    }*/}
+                    {/*>*/}
+                    {/*    <i className={"iconfont icon-guanbi absolute right-[20%] top-[5%]"}></i>*/}
+                    {/*    /!*<i className={"iconfont icon-guanbi"}></i>*!/*/}
+                    {/*    /!*<div*!/*/}
+                    {/*    /!*    onClick={closeHandler}*!/*/}
+                    {/*    /!*    className={*!/*/}
+                    {/*    /!*        "z-20 h-0 w-0 [border-width:0_1.3889rem_1.3889rem_0]" +*!/*/}
+                    {/*    /!*        " [border-color:transparent_#007bff_transparent_transparent]" +*!/*/}
+                    {/*    /!*        " [border-color: red] flex"*!/*/}
+                    {/*    /!*    }*!/*/}
+                    {/*    /!*>*!/*/}
+                    {/*    /!*    <i className={"iconfont icon-guanbi ml-[0.3472rem] mt-[0.0694rem]"}></i>*!/*/}
+                    {/*    /!*</div>*!/*/}
+                    {/*</div>*/}
+
+                    {/*<i className={"iconfont icon-guanbi"}></i>*/}
                     <Swiper
                         loop
                         pagination={{ clickable: true }}
@@ -90,11 +102,38 @@ const HomePromotion: FC<Props> = (props) => {
                                     action={promotion.action_type}
                                     actionData={promotion.action_params}
                                 >
-                                    <img
-                                        className={"h-[3.4722rem] w-[100%] rounded-[0.1389rem]"}
-                                        src={promotion.content.image}
-                                        alt={promotion.content.title}
-                                    />
+                                    <div
+                                        onClick={(e) => closeHandler(e)}
+                                        className={
+                                            "relative h-[3.4722rem] w-[100%] rounded-[0.1389rem]"
+                                        }
+                                    >
+                                        <div
+                                            style={{
+                                                clipPath: "polygon(26% 0, 100% 69%, 100% 0)",
+                                                background: "rgba(0,0,0,0.5)",
+                                            }}
+                                            className={
+                                                "absolute -top-[0.2px] right-0 z-[10]" +
+                                                " h-[0.5556rem] w-[0.5556rem]" +
+                                                " rounded-tr-[0.1389rem]"
+                                            }
+                                        >
+                                            <i
+                                                className={
+                                                    "iconfont icon-guanbi absolute right-[16%]" +
+                                                    " top-[5%] text-[0.1111rem]"
+                                                }
+                                            ></i>
+                                        </div>
+                                        <Image
+                                            width={400}
+                                            height={400}
+                                            className={"h-[100%] w-[100%] rounded-[0.1389rem]"}
+                                            src={promotion.content.image!}
+                                            alt={promotion.content.title!}
+                                        />
+                                    </div>
                                 </Box>
                             </SwiperSlide>
                         ))}

+ 17 - 21
src/app/[locale]/(enter)/components/Form/index.tsx

@@ -131,6 +131,7 @@ const FormComponent: FC<Props> = (props) => {
     const { setUserInfo } = useUserInfoStore();
     const t = useTranslations();
     const searchParams = useSearchParams();
+    const [statusText, setStatusText] = useState("");
 
     /// 密码可见
     const [visible, setVisible] = useState(false);
@@ -178,8 +179,9 @@ const FormComponent: FC<Props> = (props) => {
     const loginHandler = async (values: FormProps) => {
         return new Promise(async (resolve, reject) => {
             const loginResult = await loginApi(values).catch((error) => {
+                let text = error ? t(`code.${error.data.code}`) : t(`code.${500}`);
                 Toast.show({
-                    content: t(`code.${error.data.code}`),
+                    content: text,
                 });
             });
             if (loginResult?.code === 200) {
@@ -217,10 +219,12 @@ const FormComponent: FC<Props> = (props) => {
             registerApi(newValues)
                 .then(async (res) => {
                     if (res.code === 200) {
-                        loginHandler(values).then(() => {
-                            router.replace("/recharge");
-                            Toast.clear();
-                        });
+                        loginHandler({ pwd: values.pwd, user_phone: values.user_phone }).then(
+                            () => {
+                                router.replace("/recharge");
+                                Toast.clear();
+                            }
+                        );
                     }
                 })
                 .catch((error) => {
@@ -238,19 +242,6 @@ const FormComponent: FC<Props> = (props) => {
                 Toast.clear();
                 router.replace(`/${searchParams.get("redirect")}` || "/");
             });
-            // const loginResult = await loginApi(values).catch((error) => {
-            //     Toast.show({
-            //         content: t(`code.${error.data.code}`),
-            //     });
-            // });
-            // if (loginResult?.code === 200) {
-            //     setCookies("Token", loginResult.data.token as string);
-            //     const result = await userInfoApi();
-            //     if (result.code === 200) {
-            //         setUserInfo(result.data);
-            //
-            //     }
-            // }
         }
     };
 
@@ -404,12 +395,17 @@ const FormComponent: FC<Props> = (props) => {
                             ></Checkbox>
                             <div className={"ml-[10px] select-none break-all text-[12px]"}>
                                 {t("form.agreement")}
-                                <Link href={"/preventLaunderMoney"}>
+                                <Link href={"/preventLaunderMoney"} className={"text-[#1677ff]"}>
                                     {t("form.moneyAgreement")}
                                 </Link>
-                                、<Link href={"/terms"}>{t("form.serverAgreement")}</Link>
+                                、
+                                <Link href={"/terms"} className={"text-[#1677ff]"}>
+                                    {t("form.serverAgreement")}
+                                </Link>
                                 {t("form.agreementAnd")}
-                                <Link href={"/gamingPolicy"}>{t("form.childrenAgreement")}</Link>
+                                <Link href={"/gamingPolicy"} className={"text-[#1677ff]"}>
+                                    {t("form.childrenAgreement")}
+                                </Link>
                             </div>
                         </div>
                     </>

+ 8 - 4
src/app/[locale]/(wheel)/cashWheel/CashWheelClient.tsx

@@ -3,7 +3,6 @@
 import { getWheelApi, getWheelReceiveApi, WheelsType } from "@/api/cashWheel";
 import Box from "@/components/Box";
 import { WheelClient } from "@/components/Box/WheelModal";
-import { Link } from "@/i18n/routing";
 import { useUserInfoStore } from "@/stores/useUserInfoStore";
 import { server } from "@/utils/client";
 import { copyText, timeFormat } from "@/utils/methods";
@@ -396,6 +395,11 @@ const ShareClient = () => {
         setCurrentPhoneIndex((value) => (value += 1));
     };
 
+    const smsHandler = () => {
+        const phoneNumber = `sms:${wheel.phones?.join(",")}?body=${currentWheel?.note + url}`;
+        window.location.href = phoneNumber;
+    };
+
     return (
         <>
             <div className={"p-[0.1389rem]"}>
@@ -521,8 +525,8 @@ const ShareClient = () => {
                                         height={40}
                                     />
                                 </div>
-                                <Link
-                                    href={`sms:${wheel.phones?.join(",")}?body=${currentWheel?.note}`}
+                                <div
+                                    onClick={smsHandler}
                                     className={
                                         "flex items-center rounded-[10px] bg-[#35b2fe]" +
                                         " p-[0.0694rem] text-[#fff]"
@@ -538,7 +542,7 @@ const ShareClient = () => {
                                         width={40}
                                         height={40}
                                     />
-                                </Link>
+                                </div>
                             </div>
                         </div>
                     </div>

+ 7 - 7
src/components/Box/WheelModal.tsx

@@ -197,7 +197,6 @@ export const WheelClient: FC<WheelProps> = (props) => {
             });
     };
     const endRotate = (prize: any) => {
-        rotating.current = false;
         activeRef.current!.style.display = "block";
 
         if (currentWin.current.amount > 0) {
@@ -208,7 +207,10 @@ export const WheelClient: FC<WheelProps> = (props) => {
 
         setTimeout(() => {
             onRotateEnd && onRotateEnd();
-            activeRef.current!.style.display = "none";
+            rotating.current = false;
+            if (activeRef.current) {
+                activeRef.current.style.display = "none";
+            }
         }, 2000);
     };
 
@@ -437,12 +439,10 @@ const WheelModal = forwardRef<WheelModalProps, Props>(function RedPacketModal(pr
     // }, []);
 
     const onRotateEnd = () => {
-        setTimeout(() => {
-            setVisible(false);
-            setDetailsVisible(true);
+        setVisible(false);
+        setDetailsVisible(true);
 
-            getWheel();
-        }, 1000);
+        getWheel();
     };
 
     const onUnload = () => {

+ 20 - 2
src/components/Box/index.tsx

@@ -1,4 +1,5 @@
 "use client";
+import { getWheelApi } from "@/api/cashWheel";
 import { ActionType } from "@/api/home";
 import { lredPacketApi, redPacketApi } from "@/api/promo";
 import RedPacketModal, { RedPacketModalProps } from "@/components/Box/RedPacketModal";
@@ -56,7 +57,6 @@ const isStartPacketsHandler = async () => {
         let redPacketInfo = await redPacketApi();
         packets = redPacketInfo.data || [];
     }
-    console.log(`🚀🚀🚀🚀🚀-> in index.tsx on 59`, packets);
     return packets;
 };
 
@@ -90,6 +90,24 @@ const Box: FC<PropsWithChildren<Props>> = (props) => {
         }
     };
 
+    /**
+     * 路由拦截
+     */
+    const routeBeforeHandler = (url: string) => {
+        if (url === "/cashWheel") {
+            getWheelApi().then((res) => {
+                const data = res.data;
+                if (!Array.isArray(data) && !!data.activities) {
+                    router.push(actionData as string);
+                } else {
+                    Toast.show("The event is not open");
+                }
+            });
+        } else {
+            router.push(actionData as string);
+        }
+    };
+
     const {
         className,
         children,
@@ -122,7 +140,7 @@ const Box: FC<PropsWithChildren<Props>> = (props) => {
                 openWindow(actionData as string);
                 break;
             case 3:
-                router.push(actionData as string);
+                routeBeforeHandler(actionData as string);
                 break;
             case 4:
                 popupHandler(actionData as keyof typeof ModalEnum);

+ 3 - 7
src/utils/client/axios.ts

@@ -49,7 +49,6 @@ export default class Request {
                     if (config && config?.toast) {
                         Toast.show({
                             icon: "loading",
-                            duration: 0,
                             maskClickable: false,
                         });
                     }
@@ -68,7 +67,7 @@ export default class Request {
          */
         axiosInstance.interceptors.response.use(
             (res) => {
-                Toast.clear();
+                // Toast.clear();
                 if (responseInterceptor) {
                     res = responseInterceptor(res);
                 }
@@ -78,7 +77,7 @@ export default class Request {
                 if (responseInterceptorCatch) {
                     responseInterceptorCatch(error);
                 }
-                Toast.clear();
+                // Toast.clear();
             }
         );
     }
@@ -90,7 +89,7 @@ export default class Request {
         return new Promise((resolve, reject) => {
             this.axiosInstance
                 .request<unknown, AxiosResponse<Response<T> & R>>(config)
-                .then((res) => {
+                .then(async (res) => {
                     const { transform } = config;
                     if (transform && transform.responseInterceptor) {
                         res = transform.responseInterceptor(res);
@@ -98,9 +97,6 @@ export default class Request {
                     if (res && res.data && res.data.code === 200) {
                         resolve(res.data);
                     } else {
-                        // if (res && res.data && res.data.msg) {
-                        //     Toast.show(res.data.msg || "请求失败");
-                        // }
                         reject(res);
                     }
                 })