xiaolin.fu před 1 rokem
rodič
revize
4cfe4dc35f

+ 1 - 0
.env.development

@@ -0,0 +1 @@
+NEXT_PUBLIC_BASE_URL=http://206.168.191.125:8800

+ 4 - 0
.env.production

@@ -0,0 +1,4 @@
+
+NEXT_PUBLIC_BASE_URL=http://206.168.191.125:8800
+
+

+ 2 - 1
messages/br.json

@@ -39,7 +39,8 @@
   "Header": {
     "login": "Login",
     "register": "Cadastre-se",
-    "locale": "Preferência de Localização"
+    "locale": "Preferência de Localização",
+    "deposit": "Depósito"
   },
   "Game": {
     "demo":"Demo",

+ 2 - 0
next.config.mjs

@@ -7,7 +7,9 @@ const withNextIntl = createNextIntlPlugin();
 const nextConfig = {
   output: 'standalone',
   reactStrictMode: true,
+  output:"standalone",
   transpilePackages: ['antd-mobile'],
+
   sassOptions: {
     prependData: `@import "./src/styles/variables.scss";`
   },

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 2969 - 108
pnpm-lock.yaml


binární
public/logo.png


+ 7 - 0
src/api/home.ts

@@ -168,3 +168,10 @@ export const getGameDetailApi = (data: GameRequest) => {
         data,
     });
 };
+
+export const getBannerApi = (data: any) => {
+    return server.post<any>({
+        url: "/v1/api/front/banner_list",
+        data,
+    });
+};

+ 1 - 1
src/app/[locale]/(ordinary)/gameList/[gameListFlag]/page.tsx

