Browse Source

根据pnpm lint进行调整

zhangzf 2 days ago
parent
commit
227188de22

+ 7 - 3
src/app/(public)/customer/account/edit/page.tsx

@@ -4,9 +4,9 @@ import { useState } from "react";
 import { useEffect } from "react";
 import {
   parseDate,
-  getLocalTimeZone,
   CalendarDate,
 } from "@internationalized/date";
+import Link from "next/link";
 import { DatePicker } from "@heroui/date-picker";
 const AccountEditPage = () => {
   // 统一表单对象
@@ -68,7 +68,11 @@ const AccountEditPage = () => {
     <div className="w-full h-full">
       <form className="overflow-hidden" onSubmit={handleSubmit}>
         <div className="bg-[#fff] pr-2.5 pl-2.5 w-full text-center text-base h-11 leading-11 font-semibold relative text-[#0b0b0b]">
-          <a href="/customer/account" className="absolute left-2.5 text-2xl inline-block top-1/2  -translate-y-1/2">
+           <Link
+              className="absolute left-2.5 text-2xl inline-block top-1/2  -translate-y-1/2"
+              href="/customer/account"
+              aria-label="Go to customer account page"
+            >
             <svg
               xmlns="http://www.w3.org/2000/svg"
               width="24"
@@ -84,7 +88,7 @@ const AccountEditPage = () => {
                 d="M15 18L9 12L15 6"
               ></path>
             </svg>
-          </a>
+          </Link>
           <span className="vipReturnTitles">Account Information</span>
         </div>
         <input name="form_key" type="hidden" value="kW7wucXHATeeem75"></input>

+ 0 - 7
src/app/(public)/customer/account/mypoints/page.tsx

@@ -53,13 +53,6 @@ const AccountPointsPage = () => {
     setIsModalOpen(true);
   };
 
-  // 关闭弹窗(返回按钮/遮罩层点击)
-  const ruleCloseModal = (e:any) => {
-    // 仅点击遮罩层或返回按钮时关闭,点击弹窗内容区不关闭
-    if (e.target.id === 'modal-overlay' || e.target.id === 'back-btn') {
-      setIsModalOpen(false);
-    }
-  };
   return (
     <div className="w-full h-full">
       <div className="bg-[#fff] pr-2.5 pl-2.5 w-full text-center text-base h-11 leading-11 font-semibold relative text-[#0b0b0b]">

+ 20 - 7
src/app/(public)/customer/account/page.tsx

@@ -3,6 +3,7 @@ import React from "react";
 import { useState } from "react";
 import SettingModal from "@/components/customer/SettingModal";
 import AccountSwiper from "@components/customer/accountSwiper";
+import Link from "next/link";
 const orderNavs = [
   {
     href: "/sales/order/history/#all",
@@ -45,7 +46,7 @@ const MyAccountPage = () => {
         </h1>
         <div
           className="absolute top-2.5 right-2.5 z-[99999]"
-          onClick={(e) => {
+          onClick={() => {
             setShowSetting(true);
           }}
         >
@@ -90,17 +91,29 @@ const MyAccountPage = () => {
 
         {/* 积分 / 优惠券 / 余额 */}
         <div className="flex justify-around items-center p-4 pt-0 pb-0  mt-5 text-sm ">
-          <a href="/customer/account/mypoints" className="leading-5">
+          <Link
+            className="leading-5"
+            href="/customer/account/mypoints"
+            aria-label="Go to customer account mypoints page"
+          >
             <strong>99999</strong> <br /> Points
-          </a>
+          </Link>
           <div>|</div>
-          <a href="/customer/account/mycoupon" className="leading-5">
+          <Link
+            className="leading-5"
+            href="/customer/account/mycoupon"
+            aria-label="Go to customer account mycoupon page"
+          >
             <strong className="coupons-number">0</strong> <br /> Coupon
-          </a>
+          </Link>
           <div>|</div>
-          <a href="/koc/user/mybalance" className="leading-5">
+            <Link
+            className="leading-5"
+            href="/koc/user/mybalance"
+            aria-label="Go to koc user mybalance page"
+          >
             <strong>$0</strong> <br /> Balance
-          </a>
+          </Link>
         </div>
 
         {/* VIP 等级 */}

+ 154 - 96
src/app/(public)/customer/account/pointlist/page.tsx

@@ -1,85 +1,127 @@
 "use client";
-import Image from "next/image";
-import React, { useState, useEffect, useRef } from 'react';
+// import Image from "next/image";
+import React, { useState, useEffect, useRef } from "react";
 
 // 模拟积分明细数据(可替换为接口请求)
 const mockPointsData = [
   {
     id: 1,
-    type: 'rewarded',
-    title: 'Check In',
-    points: '+10 Points',
-    date: 'May 17, 2026 11:07 PM',
-    currentPoints: 'My points:100009',
+    type: "rewarded",
+    title: "Check In",
+    points: "+10 Points",
+    date: "May 17, 2026 11:07 PM",
+    currentPoints: "My points:100009",
   },
   {
     id: 2,
-    type: 'rewarded',
-    title: 'Points Return of Redeem Hair Usage',
-    points: '+12000 Points',
-    date: 'Oct 23, 2025 1:11 AM',
-    currentPoints: 'My points:99999',
+    type: "rewarded",
+    title: "Points Return of Redeem Hair Usage",
+    points: "+12000 Points",
+    date: "Oct 23, 2025 1:11 AM",
+    currentPoints: "My points:99999",
   },
   {
     id: 3,
-    type: 'used',
-    title: 'Points Redeem Hair',
-    points: '-6000 Points',
-    date: 'Oct 17, 2025 10:27 PM',
-    currentPoints: 'My points:87999',
+    type: "used",
+    title: "Points Redeem Hair",
+    points: "-6000 Points",
+    date: "Oct 17, 2025 10:27 PM",
+    currentPoints: "My points:87999",
   },
   {
     id: 4,
-    type: 'used',
-    title: 'Points Redeem Hair',
-    points: '-6000 Points',
-    date: 'Oct 17, 2025 10:25 PM',
-    currentPoints: 'My points:93999',
+    type: "used",
+    title: "Points Redeem Hair",
+    points: "-6000 Points",
+    date: "Oct 17, 2025 10:25 PM",
+    currentPoints: "My points:93999",
   },
   {
     id: 5,
-    type: 'rewarded',
-    title: 'Updated by Admin',
-    points: '+99999 Points',
-    date: 'Oct 17, 2025 10:24 PM',
-    currentPoints: 'My points:99999',
+    type: "rewarded",
+    title: "Updated by Admin",
+    points: "+99999 Points",
+    date: "Oct 17, 2025 10:24 PM",
+    currentPoints: "My points:99999",
   },
   {
     id: 6,
-    type: 'used',
-    title: 'Points Redeem Giftcard',
-    points: '-300 Points',
-    date: 'Oct 13, 2025 8:41 PM',
-    currentPoints: 'My points:0',
+    type: "used",
+    title: "Points Redeem Giftcard",
+    points: "-300 Points",
+    date: "Oct 13, 2025 8:41 PM",
+    currentPoints: "My points:0",
   },
   {
     id: 7,
-    type: 'rewarded',
-    title: 'Reward for Registering',
-    points: '+200 Points',
-    date: 'Jun 9, 2025 7:39 PM',
-    currentPoints: 'My points:300',
+    type: "rewarded",
+    title: "Reward for Registering",
+    points: "+200 Points",
+    date: "Jun 9, 2025 7:39 PM",
+    currentPoints: "My points:300",
   },
   {
     id: 8,
-    type: 'rewarded',
-    title: 'Reward for Signing up Newsletter',
-    points: '+100 Points',
-    date: 'Jun 9, 2025 7:39 PM',
-    currentPoints: 'My points:100',
+    type: "rewarded",
+    title: "Reward for Signing up Newsletter",
+    points: "+100 Points",
+    date: "Jun 9, 2025 7:39 PM",
+    currentPoints: "My points:100",
   },
   // 补充测试数据(凑够分页演示)
-  { id: 9, type: 'rewarded', title: 'Check In', points: '+10 Points', date: 'May 16, 2026 10:00 PM', currentPoints: 'My points:100000' },
-  { id: 10, type: 'used', title: 'Points Redeem Accessory', points: '-500 Points', date: 'May 15, 2026 9:00 AM', currentPoints: 'My points:99990' },
-  { id: 11, type: 'rewarded', title: 'Review Product', points: '+50 Points', date: 'May 14, 2026 8:00 PM', currentPoints: 'My points:100490' },
-  { id: 12, type: 'rewarded', title: 'Refer a Friend', points: '+200 Points', date: 'May 13, 2026 7:00 PM', currentPoints: 'My points:100440' },
-  { id: 13, type: 'used', title: 'Points Redeem Cash', points: '-1000 Points', date: 'May 12, 2026 6:00 PM', currentPoints: 'My points:100240' },
-  { id: 14, type: 'rewarded', title: 'Check In', points: '+10 Points', date: 'May 11, 2026 5:00 PM', currentPoints: 'My points:101240' },
+  {
+    id: 9,
+    type: "rewarded",
+    title: "Check In",
+    points: "+10 Points",
+    date: "May 16, 2026 10:00 PM",
+    currentPoints: "My points:100000",
+  },
+  {
+    id: 10,
+    type: "used",
+    title: "Points Redeem Accessory",
+    points: "-500 Points",
+    date: "May 15, 2026 9:00 AM",
+    currentPoints: "My points:99990",
+  },
+  {
+    id: 11,
+    type: "rewarded",
+    title: "Review Product",
+    points: "+50 Points",
+    date: "May 14, 2026 8:00 PM",
+    currentPoints: "My points:100490",
+  },
+  {
+    id: 12,
+    type: "rewarded",
+    title: "Refer a Friend",
+    points: "+200 Points",
+    date: "May 13, 2026 7:00 PM",
+    currentPoints: "My points:100440",
+  },
+  {
+    id: 13,
+    type: "used",
+    title: "Points Redeem Cash",
+    points: "-1000 Points",
+    date: "May 12, 2026 6:00 PM",
+    currentPoints: "My points:100240",
+  },
+  {
+    id: 14,
+    type: "rewarded",
+    title: "Check In",
+    points: "+10 Points",
+    date: "May 11, 2026 5:00 PM",
+    currentPoints: "My points:101240",
+  },
 ];
 
 const PointsDetails = () => {
   // 状态管理
-  const [activeTab, setActiveTab] = useState('all'); // 激活标签:all/rewarded/used
+  const [activeTab, setActiveTab] = useState("all"); // 激活标签:all/rewarded/used
   const [listData, setListData] = useState([]); // 展示的列表数据
   const [page, setPage] = useState(1); // 当前页码
   const [loading, setLoading] = useState(false); // 加载状态
@@ -95,10 +137,10 @@ const PointsDetails = () => {
     setHasMore(true);
     // 筛选数据
     let filteredData = mockPointsData;
-    if (activeTab === 'rewarded') {
-      filteredData = mockPointsData.filter(item => item.type === 'rewarded');
-    } else if (activeTab === 'used') {
-      filteredData = mockPointsData.filter(item => item.type === 'used');
+    if (activeTab === "rewarded") {
+      filteredData = mockPointsData.filter((item) => item.type === "rewarded");
+    } else if (activeTab === "used") {
+      filteredData = mockPointsData.filter((item) => item.type === "used");
     }
     // 第一页数据
     const firstPageData = filteredData.slice(0, PAGE_SIZE);
@@ -123,35 +165,46 @@ const PointsDetails = () => {
 
     const container = listRef.current;
     if (container) {
-      container.addEventListener('scroll', handleScroll);
-      return () => container.removeEventListener('scroll', handleScroll);
+      container.addEventListener("scroll", handleScroll);
+      return () => container.removeEventListener("scroll", handleScroll);
     }
-  }, [loading, hasMore, listData]);
+  }, [loading, hasMore]);
 
   // 加载更多数据
   const loadMore = () => {
+    if (loading) return;
+
     setLoading(true);
-    // 模拟接口请求延迟
+
     setTimeout(() => {
       let filteredData = mockPointsData;
-      if (activeTab === 'rewarded') {
-        filteredData = mockPointsData.filter(item => item.type === 'rewarded');
-      } else if (activeTab === 'used') {
-        filteredData = mockPointsData.filter(item => item.type === 'used');
-      }
-      // 计算下一页数据
-      const nextPage = page + 1;
-      const start = (nextPage - 1) * PAGE_SIZE;
-      const end = nextPage * PAGE_SIZE;
-      const newData = filteredData.slice(start, end);
-      
-      if (newData.length > 0) {
-        setListData(prev => [...prev, ...newData]);
-        setPage(nextPage);
-      } else {
-        setHasMore(false);
+
+      if (activeTab === "rewarded") {
+        filteredData = mockPointsData.filter(
+          (item) => item.type === "rewarded",
+        );
+      } else if (activeTab === "used") {
+        filteredData = mockPointsData.filter((item) => item.type === "used");
       }
-      setLoading(false);
+
+      setPage((prevPage) => {
+        const nextPage = prevPage + 1;
+
+        const start = (nextPage - 1) * PAGE_SIZE;
+        const end = nextPage * PAGE_SIZE;
+
+        const newData = filteredData.slice(start, end);
+
+        if (newData.length > 0) {
+          setListData((prev) => [...prev, ...newData]);
+        } else {
+          setHasMore(false);
+        }
+
+        setLoading(false);
+
+        return nextPage;
+      });
     }, 800);
   };
 
@@ -172,31 +225,31 @@ const PointsDetails = () => {
       {/* 标签切换栏 */}
       <div className="flex border-b border-gray-200">
         <button
-          onClick={() => setActiveTab('all')}
+          onClick={() => setActiveTab("all")}
           className={`px-6 py-3 font-medium text-sm ${
-            activeTab === 'all'
-              ? 'bg-black text-white'
-              : 'bg-white text-gray-600 hover:bg-gray-50'
+            activeTab === "all"
+              ? "bg-black text-white"
+              : "bg-white text-gray-600 hover:bg-gray-50"
           }`}
         >
           ALL
         </button>
         <button
-          onClick={() => setActiveTab('rewarded')}
+          onClick={() => setActiveTab("rewarded")}
           className={`px-6 py-3 font-medium text-sm ${
-            activeTab === 'rewarded'
-              ? 'bg-black text-white'
-              : 'bg-white text-gray-600 hover:bg-gray-50'
+            activeTab === "rewarded"
+              ? "bg-black text-white"
+              : "bg-white text-gray-600 hover:bg-gray-50"
           }`}
         >
           REWARDED
         </button>
         <button
-          onClick={() => setActiveTab('used')}
+          onClick={() => setActiveTab("used")}
           className={`px-6 py-3 font-medium text-sm ${
-            activeTab === 'used'
-              ? 'bg-black text-white'
-              : 'bg-white text-gray-600 hover:bg-gray-50'
+            activeTab === "used"
+              ? "bg-black text-white"
+              : "bg-white text-gray-600 hover:bg-gray-50"
           }`}
         >
           USED
@@ -204,10 +257,7 @@ const PointsDetails = () => {
       </div>
 
       {/* 积分明细列表(带滚动监听) */}
-      <div
-        ref={listRef}
-        className="h-[calc(100vh-120px)] overflow-y-auto"
-      >
+      <div ref={listRef} className="h-[calc(100vh-120px)] overflow-y-auto">
         {listData.length > 0 ? (
           <div className="divide-y divide-gray-100">
             {listData.map((item) => (
@@ -215,19 +265,25 @@ const PointsDetails = () => {
                 {/* 左侧:标题+日期 */}
                 <div className="flex justify-between items-start">
                   <div>
-                    <h3 className="text-base font-medium text-black">{item.title}</h3>
+                    <h3 className="text-base font-medium text-black">
+                      {item.title}
+                    </h3>
                     <p className="text-xs text-gray-500 mt-1">{item.date}</p>
                   </div>
                   {/* 右侧:积分变动 */}
                   <div className="text-right">
-                    <p 
+                    <p
                       className={`text-base font-medium ${
-                        item.points.startsWith('+') ? 'text-black' : 'text-black'
+                        item.points.startsWith("+")
+                          ? "text-black"
+                          : "text-black"
                       }`}
                     >
                       {item.points}
                     </p>
-                    <p className="text-xs text-gray-500 mt-1">{item.currentPoints}</p>
+                    <p className="text-xs text-gray-500 mt-1">
+                      {item.currentPoints}
+                    </p>
                   </div>
                 </div>
               </div>
@@ -243,11 +299,13 @@ const PointsDetails = () => {
         {/* 加载中/无更多提示 */}
         <div className="px-4 py-3 text-center text-sm">
           {loading && <p className="text-gray-500">Loading...</p>}
-          {!loading && !hasMore && <p className="text-gray-500">NO MORE DATA</p>}
+          {!loading && !hasMore && (
+            <p className="text-gray-500">NO MORE DATA</p>
+          )}
         </div>
       </div>
     </div>
   );
 };
 
-export default PointsDetails;
+export default PointsDetails;

+ 1 - 1
src/app/(public)/customer/address/new/page.tsx

@@ -1,7 +1,7 @@
 "use client";
 import React from "react";
 import { useState } from "react";
-import { useEffect } from "react";
+// import { useEffect } from "react";
 const NewAddressPage = () => {
   // 统一表单对象
   const [form, setForm] = useState({