Przeglądaj źródła

根据eslint调整代码

zhangzf 2 dni temu
rodzic
commit
07a17baac8

+ 8 - 8
src/app/(public)/product/[...urlProduct]/page.tsx

@@ -1,7 +1,7 @@
 import { notFound } from "next/navigation";
 import { Suspense } from "react";
 import {
-  ProductDetailSkeleton,
+  // ProductDetailSkeleton,
   RelatedProductSkeleton,
 } from "@/components/common/skeleton/ProductSkeleton";
 import { BASE_SCHEMA_URL, PRODUCT_TYPE } from "@/utils/constants";
@@ -13,13 +13,13 @@ import type {
   ProductMediaType,
 } from "@components/catalog/type";
 import { RelatedProductsSection } from "@components/catalog/product/RelatedProductsSection";
-import { HeroCarouselShimmer } from "@components/common/slider";
-import { ProductMedia } from "@/app/(public)/product/_components/ProductMedia";
-import { ProductInformation } from "@/app/(public)/product/_components/ProductInformation";
-import { ProductDetail } from "@/app/(public)/product/_components/ProductDetail";
-import ProductDescription from "../_components/ProductDescription";
-import SwitchButton from "../_components/SwitchButton";
-import ShopServicePanel from "../_components/ShopServicePanel";
+// import { HeroCarouselShimmer } from "@components/common/slider";
+// import { ProductMedia } from "@/app/(public)/product/_components/ProductMedia";
+// import { ProductInformation } from "@/app/(public)/product/_components/ProductInformation";
+// import { ProductDetail } from "@/app/(public)/product/_components/ProductDetail";
+// import ProductDescription from "../_components/ProductDescription";
+// import SwitchButton from "../_components/SwitchButton";
+// import ShopServicePanel from "../_components/ShopServicePanel";
 import Recommend from "../_components/youmaylike/Recommend"
 import { formatFlexibleVariants } from "@/utils/variantTools";
 import ProductTwoColumnLayout from "../_components/ProductTwoColumnLayout";

+ 58 - 58
src/app/(public)/product/_components/ProductAddToCart.tsx

@@ -5,65 +5,65 @@ import { useState, useEffect, useCallback } from "react";
 import PriceModal from "./popup/PriceModal";
 
 // 价格组件复用你项目自带的Price
-import { Price } from "@components/theme/ui/Price";
+// import { Price } from "@components/theme/ui/Price";
 
 // SVG图标:左侧对话图标、右侧下拉箭头
-const ChatSvg = () => (
-  <svg
-    xmlns="http://www.w3.org/2000/svg"
-    width="24"
-    height="24"
-    viewBox="0 0 24 24"
-    fill="none"
-  >
-    <path
-      d="M22 12C22 17.5229 17.5229 22 12 22C9.01325 22 2 22 2 22C2 22 2 14.5361 2 12C2 6.47715 6.47717 2 12 2C17.5229 2 22 6.47715 22 12Z"
-      stroke="rgba(0, 0, 0, 1)"
-      stroke-width="1.5"
-      stroke-linejoin="round"
-      stroke-linecap="round"
-    ></path>
-    <path
-      stroke="rgba(0, 0, 0, 1)"
-      stroke-width="1.5"
-      stroke-linejoin="round"
-      stroke-linecap="round"
-      d="M7 9L16 9"
-    ></path>
-    <path
-      stroke="rgba(0, 0, 0, 1)"
-      stroke-width="1.5"
-      stroke-linejoin="round"
-      stroke-linecap="round"
-      d="M7 13L16 13"
-    ></path>
-    <path
-      stroke="rgba(0, 0, 0, 1)"
-      stroke-width="1.5"
-      stroke-linejoin="round"
-      stroke-linecap="round"
-      d="M7 17L12 17"
-    ></path>
-  </svg>
-);
+// const ChatSvg = () => (
+//   <svg
+//     xmlns="http://www.w3.org/2000/svg"
+//     width="24"
+//     height="24"
+//     viewBox="0 0 24 24"
+//     fill="none"
+//   >
+//     <path
+//       d="M22 12C22 17.5229 17.5229 22 12 22C9.01325 22 2 22 2 22C2 22 2 14.5361 2 12C2 6.47715 6.47717 2 12 2C17.5229 2 22 6.47715 22 12Z"
+//       stroke="rgba(0, 0, 0, 1)"
+//       stroke-width="1.5"
+//       stroke-linejoin="round"
+//       stroke-linecap="round"
+//     ></path>
+//     <path
+//       stroke="rgba(0, 0, 0, 1)"
+//       stroke-width="1.5"
+//       stroke-linejoin="round"
+//       stroke-linecap="round"
+//       d="M7 9L16 9"
+//     ></path>
+//     <path
+//       stroke="rgba(0, 0, 0, 1)"
+//       stroke-width="1.5"
+//       stroke-linejoin="round"
+//       stroke-linecap="round"
+//       d="M7 13L16 13"
+//     ></path>
+//     <path
+//       stroke="rgba(0, 0, 0, 1)"
+//       stroke-width="1.5"
+//       stroke-linejoin="round"
+//       stroke-linecap="round"
+//       d="M7 17L12 17"
+//     ></path>
+//   </svg>
+// );
 