@@ -8,7 +8,7 @@ const GameListFlag: FC<Props> = (props) => {
     return (
         <div
             className={
-                "w-1/1 flex h-[200px] items-center justify-center border-1" +
+                "w-1/1 flex h-[100vh] items-center justify-center border-1" +
                 " border-[#4d4d4d]" +
                 " text-[0.12rem] text-[#4d4d4d]"
             }

+ 1 - 1
src/app/[locale]/(ordinary)/profile/component/ItemCom/index.tsx

@@ -16,7 +16,7 @@ export interface ItemComProps {
 
 const ItemCom: FC<PropsWithChildren<ItemComProps>> = ({type = 'login', callbackFun}) => {
 
-    let amountList = [10,20,50,100,200,500,1000,5000,10000,500,1000,5000,10000,5000,10000,500,1000,5000,10000]
+    let amountList: any[] = []
 
     return (
         <ul className="itemCom-box">

+ 7 - 3
src/app/[locale]/(ordinary)/profile/component/ModalCom/index.tsx

@@ -1,5 +1,5 @@
 "use client";
-import { FC, PropsWithChildren, } from "react";
+import { FC, MouseEventHandler, PropsWithChildren, } from "react";
 import {Modal, ModalContent, ModalBody, ModalFooter, useDisclosure} from "@nextui-org/react";
 import "./style.scss";
 import { useGlobalStore } from '@/stores';
@@ -37,10 +37,14 @@ const ModalCom: FC<PropsWithChildren<ItemComProps>> = () => {
 
     return (
         <>
-             {
+            {/* {
                 token ? <span className="logOut" onClick={onOpen}>{t('Sair')}</span> : (
                     <span className="logOut" onClick={() => goPage('/login')}>{t('Login')}</span>
                 )
+            } */}
+
+            {
+                <span className="logOut" onClick={onOpen}>{t('Sair')}</span>
             }
             <Modal 
                 backdrop="opaque" 
@@ -55,7 +59,7 @@ const ModalCom: FC<PropsWithChildren<ItemComProps>> = () => {
                 }}
             >
                 <ModalContent>
-                {(onClose) => (
+                {(onClose: MouseEventHandler<HTMLSpanElement> | undefined) => (
                     <>
                     <ModalBody>
                         <p className="modal-p-box">{t('Deseja')}</p>

+ 15 - 0
src/app/[locale]/(ordinary)/profile/component/ModalCom/style.scss

@@ -1,3 +1,18 @@
+.logOut {
+  color: #fff;
+  font-size: .12rem;
+  width: 1rem;
+  height: .34rem;
+  line-height: .34rem;
+  display: block;
+  margin: .1rem auto .3rem;
+  text-align: center;
+  cursor: pointer;
+  margin: 0 auto;
+  position: relative;
+  top: calc(100vh - 3.3rem);
+}
+
 .body1-box {
   .modal-p-box {
     width: 2.5rem;

+ 7 - 13
src/app/[locale]/(ordinary)/profile/page.scss

@@ -13,7 +13,7 @@
       background: -webkit-linear-gradient(top, #ffaa30, #ffe6be);
       background: -o-linear-gradient(top, #ffaa30 0, #ffe6be 100%);
       background: linear-gradient(180deg, #ffaa30, #ffe6be);
-      min-height: .93rem;
+      height: auto;
     }
 
     .userInfo {
@@ -28,6 +28,12 @@
       padding: .11rem .18rem;
       -webkit-box-sizing: border-box;
       box-sizing: border-box;
+      margin-bottom: .23rem;
+
+      &.active {
+        margin-bottom: 0;
+      }
+
       & > div {
         display: flex;
         -webkit-box-pack: justify;
@@ -170,16 +176,4 @@
       }
     }
 
-    .logOut {
-      color: #fff;
-      font-size: .12rem;
-      width: 1rem;
-      height: .34rem;
-      line-height: .34rem;
-      display: block;
-      margin: .1rem auto .3rem;
-      text-align: center;
-      cursor: pointer;
-    }
-
 }

+ 21 - 13
src/app/[locale]/(ordinary)/profile/page.tsx

@@ -30,8 +30,8 @@ const Profile: FC<Props> = () => {
         getUserMoneyApi().then((res) => {
             res.code == 200 &&
                 setMoney({
-                    deposit: res.data.deposit,
-                    point: res.data.point,
+                    deposit: res.data?.deposit || 0.0,
+                    point: res.data?.point || 0.0
                 });
         });
     };
@@ -41,7 +41,7 @@ const Profile: FC<Props> = () => {
             userMoneyRequest();
         }
         // eslint-disable-next-line react-hooks/exhaustive-deps
-    }, []);
+    }, [token]);
 
     const router = useRouter();
     const goPage = (path = "/") => {
@@ -54,10 +54,12 @@ const Profile: FC<Props> = () => {
     };
 
     const divClassName = clsx("bgImg", token && "default");
+    const divClassName2 = clsx("userContent", token && "active");
+    const divClassName3 = clsx("userInfo", token && "active");
     return (
         <div className="profile-box">
-            <div className="userContent">
-                <div className="userInfo">
+            <div className={divClassName2}>
+                <div className={divClassName3}>
                     <div>
                         <div className={divClassName}></div>
                         {token && (
@@ -67,12 +69,19 @@ const Profile: FC<Props> = () => {
                             </div>
                         )}
                     </div>
-                    {!token && (
-                        <div className="goto" onClick={() => goPage("/login")}>
-                            <span>{t("Login")}</span>
-                            <span className="iconfont icon-xiangzuo1"></span>
-                        </div>
-                    )}
+                    {
+                        token ?
+                        (
+                            <div className="goto" onClick={() => goPage(`/confirmPassword?userPhone=${userInfo.user_phone}&code=123456&alter=true`)}>
+                                <span className="iconfont icon-xiangzuo1"></span>
+                            </div>
+                        ) : (
+                            <div className="goto" onClick={() => goPage("/login")}>
+                                <span>{t("Login")}</span>
+                                <span className="iconfont icon-xiangzuo1"></span>
+                            </div>
+                        )
+                    }
                 </div>
                 {token && (
                     <div className="coin">
@@ -90,7 +99,6 @@ const Profile: FC<Props> = () => {
                             <span className="iconfont icon-gift2"></span>
                             <div>
                                 <span onClick={() => setVisible(true)}>
-                                    {" "}
                                     {t("Bônus")} <img className="a" src="/img/a.png" alt="" />
                                 </span>
                                 <div className="num">
@@ -105,7 +113,7 @@ const Profile: FC<Props> = () => {
 
             <div className="link">
                 <span onClick={() => goPage("/deposit")}>{t("Depósito")}</span>
-                <span onClick={() => goPage(token ? "/withdraw" : `/login?redirect=withdraw`)}>
+                <span onClick={() => goPage(token ? "/withdraw" : `/login?redirect=/withdraw`)}>
                     {t("Sacar")}
                 </span>
             </div>

+ 1 - 0
src/app/[locale]/_home/HomeGames.tsx

@@ -90,6 +90,7 @@ const HomeSwiper: FC<PropsWithChildren<Props>> = (props) => {
                             key={index}
                             group={group}
                             col={3}
+                            visibleTodos={false}
                             todoHandler={todoHandler}
                         ></SwiperGroup>
                     );

+ 7 - 1
src/app/[locale]/_home/HomeSwiper.tsx

@@ -1,6 +1,7 @@
 "use client";
-import { FC, PropsWithChildren } from "react";
+import { FC, PropsWithChildren, useEffect } from "react";
 
+import { getBannerApi } from "@/api/home";
 import { Autoplay, Pagination } from "swiper/modules";
 import { Swiper, SwiperSlide } from "swiper/react";
 interface Props {}
@@ -15,6 +16,11 @@ const urls = [
     "https://images.hibigwin.com/9f/202406/veFfaahiTGAyDpy.jpg",
 ];
 const HomeSwiper: FC<PropsWithChildren<Props>> = (props) => {
+    useEffect(() => {
+        getBannerApi({}).then((res) => {
+            console.log(res);
+        });
+    }, []);
     return (
         <div style={{ height: "1.86rem" }}>
             <Swiper

+ 2 - 0
src/app/[locale]/confirmPassword/page.scss

@@ -12,6 +12,8 @@
     box-sizing: border-box;
     .title {
       font-size: .18rem;
+      text-align: center;
+      margin-bottom: .4rem;
       h2 {
         color: #fcde26;
         line-height: .22rem;

+ 25 - 5
src/app/[locale]/confirmPassword/page.tsx

@@ -6,8 +6,10 @@ import HeaderBack from "@/components/HeaderBack";
 import { useRouter } from "@/i18n";
 import { Toast } from "antd-mobile";
 import { useSearchParams } from "next/navigation";
-import { FC, useMemo, useState } from "react";
+import { FC, useEffect, useMemo, useState } from "react";
+import { getSendCodeApi } from "@/api/user";
 import "./page.scss";
+import { useGlobalStore } from "@/stores";
 
 interface Props {}
 
@@ -23,6 +25,21 @@ const ResetPhone: FC<Props> = () => {
         againPwd: "",
     });
 
+    let alter = searchParams.get("alter");
+    const sendCodeRequest = () => {
+        if (!user_phone) return;
+        getSendCodeApi({ user_phone }).then((res) => {
+            if (res.code == 200) {
+                return;
+            }
+            setMsgError(res.msg);
+        });
+    };
+    useEffect(() => {
+        alter && sendCodeRequest()
+        // eslint-disable-next-line react-hooks/exhaustive-deps
+    },[alter])
+
     const setInputVal = (e: { target: { name: any; value: any } }) => {
         const { name, value } = e.target;
         setFromParam({
@@ -45,6 +62,7 @@ const ResetPhone: FC<Props> = () => {
         return false;
     }, [fromParam]);
 
+    const { setToken, setUserInfo } = useGlobalStore();
     let [msgError, setMsgError] = useState("");
     const findPwdRequest = () => {
         let { pwd, againPwd } = fromParam;
@@ -56,6 +74,8 @@ const ResetPhone: FC<Props> = () => {
             setMsgError(res.msg || "");
             if (res.code == 200) {
                 Toast.show({ icon: "success", content: "修改成功", maskClickable: false });
+                setUserInfo('')
+                setToken('')
                 setTimeout(() => {
                     router.replace("/login");
                 }, 1000);
@@ -68,8 +88,8 @@ const ResetPhone: FC<Props> = () => {
             <HeaderBack />
             <div className="main">
                 <div className="title">
-                    <h2>Ativa a sua conta por entrar a Senha de Verificação!</h2>
-                    <div>A senha de verificação foi enviado para o teu telemóvel 16982013895</div>
+                    <h2>Mudar a Contrasinha</h2>
+                    {/* <div>修改密码 {user_phone}</div> */}
                 </div>
                 <div className="phoneInput">
                     <input
@@ -78,7 +98,7 @@ const ResetPhone: FC<Props> = () => {
                         value={fromParam.pwd}
                         onChange={setInputVal}
                         onInput={verifyPwd}
-                        placeholder="Senha"
+                        placeholder="Por favor, introduz uma nova senha"
                         maxLength={12}
                     />
                 </div>
@@ -88,7 +108,7 @@ const ResetPhone: FC<Props> = () => {
                         type="password"
                         value={fromParam.againPwd}
                         onChange={setInputVal}
-                        placeholder="Senha"
+                        placeholder="Por favor, introduz a nova senha novamente"
                         maxLength={12}
                     />
                 </div>

+ 0 - 2
src/app/[locale]/page.tsx

@@ -8,8 +8,6 @@ import HomeCard from "./_home/HomeCard";
 import HomeSearch from "./_home/HomeSearch";
 import HomeSwiper from "./_home/HomeSwiper";
 
-// Information
-// ts-ignore
 const App: FC = (props) => {
     const t = useTranslations("global");
 

+ 19 - 14
src/components/Card/Card.tsx

@@ -3,6 +3,7 @@ import { GameListRep, getGameDetailApi } from "@/api/home";
 import { useRouter } from "@/i18n";
 import { useGlobalStore } from "@/stores";
 import { Button, Modal, ModalBody, ModalContent, useDisclosure } from "@nextui-org/react";
+import { Toast } from "antd-mobile";
 import { useTranslations } from "next-intl";
 import { FC, PropsWithChildren, ReactNode, useRef } from "react";
 import styles from "./style.module.scss";
@@ -21,20 +22,24 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
     const router = useRouter();
 
     const handler = (game: GameListRep) => {
+        const { token } = state;
         onOpen();
+        if (!token) {
+            router.push("/login?redirect=/withdraw");
+            return;
+        }
         const params = {
             id: game.id,
         };
         getGameDetailApi(params).then((res) => {
-            urlRef.current = res.data.game_url;
+            urlRef.current = res.data?.game_url;
         });
     };
     const playGameHandler = () => {
-        const { token } = state;
-        if (token) {
+        if (urlRef.current) {
             window.open(urlRef.current);
         } else {
-            router.push("/login");
+            Toast.show("数据错误");
         }
     };
     return (
@@ -72,16 +77,16 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
                                         <p className={"h-[0.6rem]"}>{item?.game_name_cn}</p>
 
                                         <div className={"flex w-[2.2rem] justify-around"}>
-                                            <Button
-                                                onClick={playGameHandler}
-                                                className={
-                                                    "h-[0.39rem] w-[0.89rem] rounded-[0.05rem] text-[0.15rem]" +
-                                                    " bg-[#3a3a3a]" +
-                                                    " font-bold"
-                                                }
-                                            >
-                                                {t("demo")}
-                                            </Button>
+                                            {/*<Button*/}
+                                            {/*    onClick={playGameHandler}*/}
+                                            {/*    className={*/}
+                                            {/*        "h-[0.39rem] w-[0.89rem] rounded-[0.05rem] text-[0.15rem]" +*/}
+                                            {/*        " bg-[#3a3a3a]" +*/}
+                                            {/*        " font-bold"*/}
+                                            {/*    }*/}
+                                            {/*>*/}
+                                            {/*    {t("demo")}*/}
+                                            {/*</Button>*/}
                                             <Button
                                                 onClick={playGameHandler}
                                                 className={`h-[0.39rem] w-[0.89rem] rounded-[0.05rem] bg-[#009d80] text-[0.15rem] font-bold`}

+ 1 - 0
src/components/Card/SwiperGroup.tsx

@@ -49,6 +49,7 @@ const HomeSwiper: FC<PropsWithChildren<SwiperGroupProps>> = (props) => {
         },
         "mb-[0.11rem]"
     );
+    if (!group.game_list) return;
     const swiperData = Array(Math.ceil(group.game_list!.length / page))
         .fill(0)
         .map((_, index) => {

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

@@ -3,6 +3,7 @@ import { usePathname, useRouter } from "@/i18n";
 import clsx from "clsx";
 import { FC, PropsWithChildren, ReactNode } from "react";
 import "./style.scss";
+import { useGlobalStore } from "@/stores";
 
 /**
  * @description 底部Tab组件
@@ -14,6 +15,8 @@ export interface FooterProps {
 }
 
 const Footer: FC<PropsWithChildren> = () => {
+    const { token } = useGlobalStore();
+
     const tabList = [
         {
             iconSpanName: "icon-home",
@@ -46,6 +49,10 @@ const Footer: FC<PropsWithChildren> = () => {
 
     const router = useRouter();
     const goPage = (path = "/") => {
+        if(!token && (path == '/deposit' || path == "/profile")) {
+            router.replace(`/login?redirect=${path}`)
+            return
+        }
         router.push(path);
     };
 

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
src/components/Header/HerderTitle.tsx


+ 19 - 9
src/components/Header/index.tsx

@@ -21,6 +21,7 @@ const DefaultHeader: FC<HeaderProps> = (props) => {
     const { menuHandler } = props;
     const t = useTranslations("Header");
     const state = useGlobalStore();
+
     return (
         <div className={styles.headerMain}>
             <div className={styles.headerLeft} onClick={menuHandler}>
@@ -30,17 +31,26 @@ const DefaultHeader: FC<HeaderProps> = (props) => {
             <div className={styles.headerRight}>
                 <div className={styles.right}>
                     {state.userInfo ? (
-                        <div className={"flex items-center text-[0.12rem]"}>
-                            <i className={"iconfont icon-yonghu mr-[0.03rem]"}></i>
-                            <span>0.00</span>
-                        </div>
+                        <>
+                            <Link href={"/profile"}>
+                                <div className={"flex items-center text-[0.12rem]"}>
+                                    <i className={"iconfont icon-yonghu mr-[0.03rem]"}></i>
+                                    <span>0.00</span>
+                                </div>
+                            </Link>
+
+                            <Link href={"/deposit"} className={styles.rightActive}>
+                                {t("deposit")}
+                            </Link>
+                        </>
                     ) : (
-                        <Link href={"/login"}>{t("login")}</Link>
+                        <>
+                            <Link href={"/login?redirect=/"}>{t("login")}</Link>
+                            <Link href={"/login?redirect=/"} className={styles.rightActive}>
+                                {t("register")}
+                            </Link>
+                        </>
                     )}
-
-                    <Link href={"/login"} className={styles.rightActive}>
-                        {t("register")}
-                    </Link>
                 </div>
             </div>
         </div>

+ 1 - 1
src/components/Header/style.module.scss

@@ -44,7 +44,7 @@
       color: #fff;
       align-items: center;
       img{
-        height: .18rem;
+        height: 0.1389rem;
       }
       .title{
         font-size: .24rem;

+ 9 - 8
src/components/Layout/index.tsx

@@ -17,7 +17,7 @@ const Layout: FC<PropsWithChildren<Props>> = (props) => {
     const [mounted, setMounted] = useState(false);
 
     useEffect(() => {
-      setMounted(true)
+        setMounted(true);
     }, []);
 
     const startHandler = () => {
@@ -51,14 +51,15 @@ const Layout: FC<PropsWithChildren<Props>> = (props) => {
                 swiperRef.current = swiper;
             }}
             allowTouchMove={false}
-        > 
-            <SwiperSlide style={{ width: `${!mounted ? '0' : '70%'}`,overflow:'hidden' }} className={"mx-w-[2.2222rem] bg-[rgb(31,31,31)]"}>
-              <section className="relative h-[100vh]">
-                  <Sidebar></Sidebar>
-              </section>
+        >
+            <SwiperSlide
+                style={{ width: `${!mounted ? "0" : "70%"}`, overflow: "hidden" }}
+                className={"mx-w-[2.2222rem] bg-[rgb(31,31,31)]"}
+            >
+                <section className="relative h-[100vh]">
+                    <Sidebar></Sidebar>
+                </section>
             </SwiperSlide>
-            
-           
 
             <SwiperSlide style={{ width: "100%" }}>
                 <div className="relative h-[100vh]" ref={homeContainerRef}>

+ 0 - 1
src/i18n.ts

@@ -3,7 +3,6 @@ import { getRequestConfig } from "next-intl/server";
 import { notFound } from "next/navigation";
 
 const modulesFiles = require.context("../messages", true, /\.json$/);
-console.log(`🎯🎯🎯🎯🎯-> in i18n.ts on 6`);
 export const locales = modulesFiles.keys().map((modulePath: string) => {
     return modulePath.replace(/^\.\/(.*)\.\w+$/, "$1");
 });

+ 1 - 2
src/utils/server/axios.ts

@@ -102,8 +102,7 @@ export default class Request {
                     if (transform && transform.responseInterceptor) {
                         res = transform.responseInterceptor(res);
                     }
-                    let data =  res.data || {};
-                    resolve(data);
+                    resolve(res?.data);
                 })
                 .catch((error) => {
                     reject(error);

+ 14 - 3
src/utils/server/index.ts

@@ -1,9 +1,10 @@
+"use client";
 import Request from "./axios";
+
+const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL;
 const server = new Request({
     timeout: 10 * 1000,
-    // baseURL: "http://127.0.0.1:4523/m1/4790544-4444647-default",
-    // baseURL: "http://192.168.0.66:6060",
-    baseURL: "http://206.168.191.125:8800",
+    baseURL: BASE_URL,
     transform: {
         // instance  interceptor
         requestInterceptor: (config) => {
@@ -16,6 +17,16 @@ const server = new Request({
             return config;
         },
         responseInterceptorCatch: (err) => {
+            const { response } = err;
+            if (response && !response.data) return;
+            // @ts-ignore
+            const { code } = response!.data;
+            switch (code) {
+                case 401:
+                    window && (location.href = "/br/login");
+                    break;
+            }
+
             return err;
         },
     },

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů