瀏覽代碼

feat: 修改

year 2 周之前
父節點
當前提交
9c7f648bfb

+ 2 - 2
src/app/[locale]/(TabBar)/[[...share]]/_home/HomeSwiper.tsx

@@ -3,7 +3,7 @@ import { FC, memo } from "react";
 
 import { BannerRep } from "@/api/home";
 import Box from "@/components/Box";
-import { Image } from "antd-mobile";
+import CustomImage from "@/components/Image";
 import { Autoplay, Pagination } from "swiper/modules";
 import { Swiper, SwiperSlide } from "swiper/react";
 interface Props {
@@ -30,7 +30,7 @@ const HomeSwiper: FC<Props> = (props) => {
                 {banners.map((banner, index) => (
                     <SwiperSlide key={index}>
                         <Box none action={banner.action_type} actionData={banner.action_params}>
-                            <Image
+                            <CustomImage
                                 width={"100%"}
                                 height={"1.86rem"}
                                 // lazy

+ 1 - 1
src/app/globals.scss

@@ -27,7 +27,7 @@
 
     --tips-color: #dba40b;
     --tips-foreground-color: #1f2830;
-    --adm-color-fill-content: #0b0e10 !important;
+    --adm-color-fill-content: #191f24 !important;
 }
 .home-banner {
     --swiper-pagination-bullet-width: 0.23rem;

+ 12 - 4
src/components/Card/Card.tsx

@@ -1,11 +1,12 @@
 "use client";
 import { Category, GameListRep, GameRequest, toggleFavorite } from "@/api/home";
 import { userInfoApi } from "@/api/login";
+import CustomImage from "@/components/Image";
 import useGame from "@/hooks/useGame";
 import { useRouter } from "@/i18n/routing";
 import { useWalletStore } from "@/stores/useWalletStore";
 import { getToken } from "@/utils/Cookies";
-import { Button, Image, Popup, Toast } from "antd-mobile";
+import { Button, Popup, Toast } from "antd-mobile";
 import clsx from "clsx";
 import { useTranslations } from "next-intl";
 import { FC, PropsWithChildren, ReactNode, useEffect, useRef, useState } from "react";
@@ -172,14 +173,21 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
                     className={clsx(styles.cardWrap, className, "overflow-hidden")}
                     onClick={() => handler(item!)}
                 >
-                    <Image
+                    {/* <Image
                         // lazy={true}
                         src={item?.game_icon}
                         alt={item?.game_name_cn}
                         width={"100%"}
                         height={"100%"}
                         className={"h-[100%] w-[100%]"}
-                    />
+                    /> */}
+                    <CustomImage
+                        src={item?.game_icon}
+                        alt={item?.game_name_cn}
+                        width={"100%"}
+                        height={"100%"}
+                        className={"h-[100%] w-[100%]"}
+                    ></CustomImage>
                     {props.isShowOnline && item?.online_user && (
                         <div className={styles.cardOnline}>{item?.online_user}</div>
                     )}
@@ -218,7 +226,7 @@ const Card: FC<PropsWithChildren<CardProps>> = (props) => {
             >
                 <div className={"w-1/1 flex w-[4.02rem] flex-1 px-spacing-x py-spacing-y"}>
                     <div className={styles.cardWrap} style={{ width: "1.1rem" }}>
-                        <Image
+                        <CustomImage
                             src={item?.game_icon}
                             alt={item?.game_name + "-" + item?.category_name}
                             className={"h-[100%] w-[100%]"}

+ 0 - 0
src/components/Image/index.module.scss


+ 26 - 0
src/components/Image/index.tsx

@@ -0,0 +1,26 @@
+import { Image, ImageProps } from "antd-mobile";
+import React from "react";
+
+const CustomImage = ({ onError, src, ...props }: ImageProps) => {
+    const [isError, setIsError] = React.useState(false);
+
+    const onErrorHandler = (event: React.SyntheticEvent<HTMLImageElement, Event>) => {
+        console.log(9900);
+        if (typeof onError === "function") onError(event);
+        setIsError(true);
+    };
+    if (isError) {
+        return (
+            <div className="flex h-[100%] flex-col items-center justify-center text-center">
+                <i className="iconfont icon-Wheel_chouma text-[.3rem] text-[#3b4750]"></i>
+                <span className="text-[.12rem] leading-[1] text-[#3b4750]">
+                    Falha no carregamento
+                </span>
+            </div>
+        );
+    }
+    // eslint-disable-next-line jsx-a11y/alt-text
+    return <Image {...props} src={src} onError={onErrorHandler}></Image>;
+};
+
+export default CustomImage;

+ 1 - 1
src/components/Layout/Sidebar.tsx

@@ -117,7 +117,7 @@ const Sidebar: FC<PropsWithChildren<Props>> = (props) => {
             getGames().then((res) => {
                 const providersData = res[0].category.filter((item) => item.type === 2);
                 if (providersData.length === 0) return [] as any;
-                setProviders(providersData[0].game_list);
+                if (providersData[0].game_list?.length) setProviders(providersData[0].game_list);
             });
         }
     }, [providers, setProviders]);

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

@@ -44,7 +44,7 @@ const HomeProvider: React.FC<Props> = ({ data }) => {
         if (renderData.length > 5) return 5.5;
         return renderData.length;
     }, [renderData]);
-
+    if (!renderData?.length) return null;
     return (
         <div className={styles.container}>
             <div className="mb-[.1rem] flex items-center">

+ 7 - 3
src/styles/iconfont/iconfont.css

@@ -1,8 +1,8 @@
 @font-face {
   font-family: "iconfont"; /* Project id 4617618 */
-  src: url('iconfont.woff2?t=1751267508246') format('woff2'),
-       url('iconfont.woff?t=1751267508246') format('woff'),
-       url('iconfont.ttf?t=1751267508246') format('truetype');
+  src: url('iconfont.woff2?t=1752201538181') format('woff2'),
+       url('iconfont.woff?t=1752201538181') format('woff'),
+       url('iconfont.ttf?t=1752201538181') format('truetype');
 }
 
 .iconfont {
@@ -13,6 +13,10 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-Wheel_chouma:before {
+  content: "\e6a8";
+}
+
 .icon-tubiaozhizuomoban-:before {
   content: "\e6aa";
 }

二進制
src/styles/iconfont/iconfont.ttf


二進制
src/styles/iconfont/iconfont.woff


二進制
src/styles/iconfont/iconfont.woff2