-const ArrowDownSvg = () => (
-  <svg
-    xmlns="http://www.w3.org/2000/svg"
-    width="24"
-    height="24"
-    viewBox="0 0 24 24"
-    fill="none"
-  >
-    <path
-      stroke="rgba(0, 0, 0, 1)"
-      stroke-width="1.5"
-      stroke-linejoin="round"
-      stroke-linecap="square"
-      d="M18 9L12 15L6 9"
-    ></path>
-  </svg>
-);
+// const ArrowDownSvg = () => (
+//   <svg
+//     xmlns="http://www.w3.org/2000/svg"
+//     width="24"
+//     height="24"
+//     viewBox="0 0 24 24"
+//     fill="none"
+//   >
+//     <path
+//       stroke="rgba(0, 0, 0, 1)"
+//       stroke-width="1.5"
+//       stroke-linejoin="round"
+//       stroke-linecap="square"
+//       d="M18 9L12 15L6 9"
+//     ></path>
+//   </svg>
+// );
 
 // 价格数据类型定义,从父组件传入
 type VariantPriceInfo = {
@@ -103,9 +103,9 @@ export function ProductAddToCart({
   }, [handleScroll]);
 
   // 解构价格数据
-  const { totalNowPrice, totalLinePrice, save } = priceInfo;
+  // const { totalNowPrice, totalLinePrice, save } = priceInfo;
   // 是否有折扣(原价≠现价)
-  const hasDiscount = totalLinePrice !== totalNowPrice;
+  // const hasDiscount = totalLinePrice !== totalNowPrice;
 
   return (
     <div

+ 1 - 1
src/app/(public)/product/_components/ProductReviewSection.tsx

@@ -38,7 +38,7 @@ function ProductReviewSection({
   // modalOpen,
   closeModal,
   activeTab,
-  onOpenBaseModal,
+  // onOpenBaseModal,
   onChangeTab,
   galleryOpen, 
   galleryData, 

+ 7 - 7
src/app/(public)/product/_components/SwitchButton.tsx

@@ -2,7 +2,7 @@
 import { useState, useMemo, useEffect, useCallback } from "react";
 import ProductReviewSection from "@/app/(public)/product/_components/ProductReviewSection";
 import Image from "next/image";
-import ReviewAdd from "@/app/(public)/product/_components/review/ReviewAdd";
+// import ReviewAdd from "@/app/(public)/product/_components/review/ReviewAdd";
 import FaqList, { type FaqItem } from "./question/FaqList";
 import HairPhotoGallery from "./review/HairPhotoGallery";
 import { clientFetch } from "@/lib/restApiClient";
@@ -10,7 +10,7 @@ import { getUuId } from "@/utils/helper";
 import { ReviewButton } from "@components/common/button/ReviewButton";
 import AddProductReviewForm from "../_components/review/AddProductReviewForm";
 import type {
-  ProductReviewList,
+  // ProductReviewList,
   ProductReviewNode,
   GalleryItem,
 } from "@/types/products/review";
@@ -55,7 +55,7 @@ const mockFaqData: FaqItem[] = [
 export default function SwitchButton({
   productId,
   questionList,
-  questionTotal,
+  // questionTotal,
 }: ReviewQuestionTabProps) {
   // const [uuid, setUuidId] = useState<string>('');
   // 自己通过接口拿到,不再由父组件传入
@@ -116,10 +116,10 @@ export default function SwitchButton({
     console.log("【根】reviewModalOpen变更:", reviewModalOpen);
   }, [reviewModalOpen]);
 
-  const openPhotoTabModal = useCallback(() => {
-    setActiveModalTab("photos"); // 打开弹窗默认图片tab
-    setReviewModalOpen(true);
-  }, []);
+  // const openPhotoTabModal = useCallback(() => {
+  //   setActiveModalTab("photos"); // 打开弹窗默认图片tab
+  //   setReviewModalOpen(true);
+  // }, []);
   const openAllReviewModal = useCallback((e?: React.MouseEvent) => {
     e?.stopPropagation();
     console.log("【根】调用打开弹窗");

+ 5 - 5
src/app/(public)/product/_components/review/ReviewAdd.tsx

@@ -8,13 +8,13 @@ import { useState } from "react";
 import QuestionInputModal from "./QuestionInputModal";
 
 export default function ReviewAdd({ productId }: { productId: string }) {
-  const [open, setOpen] = useState(false);
+  const [, setOpen] = useState(false);
   const [qusopen, setQueopen] = useState(false);
   // const handleCloseForm = () => setOpen(false);
-  const setShowForm = () => {
-    setOpen(() => true);
-    setQueopen(() => false);
-  };
+  // const setShowForm = () => {
+  //   setOpen(() => true);
+  //   setQueopen(() => false);
+  // };
   return (
     <>
       <div className="flex items-center justify-start gap-3">

+ 1 - 1
src/app/(public)/product/_components/review/ReviewDetail.tsx

@@ -43,7 +43,7 @@ const ReviewDetail: FC<ReviewDetailProps> = ({
   onClose,
   activeTab,
   onChangeTab,
-  onOpenBaseModal,
+  // onOpenBaseModal,
 }) => {
  
   const [visibleCount, setVisibleCount] = useState(5);

+ 3 - 3
src/app/(public)/product/_components/review/ReviewModal.tsx

@@ -2,7 +2,7 @@
 import React, { useState, useRef, useEffect, useCallback } from "react";
 import type {
   ReviewTabType,
-  ProductReviewList,
+  // ProductReviewList,
   ProductReviewNode,
   GalleryItem,
 } from "@/types/products/review";
@@ -72,7 +72,7 @@ const ReviewModal: React.FC<ReviewModalProps> = React.memo(
   function ReviewModal({
     // open,
     reviewTotal,
-    onClose,
+    // onClose,
     productId,
     onChangeTab,
     activeTab,
@@ -201,7 +201,7 @@ const ReviewModal: React.FC<ReviewModalProps> = React.memo(
       const renderPageNumbers = () => {
         const pages: number[] = [];
         let start = Math.max(1, page - 2);
-        let end = Math.min(totalPage, start + 4);
+        const end = Math.min(totalPage, start + 4);
         // 修正,保证最多5个
         if(end - start <4) start = Math.max(1, end -4);
         for(let i=start; i<=end; i++) pages.push(i);

+ 5 - 5
src/app/(public)/product/_components/youmaylike/Recommend.tsx

@@ -1,7 +1,7 @@
 "use client";
 
 import { Swiper, SwiperSlide } from "swiper/react";
-import { Navigation, Pagination } from "swiper/modules";
+import { Navigation } from "swiper/modules";
 import { OpenAddToCartModalButton } from "@/components/common/AddToCartModal/OpenAddToCartModalButton";
 // 导入Swiper基础样式
 import "swiper/css";
@@ -123,10 +123,10 @@ const productData = [
 ];
 
 // 拆分数据为2个块(每块6个)
-const productBlocks = [
-  productData.slice(0, 6), // 第一块
-  productData.slice(6, 12), // 第二块
-];
+// const productBlocks = [
+//   productData.slice(0, 6), // 第一块
+//   productData.slice(6, 12), // 第二块
+// ];
 
 const Recommend = () => {
   return (