Procházet zdrojové kódy

fix: 全面修复用户端 i18n 硬编码中文,补全字典 key,回退错误编辑

- 修复 OrderList.tsx 中 3 处被错误替换的行(状态 fallback / 搜索按钮 / 结算标签)
- 补全 zh.ts / en.ts 所有缺失 key(common、order、ticket、profile 命名空间)
- TicketModal.tsx:替换 关联工单流水号 / 咨询与申诉类型 / 详细说明与情况描述
- UserOrderDetailModal.tsx:替换 申报资料登记单 / 支付流水核销明细 / 节点流转事件日志 / 暂无后续流转事件 / 暂无申报附加资料记录
- ProfileSettings.tsx:替换 个人身份资料档案 / 账户凭证与安全密码 / 编辑资料 / 绑定邮箱 / 联系电话 / 未填写 / 更换头像 / 用户昵称 / 常用手机号 / 保存档案 / 修改安全密码 等
jerry před 2 měsíci
rodič
revize
edd67df2fb

+ 5 - 5
src/components/dashboard/OrderList.tsx

@@ -119,7 +119,7 @@ export default function OrderList({ onRequestTicket, onViewDetail }: OrderListPr
           onClick={handleSearch}
           className="px-5 py-2.5 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black font-black text-xs shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5 active:shadow-none uppercase"
         >
-          [ {t('common.search') || '检索'} ]
+          [ {t('common.search')} ]
         </button>
       </div>
 
@@ -210,7 +210,7 @@ export default function OrderList({ onRequestTicket, onViewDetail }: OrderListPr
 
                   {/* 价格结算区 */}
                   <div className="text-left md:text-right shrink-0 border-t md:border-t-0 md:border-l-2 border-dashed border-neutral-300 pt-2 md:pt-0 md:pl-4">
-                    <span className="text-[10px] text-neutral-500 uppercase block font-bold">SETTLEMENT FEE</span>
+                    <span className="text-[10px] text-neutral-500 uppercase block font-bold">{t('order.settlement_fee') || 'SETTLEMENT FEE'}</span>
                     <div className="flex items-baseline gap-1 text-black font-black">
                       <span className="text-xs">{currency === 'CNY' ? '¥' : currency}</span>
                       <span className="text-xl tracking-tight">{(final / 100).toLocaleString()}</span>
@@ -230,7 +230,7 @@ export default function OrderList({ onRequestTicket, onViewDetail }: OrderListPr
                     className="px-3 py-1.5 bg-neutral-100 hover:bg-neutral-200 text-black border border-black font-bold text-xs shadow-[1px_1px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5 flex items-center gap-1.5 uppercase"
                   >
                     <MessageSquare size={13} />
-                    <span>[ 申请客服支持 ]</span>
+                    <span>{t('common.apply_support')}</span>
                   </button>
 
                   <div className="flex items-center gap-2">
@@ -240,7 +240,7 @@ export default function OrderList({ onRequestTicket, onViewDetail }: OrderListPr
                         className="px-4 py-1.5 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black font-black text-xs shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5 active:shadow-none flex items-center gap-1 uppercase"
                       >
                         <CreditCard size={13} />
-                        <span>[ 前往收银台支付 → ]</span>
+                        <span>{t('common.go_to_payment')}</span>
                       </button>
                     )}
 
@@ -249,7 +249,7 @@ export default function OrderList({ onRequestTicket, onViewDetail }: OrderListPr
                       className="px-3.5 py-1.5 bg-white hover:bg-neutral-50 text-black border-2 border-black font-bold text-xs shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5 active:shadow-none flex items-center gap-1 uppercase"
                     >
                       <Eye size={13} />
-                      <span>[ 查阅工单明细 ]</span>
+                      <span>{t('common.view_ticket_detail')}</span>
                     </button>
                   </div>
                 </div>

+ 14 - 14
src/components/dashboard/ProfileSettings.tsx

@@ -158,7 +158,7 @@ export default function ProfileSettings() {
         <div className="px-5 py-3 border-b-2 border-black bg-neutral-100 flex justify-between items-center text-xs font-black uppercase text-black">
           <div className="flex items-center gap-2">
             <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
-            <span>[ 01 // 个人身份资料档案 ]</span>
+            <span>[ {t('profile.identity_archive')} ]</span>
           </div>
           {!isEditing && (
             <button 
@@ -166,7 +166,7 @@ export default function ProfileSettings() {
               className="px-3 py-1 bg-white hover:bg-amber-300 text-black border-2 border-black font-bold text-xs shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5 active:shadow-none flex items-center gap-1 uppercase"
             >
               <Edit2 size={12} />
-              <span>[ 编辑资料 ]</span>
+              <span>[ {t('profile.edit_profile_btn')} ]</span>
             </button>
           )}
         </div>
@@ -191,12 +191,12 @@ export default function ProfileSettings() {
 
                 <div className="grid grid-cols-1 sm:grid-cols-2 gap-3 pt-1">
                   <div className="p-3 bg-neutral-50 border-2 border-black shadow-[2px_2px_0px_#000]">
-                    <span className="text-[10px] font-bold text-neutral-500 uppercase block mb-0.5">EMAIL // 绑定邮箱</span>
+                    <span className="text-[10px] font-bold text-neutral-500 uppercase block mb-0.5">EMAIL // {t('profile.bound_email_label')}</span>
                     <p className="text-xs font-bold text-black truncate font-mono" title={user.email}>{user.email}</p>
                   </div>
                   <div className="p-3 bg-neutral-50 border-2 border-black shadow-[2px_2px_0px_#000]">
-                    <span className="text-[10px] font-bold text-neutral-500 uppercase block mb-0.5">PHONE // 联系电话</span>
-                    <p className="text-xs font-bold text-black font-mono">{user.phone || '未填写'}</p>
+                    <span className="text-[10px] font-bold text-neutral-500 uppercase block mb-0.5">PHONE // {t('profile.contact_phone_label')}</span>
+                    <p className="text-xs font-bold text-black font-mono">{user.phone || t('profile.not_set')}</p>
                   </div>
                 </div>
               </div>
@@ -216,7 +216,7 @@ export default function ProfileSettings() {
                       <Camera className="text-black" size={24} />
                     </div>
                   </label>
-                  <span className="text-[11px] font-bold text-neutral-700 underline cursor-pointer">[ 更换头像 ]</span>
+                  <span className="text-[11px] font-bold text-neutral-700 underline cursor-pointer">[ {t('profile.change_avatar_btn')} ]</span>
                   <input 
                     id="avatar-upload" 
                     type="file" 
@@ -229,7 +229,7 @@ export default function ProfileSettings() {
 
                 <div className="flex-1 space-y-3 w-full">
                   <div>
-                    <label className="block text-xs font-bold uppercase text-black mb-1">[ 绑定邮箱(系统只读) ]</label>
+                    <label className="block text-xs font-bold uppercase text-black mb-1">[ {t('profile.email_readonly_label')} ]</label>
                     <input 
                       type="text" 
                       disabled 
@@ -239,18 +239,18 @@ export default function ProfileSettings() {
                   </div>
                   
                   <div>
-                    <label className="block text-xs font-bold uppercase text-black mb-1">[ 用户昵称 ]</label>
+                    <label className="block text-xs font-bold uppercase text-black mb-1">[ {t('profile.nickname_label_form')} ]</label>
                     <input 
                       type="text" 
                       className="w-full border-2 border-black bg-neutral-50 p-2.5 text-xs font-sans focus:bg-white outline-none shadow-[2px_2px_0px_#000] text-black"
                       value={nickname}
                       onChange={(e) => setNickname(e.target.value)}
-                      placeholder="设置您的称呼..."
+                      placeholder={t('profile.nickname_placeholder_form')}
                     />
                   </div>
 
                   <div>
-                    <label className="block text-xs font-bold uppercase text-black mb-1">[ 常用手机号 ]</label>
+                    <label className="block text-xs font-bold uppercase text-black mb-1">[ {t('profile.phone_label_form')} ]</label>
                     <input 
                       type="text" 
                       className="w-full border-2 border-black bg-neutral-50 p-2.5 text-xs font-mono focus:bg-white outline-none shadow-[2px_2px_0px_#000] text-black"
@@ -266,14 +266,14 @@ export default function ProfileSettings() {
                       onClick={handleCancel} 
                       className="px-4 py-2 border-2 border-black bg-neutral-100 text-black font-bold text-xs shadow-[2px_2px_0px_#000] hover:bg-neutral-200 transition active:translate-x-0.5 active:translate-y-0.5 uppercase"
                     >
-                      [ 取消 ]
+                      [ {t('common.cancel')} ]
                     </button>
                     <button 
                       type="submit" 
                       disabled={loading} 
                       className="px-6 py-2 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black font-black text-xs shadow-[3px_3px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5 active:shadow-none flex items-center gap-1.5 uppercase disabled:opacity-50"
                     >
-                      {loading ? <Loader2 size={14} className="animate-spin" /> : <><Save size={13} /> <span>[ 保存档案 ]</span></>}
+                      {loading ? <Loader2 size={14} className="animate-spin" /> : <><Save size={13} /> <span>[ {t('profile.save_archive')} ]</span></>}
                     </button>
                   </div>
                 </div>
@@ -288,7 +288,7 @@ export default function ProfileSettings() {
         <div className="bg-white border-2 border-black shadow-[4px_4px_0px_#000]">
           <div className="px-5 py-3 border-b-2 border-black bg-neutral-100 text-xs font-black uppercase text-black flex items-center gap-2">
             <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
-            <span>[ 02 // 账户凭证与安全密码 ]</span>
+            <span>[ {t('profile.account_credentials')} ]</span>
           </div>
           <div className="p-6">
             <div className="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 p-4 border-2 border-black bg-neutral-50 shadow-[2px_2px_0px_#000]">
@@ -305,7 +305,7 @@ export default function ProfileSettings() {
                 onClick={() => setIsPasswordModalOpen(true)}
                 className="px-4 py-2 bg-amber-300 hover:bg-amber-400 text-black border-2 border-black font-black text-xs shadow-[2px_2px_0px_#000] transition active:translate-x-0.5 active:translate-y-0.5 active:shadow-none uppercase whitespace-nowrap"
               >
-                [ 修改安全密码 → ]
+                [ {t('profile.change_password_btn')} ]
               </button>
             </div>
           </div>

+ 4 - 4
src/components/dashboard/TicketModal.tsx

@@ -92,7 +92,7 @@ export default function TicketModal({ isOpen, onClose, onSuccess, defaultOrderId
         <div className="px-5 py-3.5 border-b-2 border-black flex justify-between items-center bg-neutral-200 text-black select-none">
           <div className="flex items-center gap-2 text-xs font-bold uppercase tracking-wider">
             <span className="w-2.5 h-2.5 bg-amber-300 border border-black inline-block" />
-            <span>[ CREATE TICKET // 新建专属客服工单 ]</span>
+            <span>[ CREATE TICKET // {t('ticket.create_new')} ]</span>
           </div>
           <button 
             onClick={onClose} 
@@ -113,7 +113,7 @@ export default function TicketModal({ isOpen, onClose, onSuccess, defaultOrderId
           <form onSubmit={handleSubmit} className="space-y-4">
             <div className="space-y-1">
               <label className="block text-xs font-bold uppercase text-black">
-                [ 01 // 关联工单流水号 ]: <span className="text-black">*</span>
+                [ 01 // {t('ticket.related_order_id')} ]: <span className="text-black">*</span>
               </label>
               <input
                 type="text" 
@@ -127,7 +127,7 @@ export default function TicketModal({ isOpen, onClose, onSuccess, defaultOrderId
 
             <div className="space-y-1">
               <label className="block text-xs font-bold uppercase text-black">
-                [ 02 // 咨询与申诉类型 ]: <span className="text-black">*</span>
+                [ 02 // {t('ticket.inquiry_type')} ]: <span className="text-black">*</span>
               </label>
               <select
                 className="w-full border-2 border-black bg-neutral-50 p-2.5 text-xs font-mono focus:bg-white outline-none shadow-[2px_2px_0px_#000] text-black cursor-pointer"
@@ -142,7 +142,7 @@ export default function TicketModal({ isOpen, onClose, onSuccess, defaultOrderId
 
             <div className="space-y-1">
               <label className="block text-xs font-bold uppercase text-black">
-                [ 03 // 详细说明与情况描述 ]: <span className="text-black">*</span>
+                [ 03 // {t('ticket.detail_desc')} ]: <span className="text-black">*</span>
               </label>
               <textarea
                 required

+ 5 - 5
src/components/dashboard/UserOrderDetailModal.tsx

@@ -137,7 +137,7 @@ export default function UserOrderDetailModal({ isOpen, onClose, order }: UserOrd
             <div className="bg-neutral-100 px-4 py-2.5 border-b-2 border-black flex items-center justify-between text-xs font-bold uppercase text-black">
               <div className="flex items-center gap-2">
                 <FileText size={15} />
-                <span>[ 01 // 申报资料登记单 ]</span>
+                <span>[ {t('order.declaration_record')} ]</span>
               </div>
               <span className="text-[10px] text-neutral-500">SPECIFIED</span>
             </div>
@@ -157,7 +157,7 @@ export default function UserOrderDetailModal({ isOpen, onClose, order }: UserOrd
                 </div>
               ) : (
                 <div className="text-center py-4 text-neutral-400 text-xs">
-                  [ 暂无申报附加资料记录 ]
+                  [ {t('order.no_extra_data')} ]
                 </div>
               )}
             </div>
@@ -169,7 +169,7 @@ export default function UserOrderDetailModal({ isOpen, onClose, order }: UserOrd
               <div className="bg-neutral-100 px-4 py-2.5 border-b-2 border-black flex items-center justify-between text-xs font-bold uppercase text-black">
                 <div className="flex items-center gap-2">
                   <CreditCard size={15} />
-                  <span>[ 02 // 支付流水核销明细 ]</span>
+                  <span>[ {t('order.payment_ledger')} ]</span>
                 </div>
                 <span className="text-[10px] text-neutral-500">LEDGER-TX</span>
               </div>
@@ -201,7 +201,7 @@ export default function UserOrderDetailModal({ isOpen, onClose, order }: UserOrd
             <div className="bg-neutral-100 px-4 py-2.5 border-b-2 border-black flex items-center justify-between text-xs font-bold uppercase text-black">
               <div className="flex items-center gap-2">
                 <Clock size={15} />
-                <span>[ 03 // 节点流转事件日志 ]</span>
+                <span>[ {t('order.event_log')} ]</span>
               </div>
               <span className="text-[10px] text-neutral-500">EVENT-LOG</span>
             </div>
@@ -212,7 +212,7 @@ export default function UserOrderDetailModal({ isOpen, onClose, order }: UserOrd
               </div>
             ) : events.length === 0 ? (
               <div className="p-6 text-center text-neutral-400 text-xs">
-                [ 暂无后续流转事件 ]
+                [ {t('order.no_followup_events')} ]
               </div>
             ) : (
               <div className="divide-y-2 divide-dashed divide-neutral-200">

+ 25 - 0
src/lib/i18n/locales/en.ts

@@ -38,6 +38,9 @@ export const en = {
     book_now: 'Book Now',
     show: 'Show',
     hide: 'Hide',
+    apply_support: '[ Request Support ]',
+    go_to_payment: '[ Go to Payment → ]',
+    view_ticket_detail: '[ View Details ]',
   },
   auth: {
     welcome_back: 'Welcome Back',
@@ -204,6 +207,12 @@ export const en = {
     status_completed: 'Completed',
     status_failed: 'Failed',
     status_cancelled: 'Cancelled',
+    declaration_record: '§ 01 // Application Materials',
+    payment_ledger: '§ 02 // Payment Ledger',
+    event_log: '§ 03 // Event Log',
+    no_followup_events: 'No follow-up events',
+    no_extra_data: 'No additional application data',
+    settlement_fee: 'Settlement Fee',
   },
   status: {
     pending: 'Pending',
@@ -271,6 +280,9 @@ export const en = {
       rejected: 'Rejected',
     },
     view_thread: 'View Thread',
+    related_order_id: 'Related Order ID',
+    inquiry_type: 'Inquiry & Appeal Type',
+    detail_desc: 'Detailed Description',
   },
   nav: {
     dashboard: 'Dashboard',
@@ -459,6 +471,19 @@ export const en = {
     update_success: 'Profile updated successfully!',
     update_failed: 'Update failed',
     fetch_failed: 'Failed to fetch user info',
+    identity_archive: '§ 01 // Personal Identity Archive',
+    account_credentials: '§ 02 // Account Credentials & Security',
+    edit_profile_btn: 'Edit Profile',
+    bound_email_label: 'Bound Email',
+    contact_phone_label: 'Contact Phone',
+    not_set: 'Not set',
+    change_avatar_btn: 'Change Avatar',
+    email_readonly_label: 'Bound Email (Read-only)',
+    nickname_label_form: 'Nickname',
+    phone_label_form: 'Phone Number',
+    nickname_placeholder_form: 'Set your display name...',
+    save_archive: 'Save Profile',
+    change_password_btn: 'Change Password →',
   },
   sidebar: {
     orders: 'My Orders',

+ 25 - 0
src/lib/i18n/locales/zh.ts

@@ -38,6 +38,9 @@ export const zh = {
     book_now: '立即前往预定',
     show: '显示',
     hide: '隐藏',
+    apply_support: '[ 申请客服支持 ]',
+    go_to_payment: '[ 前往收银台支付 → ]',
+    view_ticket_detail: '[ 查阅工单明细 ]',
   },
   auth: {
     welcome_back: '欢迎回来',
@@ -204,6 +207,12 @@ export const zh = {
     status_completed: '已完成',
     status_failed: '失败',
     status_cancelled: '已取消',
+    declaration_record: '§ 01 // 申报资料登记单',
+    payment_ledger: '§ 02 // 支付流水核销明细',
+    event_log: '§ 03 // 节点流转事件日志',
+    no_followup_events: '暂无后续流转事件',
+    no_extra_data: '暂无申报附加资料记录',
+    settlement_fee: '结算费用',
   },
   status: {
     pending: '待支付',
@@ -271,6 +280,9 @@ export const zh = {
       rejected: '已拒绝',
     },
     view_thread: '进入工单对话',
+    related_order_id: '关联工单流水号',
+    inquiry_type: '咨询与申诉类型',
+    detail_desc: '详细说明与情况描述',
   },
   nav: {
     dashboard: '控制台', // 或 '仪表盘'
@@ -453,6 +465,19 @@ export const zh = {
     update_success: '个人资料更新成功!',
     update_failed: '更新失败',
     fetch_failed: '无法获取用户信息',
+    identity_archive: '§ 01 // 个人身份资料档案',
+    account_credentials: '§ 02 // 账户凭证与安全密码',
+    edit_profile_btn: '编辑资料',
+    bound_email_label: '绑定邮箱',
+    contact_phone_label: '联系电话',
+    not_set: '未填写',
+    change_avatar_btn: '更换头像',
+    email_readonly_label: '绑定邮箱(系统只读)',
+    nickname_label_form: '用户昵称',
+    phone_label_form: '常用手机号',
+    nickname_placeholder_form: '设置您的称呼...',
+    save_archive: '保存档案',
+    change_password_btn: '修改安全密码 →',
   },
   sidebar: {
     orders: '我的订单',