Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
duoyuyansss
bulaienaofutuojiesenzhang694781262acf
diff --git a/src/app/[lng]/profile/page.tsx b/src/app/[lng]/profile/page.tsxindex d18e9d27..a4d2fe11 100644--- a/src/app/[lng]/profile/page.tsx+++ b/src/app/[lng]/profile/page.tsx@@ -1,8 +1,8 @@"use client";import { useEffect, useState } from "react";-import { Card, Descriptions, Button, message, Modal, Form, Input, Tabs, Table, Tag, Popconfirm, DatePicker, Select, Space } from "antd";-import { CrownOutlined, TrophyOutlined, GiftOutlined, StarOutlined, RocketOutlined, ThunderboltOutlined, HistoryOutlined, DollarOutlined, ShoppingCartOutlined, UserOutlined, GiftFilled, EditOutlined, CopyOutlined } from "@ant-design/icons";+import { Card, Descriptions, Button, message, Modal, Form, Input } from "antd";+import { CrownOutlined, TrophyOutlined, GiftOutlined, StarOutlined, RocketOutlined, ThunderboltOutlined, HistoryOutlined, DollarOutlined, UserOutlined, GiftFilled, EditOutlined, CopyOutlined } from "@ant-design/icons";import { useRouter, useSearchParams } from "next/navigation";import { WalletOutlined } from "@ant-design/icons";import Image from "next/image";@@ -10,9 +10,9 @@ import { useUserStore } from "@/store/user";import { getUserInfoApi, updateUserInfoApi, getPointsRecordsApi } from "@/api/apiReq";import { cancelAccountApi } from "@/api/signIn";import { createPaymentOrderApi, PaymentType as VipPaymentType } from "@/api/vip";-import { getOrderListApi, getOrderDetailApi, getSubscriptionListApi, refundOrderApi, unsubscribeApi } from "@/api/payment";-import type { Order, OrderListParams, SubscriptionListParams, RefundParams, UnsubscribeParams } from "@/api/types/payment";-import { OrderStatus, PaymentType } from "@/api/types/payment";+import { getOrderDetailApi } from "@/api/payment";+import type { Order } from "@/api/types/payment";+import { OrderStatus } from "@/api/types/payment";import styles from "./profile.module.css";import { useTransClient } from "@/app/i18n/client";import PointsRechargeModal from "@/components/modals/PointsRechargeModal";@@ -22,8 +22,6 @@ import PointsDetailModal from "@/components/modals/PointsDetailModal";import plusvip from "@/assets/images/plusvip.png";import logoHesd from "@/assets/images/logo.png";-const { TabPane } = Tabs;-const { Option } = Select;export default function ProfilePage() {const router = useRouter();@@ -33,18 +31,18 @@ export default function ProfilePage() {const [loading, setLoading] = useState(true);const [isModalOpen, setIsModalOpen] = useState(false);const [form] = Form.useForm();-+// 免费会员提示弹框状态const [freeTrialModalVisible, setFreeTrialModalVisible] = useState(false);const [hasShownFreeTrial, setHasShownFreeTrial] = useState(false);-+// 注销账户相关状态const [cancelModalVisible, setCancelModalVisible] = useState(false);const [cancelForm] = Form.useForm();const [cancelCode, setCancelCode] = useState('');const [cancelLoading, setCancelLoading] = useState(false);const [codeCountdown, setCodeCountdown] = useState(0);-+// 检查是否已经显示过免费会员提示useEffect(() => {const hasShown = localStorage.getItem('freeTrialShown');@@ -54,23 +52,7 @@ export default function ProfilePage() {}, []);// removed URL-driven auto-open; now fully controlled by state-- // 订单相关状态- const [orders, setOrders] = useState<Order[]>([]);- const [subscriptions, setSubscriptions] = useState<Order[]>([]);- const [ordersLoading, setOrdersLoading] = useState(false);- const [subscriptionsLoading, setSubscriptionsLoading] = useState(false);- const [ordersPagination, setOrdersPagination] = useState({- current: 1,- pageSize: 10,- total: 0- });- const [subscriptionsPagination, setSubscriptionsPagination] = useState({- current: 1,- pageSize: 10,- total: 0- });-+// 订单详情弹窗状态const [orderDetailVisible, setOrderDetailVisible] = useState(false);const [orderDetailLoading, setOrderDetailLoading] = useState(false);@@ -106,15 +88,15 @@ export default function ProfilePage() {metadata?: any;createdAt?: string;}-+// 获取会员状态和过期时间- const isVip = userInfo?.vipInfo?.cycleType && userInfo.vipInfo.cycleType > 0 &&- userInfo?.vipInfo?.expireTime ? new Date(userInfo.vipInfo.expireTime) > new Date() : false;+ const isVip = userInfo?.vipInfo?.cycleType && userInfo.vipInfo.cycleType > 0 &&+ userInfo?.vipInfo?.expireTime ? new Date(userInfo.vipInfo.expireTime) > new Date() : false;const vipExpireTime = userInfo?.vipInfo?.expireTime ? new Date(userInfo.vipInfo.expireTime).toLocaleDateString() : '';-+// 检查用户是否从未开过会员const hasNeverBeenVip = !userInfo?.vipInfo || Object.keys(userInfo.vipInfo).length === 0;-+// 获取会员类型显示文本const getVipCycleTypeText = (cycleType: number) => {switch (cycleType) {@@ -128,7 +110,7 @@ export default function ProfilePage() {return t('unknown');}};-+const vipCycleType = getVipCycleTypeText(userInfo?.vipInfo?.cycleType || 0);// 会员权益数据@@ -151,10 +133,10 @@ export default function ProfilePage() {message.error(t('getUserInfoFailed'));return;}-+if (response.code === 0 && response.data) {setUserInfo(response.data);-+// 检查是否需要显示免费会员提示const hasVipInfo = response.data.vipInfo;if (!hasVipInfo && !hasShownFreeTrial) {@@ -174,51 +156,6 @@ export default function ProfilePage() {}};- // 获取订单列表- const fetchOrders = async (params: OrderListParams) => {- setOrdersLoading(true);- try {- const response = await getOrderListApi(params);- if (response?.code === 0 && response.data) {- const paginatedData = response.data;- setOrders(paginatedData.list);- setOrdersPagination({- current: params.page + 1, // API发送的是0开始的页码,UI显示需要加1- pageSize: params.size,- total: paginatedData.count- });- } else {- message.error(response?.message || t('getOrderListFailed'));- }- } catch (error) {- message.error(t('getOrderListFailed'));- } finally {- setOrdersLoading(false);- }- };-- // 获取订阅列表- const fetchSubscriptions = async (params: SubscriptionListParams) => {- setSubscriptionsLoading(true);- try {- const response = await getSubscriptionListApi(params);- if (response?.code === 0 && response.data) {- const paginatedData = response.data;- setSubscriptions(paginatedData.list);- setSubscriptionsPagination({- current: params.page + 1, // API发送的是0开始的页码,UI显示需要加1- pageSize: params.size,- total: paginatedData.count- });- } else {- message.error(response?.message || t('getSubscriptionListFailed'));- }- } catch (error) {- message.error(t('getSubscriptionListFailed'));- } finally {- setSubscriptionsLoading(false);- }- };// 获取积分记录const fetchPointsRecords = async (params: { page: number; pageSize: number }) => {@@ -243,50 +180,12 @@ export default function ProfilePage() {}};- // 处理退款- const handleRefund = async (order: Order) => {- try {- const params: RefundParams = {- charge: order.id,- payment_intent: order.payment_intent || order.id,- userId: userInfo?.id || ''- };- const response = await refundOrderApi(params);- if (response?.code === 0) {- message.success(t('refundSubmitted'));- fetchOrders({ page: ordersPagination.current - 1, size: ordersPagination.pageSize });- } else {- message.error(response?.message || t('refundFailed'));- }- } catch (error) {- message.error(t('refundFailed'));- }- };-- // 处理退订- const handleUnsubscribe = async (order: Order) => {- try {- const params: UnsubscribeParams = {- id: order.id,- userId: userInfo?.id || ''- };- const response = await unsubscribeApi(params);- if (response?.code === 0) {- message.success(t('unsubscribeSuccess'));- fetchSubscriptions({ page: subscriptionsPagination.current - 1, size: subscriptionsPagination.pageSize });- } else {- message.error(response?.message || t('unsubscribeFailed'));- }- } catch (error) {- message.error(t('unsubscribeFailed'));- }- };// 获取订单详情const fetchOrderDetail = async (orderId: string) => {setOrderDetailLoading(true);try {- const response:any = await getOrderDetailApi(orderId);+ const response: any = await getOrderDetailApi(orderId);if (response?.code === 0 && response.data) {setCurrentOrderDetail(response.data[0]);setOrderDetailVisible(true);@@ -307,7 +206,7 @@ export default function ProfilePage() {try {const response = await cancelAccountApi.getCancelCode();console.log('验证码响应:', response);-+if (response && response.code === 0) {setCancelCode(response.data?.code || '');message.success('验证码已发送');@@ -329,13 +228,13 @@ export default function ProfilePage() {try {const values = await cancelForm.validateFields();setCancelLoading(true);-+console.log('发送注销请求,验证码:', values.code);-- const response:any = await cancelAccountApi.cancelAccount({++ const response: any = await cancelAccountApi.cancelAccount({code: values.code});-+if (response && response.code === 0) {message.success('账户注销成功');@@ -345,7 +244,7 @@ export default function ProfilePage() {router.push('/login');}} catch (error) {-+} finally {setCancelLoading(false);}@@ -460,7 +359,7 @@ export default function ProfilePage() {userId: userInfo?.id || ''}});-+if (response?.code === 0 && response.data && typeof response.data === 'object' && 'url' in response.data) {// 保存订单IDif ('id' in response.data) {@@ -488,7 +387,7 @@ export default function ProfilePage() {// 处理"我已支付"按钮点击const handlePaymentSuccess = async () => {if (!paymentOrderId) return;-+try {const response = await getOrderDetailApi(paymentOrderId);if (response?.code === 0 && response.data) {@@ -531,10 +430,10 @@ export default function ProfilePage() {const handleSliderMouseMove = (e: MouseEvent) => {if (!isDragging) return;-+const sliderTrack = document.querySelector(`.${styles.sliderTrack}`) as HTMLElement;if (!sliderTrack) return;-+const rect = sliderTrack.getBoundingClientRect();const x = e.clientX - rect.left;const percentage = Math.max(0, Math.min(1, x / rect.width));@@ -557,181 +456,6 @@ export default function ProfilePage() {setRechargeAmount(newAmount);};- // 订单状态标签- const getOrderStatusTag = (status: OrderStatus) => {- const statusMap = {- [OrderStatus.SUCCEEDED]: { color: 'green', text: t('paymentSuccess') },- [OrderStatus.CREATED]: { color: 'orange', text: t('waitingForPayment') },- [OrderStatus.REFUNDED]: { color: 'purple', text: t('refundSuccess') },- [OrderStatus.EXPIRED]: { color: 'red', text: t('orderCancelled') }- };- const config = statusMap[status] || { color: 'default', text: `状态${status}` };- return <Tag color={config.color}>{config.text}</Tag>;- };-- // 获取套餐类型显示文本- const getPaymentTypeText = (paymentType: string) => {- const typeMap = {- [PaymentType.MONTH]: t('monthlySubscription'),- [PaymentType.YEAR]: t('yearlySubscription'),- [PaymentType.ONCE_MONTH]: t('oneTimeMonthly'),- [PaymentType.ONCE_YEAR]: t('oneTimeYearly')- };- return typeMap[paymentType as PaymentType] || paymentType || t('unknown');- };-- // 订单表格列- const orderColumns = [- {- title: t('orderId'),- dataIndex: 'id',- key: 'id',- ellipsis: true,- width: 200,- },- {- title: t('packageType'),- dataIndex: 'metadata',- key: 'payment',- render: (metadata: any) => {- const paymentType = metadata?.payment;- return getPaymentTypeText(paymentType);- },- },- {- title: t('amount'),- dataIndex: 'amount',- key: 'amount',- render: (amount: number, record: Order) => {- const displayAmount = (amount / 100).toFixed(2); // Stripe金额通常以分为单位- const symbol = record.currency === 'usd' ? '$' : record.currency === 'cny' ? '¥' : record.currency?.toUpperCase();- return `${symbol}${displayAmount}`;- },- },- {- title: t('status'),- dataIndex: 'status',- key: 'status',- render: (status: OrderStatus) => getOrderStatusTag(status),- },- {- title: t('createTime'),- dataIndex: 'created',- key: 'created',- render: (timestamp: number) => new Date(timestamp * 1000).toLocaleString(),- },- {- title: t('expireTime'),- dataIndex: 'expires_at',- key: 'expires_at',- render: (timestamp: number) => new Date(timestamp * 1000).toLocaleString(),- },- {- title: t('actions'),- key: 'action',- render: (_: any, record: Order) => (- <Space>- <Button- type="link"- size="small"- onClick={(e) => {- e.stopPropagation(); // 阻止行点击事件- fetchOrderDetail(record.id);- }}- >- {t('viewDetails')}- </Button>-- {record.url && record.status === OrderStatus.CREATED && (- <Button- type="link"- size="small"- onClick={(e) => {- e.stopPropagation(); // 阻止行点击事件- window.open(record.url, '_blank');- }}- >- {t('goToPay')}- </Button>- )}- </Space>- ),- },- ];-- // 订阅表格列- const subscriptionColumns = [- {- title: t('subscriptionId'),- dataIndex: 'id',- key: 'id',- ellipsis: true,- },- {- title: t('packageType'),- dataIndex: 'metadata',- key: 'payment',- render: (metadata: any) => {- const paymentType = metadata?.payment;- return getPaymentTypeText(paymentType);- },- },- // {- // title: '金额',- // dataIndex: 'amount',- // key: 'amount',- // render: (amount: number, record: Order) => {- // const displayAmount = (amount / 100).toFixed(2); // Stripe金额通常以分为单位- // const symbol = record.currency === 'usd' ? '$' : record.currency === 'cny' ? '¥' : record.currency?.toUpperCase();- // return `${symbol}${displayAmount}`;- // },- // },- {- title: t('status'),- dataIndex: 'status',- key: 'status',- render: (status: OrderStatus) => {- const statusMap = {- 1: { color: 'green', text: t('subscriptionSuccess') },- 2: { color: 'red', text: t('subscriptionCancelled') },- 3: { color: 'purple', text: t('refundSuccess') },- 4: { color: 'orange', text: t('orderCancelled') }- };- const config = statusMap[status] || { color: 'default', text: `状态${status}` };- return <Tag color={config.color}>{config.text}</Tag>;- },- },- {- title: t('createTime'),- dataIndex: 'created',- key: 'created',- render: (timestamp: number) => new Date(timestamp * 1000).toLocaleString(),- },- // {- // title: '过期时间',- // dataIndex: 'expires_at',- // key: 'expires_at',- // render: (timestamp: number) => new Date(timestamp * 1000).toLocaleString(),- // },- {- title: t('actions'),- key: 'action',- render: (_: any, record: Order) => (- <Space>- {record.status === 1 && (- <Popconfirm- title={t('cancelSubscriptionConfirm')}- onConfirm={() => handleUnsubscribe(record)}- okText={t('confirm')}- cancelText={t('cancel')}- >- <Button type="link" danger size="small">{t('cancelSubscription')}</Button>- </Popconfirm>- )}- </Space>- ),- },- ];// 积分记录表格列const pointsColumns = [@@ -771,7 +495,7 @@ export default function ProfilePage() {'expire': { color: 'orange', text: t('points.expire' as any) }};const config = typeMap[type] || { color: 'default', text: type };- return <Tag color={config.color}>{config.text}</Tag>;+ return <span style={{ color: config.color, fontWeight: 'bold' }}>{config.text}</span>;},},{@@ -782,19 +506,19 @@ export default function ProfilePage() {},];-+// 个人信息内容const renderProfileContent = () => (- <div style={{ }}>+ <div style={{}}>{/* 顶部头部卡片 */}- <div className={styles.headerCard}>- {/* VIP 提示(已是VIP时显示) */}- {isVip && (++ {/* VIP 提示(已是VIP时显示) */}+ {isVip && (<div style={{display: 'flex',- alignItems: 'center',- justifyContent: 'center',+ alignItems: 'flex-start',+ justifyContent: 'flex-start',gap: 8,color: '#a66ae4',fontWeight: 700,@@ -804,68 +528,79 @@ export default function ProfilePage() {</div>)}- <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'flex-start', justifyContent: 'center', gap: 8 }}>- <div className={styles.avatar}>- <Image src={logoHesd} alt="Logo" className={styles.logoHesd} />- </div>- <div className={styles.nameBlock}>- <div className={styles.nameRow}>- <span>{userInfo?.name || '-'}</span>- <EditOutlined style={{ cursor: 'pointer', color: '#a66ae4' }} onClick={() => setIsModalOpen(true)} />+ <div className={styles.headerCard}>++ <div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8 }}>+ <div className={styles.avatar}>+ <Image src={logoHesd} alt="Logo" className={styles.logoHesd} /></div>- <div className={styles.subRow}>- <span>{userInfo?.mail || '-'}</span>+ <div className={styles.nameBlock}>+ <div className={styles.nameRow}>+ <span>{userInfo?.name || '-'}</span>+ <EditOutlined style={{ cursor: 'pointer', color: '#a66ae4' }} onClick={() => setIsModalOpen(true)} />+ </div>+ <div className={styles.subRow}>+ <span>{userInfo?.mail || '-'}</span>+ </div>+</div>- <div className={styles.scoreRowThis}>- <span className={styles.scoreLabel}>{t('inviteCode' as any)}</span>- <span className={styles.scoreValue}>{userInfo?.popularizeCode || '-'}</span>- <CopyOutlined- style={{ color: '#a66ae4', cursor: 'pointer' }}- onClick={() => {- const code = userInfo?.popularizeCode || '';- if (!code) return;- navigator.clipboard?.writeText(code).then(() => {- message.success(t('copySuccess' as any));- }).catch(() => {- message.success(t('copySuccess' as any));- });- }}- />- </div></div>- </div>-+<div className={styles.scoreRow}>--++</div></div>--{/* 深色统计卡片 */}<div className={styles.statsCard}><div className={styles.statsHeader}>- <Image src={plusvip} alt="VIP" className={styles.vipBadge} />+ <Image src={plusvip} alt="VIP" className={styles.vipBadge} /><span className={styles.statsTitle}>{t('stats.totalEarned' as any)}</span><span className={styles.statsAmount}>{((userInfo as any)?.totalIncome ?? 0).toFixed(2)}</span><span className={styles.statsCurrency}>{t('stats.currencyYuan' as any)}</span></div><div className={styles.statsGrid}>- <div className={styles.statsItem} onClick={() => router.push('/income')} >-- <div className={styles.statsLabel}>{t('stats.balance' as any)} <span className={styles.statsValue}> {(userInfo?.income || 0).toFixed(2) } </span> CNY</div>+ <div className={styles.statsItem} onClick={() => router.push('/income')} >++ <div className={styles.statsLabel}>{t('stats.balance' as any)} <span className={styles.statsValue}> {(userInfo?.income || 0).toFixed(2)} </span> CNY</div></div>- <div className={styles.statsItem} style={{cursor:'pointer'}} onClick={() => setPointsDetailVisible(true)}>-- <div className={styles.statsLabel}>{t('stats.points' as any)} <span className={styles.statsValue}>{(Math.floor((userInfo?.score as number) || 0)).toFixed(1) } </span> {t('stats.points' as any)}</div>+ <div className={styles.statsItem} style={{ cursor: 'pointer' }} onClick={() => setPointsDetailVisible(true)}>++ <div className={styles.statsLabel}>{t('stats.points' as any)} <span className={styles.statsValue}>{(Math.floor((userInfo?.score as number) || 0)).toFixed(1)} </span> {t('stats.points' as any)}</div></div>-+</div></div>+ <div className={styles.editCard}>+ <div style={{display: 'flex', flexDirection: 'column', alignItems: 'flex-start'}}>+ <span className={styles.scoreLabel}>{t('username')}</span>+ <div className={styles.fieldContainer}>+ <span className={styles.fieldInput}>{userInfo?.name || '-'}</span>+ <button className={styles.fieldButton} onClick={() => setIsModalOpen(true)}>{t('edit' as any)}</button>+ </div>+ </div>+ <div style={{display: 'flex', flexDirection: 'column', alignItems: 'flex-start'}}>+ <span className={styles.scoreLabel}>{t('inviteCode' as any)}</span>+ <div className={styles.fieldContainer}>+ <span className={styles.fieldInput}>{userInfo?.popularizeCode || '-'}</span>+ <button className={styles.fieldButton} onClick={() => {+ const code = userInfo?.popularizeCode || '';+ if (!code) return;+ navigator.clipboard?.writeText(code).then(() => {+ message.success(t('copySuccess' as any));+ }).catch(() => {+ message.success(t('copySuccess' as any));+ });+ }}>{t('copy' as any)}</button>+ </div>+ </div>+ </div>++{/* 账号状态(仅非正常时显示) */}{userInfo?.status !== 1 && (<div style={{@@ -891,70 +626,6 @@ export default function ProfilePage() {</div>);- // 订单管理内容- const renderOrderContent = () => (- <div className={styles.orderContent}>- <Tabs defaultActiveKey="orders">- <TabPane tab={t('myOrders')} key="orders">- <Card>- <Table- columns={orderColumns}- dataSource={orders}- loading={ordersLoading}- rowKey="_id"- onRow={(record) => ({- onClick: () => {- fetchOrderDetail(record.id);- },- style: { cursor: 'pointer' }- })}- pagination={{- current: ordersPagination.current,- pageSize: ordersPagination.pageSize,- total: ordersPagination.total,- onChange: (page, size) => {- fetchOrders({ page: page - 1, size: size || 10 });- },- showSizeChanger: true,- showQuickJumper: true,- showTotal: (total) => t('totalRecords', { total }),- pageSizeOptions: ['10', '20', '50'],- }}- scroll={{ x: 1200 }} // 添加横向滚动以适应更多列- locale={{- emptyText: ordersLoading ? t('loading') : t('noOrderRecords')- }}- />- </Card>- </TabPane>- <TabPane tab={t('mySubscriptions')} key="subscriptions">- <Card>- <Table- columns={subscriptionColumns}- dataSource={subscriptions}- loading={subscriptionsLoading}- rowKey="id"- pagination={{- current: subscriptionsPagination.current,- pageSize: subscriptionsPagination.pageSize,- total: subscriptionsPagination.total,- onChange: (page, size) => {- fetchSubscriptions({ page: page - 1, size: size || 10 });- },- showSizeChanger: true,- showQuickJumper: true,- showTotal: (total) => t('totalRecords', { total }),- pageSizeOptions: ['10', '20', '50'],- }}- locale={{- emptyText: subscriptionsLoading ? t('loading') : t('noSubscriptionRecords')- }}- />- </Card>- </TabPane>- </Tabs>- </div>- );if (loading) {@@ -963,42 +634,9 @@ export default function ProfilePage() {return (<div className={styles.container}>- <Tabs- defaultActiveKey="profile"- size="large"- onChange={(key) => {- if (key === 'orders') {- fetchOrders({ page: 0, size: 10 });- fetchSubscriptions({ page: 0, size: 10 });- } else if (key === 'points') {- fetchPointsRecords({ page: 1, pageSize: 10 });- }- }}- >- <TabPane- tab={- <span>- <UserOutlined />- {t('personalInfo')}- </span>- }- key="profile"- >- {renderProfileContent()}- </TabPane>- {/* <TabPane- tab={- <span>- <ShoppingCartOutlined />- {t('orderManagement')}- </span>- }- key="orders"- >- {renderOrderContent()}- </TabPane> */}-- </Tabs>+ <div className={styles.profileContent}>+ {renderProfileContent()}+ </div><Modaltitle={t('modifyUsername')}@@ -1042,7 +680,7 @@ export default function ProfilePage() {{t('close')}</Button>,currentOrderDetail?.url && currentOrderDetail?.status === OrderStatus.CREATED && (- <Button+ <Buttonkey="pay"type="primary"onClick={() => {@@ -1063,29 +701,38 @@ export default function ProfilePage() {<Descriptions.Item label={t('orderId')}>{currentOrderDetail.id}</Descriptions.Item><Descriptions.Item label={t('internalId')}>{currentOrderDetail._id}</Descriptions.Item><Descriptions.Item label={t('packageType')}>- {getPaymentTypeText(currentOrderDetail.metadata?.payment)}+ {currentOrderDetail.metadata?.payment || t('unknown')}</Descriptions.Item><Descriptions.Item label={t('subscriptionMode')}>{currentOrderDetail.mode}</Descriptions.Item><Descriptions.Item label={t('amount')}>{(() => {const displayAmount = (currentOrderDetail.amount / 100).toFixed(2);- const symbol = currentOrderDetail.currency === 'usd' ? '$' :- currentOrderDetail.currency === 'cny' ? '¥' :- currentOrderDetail.currency?.toUpperCase();+ const symbol = currentOrderDetail.currency === 'usd' ? '$' :+ currentOrderDetail.currency === 'cny' ? '¥' :+ currentOrderDetail.currency?.toUpperCase();return `${symbol}${displayAmount}`;})()}</Descriptions.Item><Descriptions.Item label={t('refundedAmount')}>{(() => {const displayAmount = (currentOrderDetail.amount_refunded / 100).toFixed(2);- const symbol = currentOrderDetail.currency === 'usd' ? '$' :- currentOrderDetail.currency === 'cny' ? '¥' :- currentOrderDetail.currency?.toUpperCase();+ const symbol = currentOrderDetail.currency === 'usd' ? '$' :+ currentOrderDetail.currency === 'cny' ? '¥' :+ currentOrderDetail.currency?.toUpperCase();return `${symbol}${displayAmount}`;})()}</Descriptions.Item><Descriptions.Item label={t('status')}>- {getOrderStatusTag(currentOrderDetail.status)}+ {(() => {+ const statusMap = {+ [OrderStatus.SUCCEEDED]: { color: 'green', text: t('paymentSuccess') },+ [OrderStatus.CREATED]: { color: 'orange', text: t('waitingForPayment') },+ [OrderStatus.REFUNDED]: { color: 'purple', text: t('refundSuccess') },+ [OrderStatus.EXPIRED]: { color: 'red', text: t('orderCancelled') }+ };+ const config = statusMap[currentOrderDetail.status] || { color: 'default', text: `状态${currentOrderDetail.status}` };+ return <span style={{ color: config.color, fontWeight: 'bold' }}>{config.text}</span>;+ })()}</Descriptions.Item><Descriptions.Item label={t('createTime')}>{new Date(currentOrderDetail.created * 1000).toLocaleString()}@@ -1104,8 +751,8 @@ export default function ProfilePage() {{/* <Descriptions.Item label="成功页面">{currentOrderDetail.success_url}</Descriptions.Item> */}{currentOrderDetail.url && (<Descriptions.Item label={t('paymentLink')}>- <Button- type="link"+ <Button+ type="link"size="small"onClick={() => window.open(currentOrderDetail.url, '_blank')}>@@ -1156,10 +803,10 @@ export default function ProfilePage() {<p style={{ color: '#6b7280', lineHeight: '1.6', marginBottom: '20px' }}>{t('freeTrial.description')}</p>- <div style={{- background: '#f8fafc',- borderRadius: '12px',- padding: '16px',+ <div style={{+ background: '#f8fafc',+ borderRadius: '12px',+ padding: '16px',marginBottom: '20px',border: '1px solid #e2e8f0'}}>@@ -1189,7 +836,7 @@ export default function ProfilePage() {{/* 注销账户确认弹窗 */}<Modal- title="注销账户"+ title={t('cancelAccount' as any)}open={cancelModalVisible}onCancel={() => setCancelModalVisible(false)}footer={null}@@ -1198,52 +845,51 @@ export default function ProfilePage() {><div style={{ paddingTop: '20px' }}><div style={{ marginBottom: '20px', color: '#666', lineHeight: '1.6' }}>- <p>注销账户是不可逆的操作,一旦注销,您的所有数据将被永久删除,包括:</p>+ <p>{t('cancelAccountWarning' as any)}</p><ul style={{ margin: '10px 0', paddingLeft: '20px' }}>- <li>个人资料和设置</li>- <li>所有发布的内容</li>- <li>积分和会员权益</li>- <li>订单和支付记录</li>+ {(t('cancelAccountDataList' as any) as string).split(',').map((item, index) => (+ <li key={index}>{item}</li>+ ))}</ul>- <p style={{ color: '#ff4d4f', fontWeight: 'bold' }}>请谨慎操作!</p>- <p style={{ color: '#1890ff', fontSize: '14px' }}>为了您的账户安全,请先获取验证码进行身份验证。</p>+ <p style={{ color: '#ff4d4f', fontWeight: 'bold' }}>{t('cancelAccountCaution' as any)}</p>+ <p style={{ color: '#1890ff', fontSize: '14px' }}>{t('cancelAccountSecurity' as any)}</p></div>-+<Formform={cancelForm}layout="vertical"onFinish={handleCancelAccount}><Form.Item- label="验证码"+ label={t('verificationCode' as any)}name="code"- rules={[{ required: true, message: '请输入验证码' }]}+ rules={[{ required: true, message: t('pleaseEnterVerificationCode' as any) }]}><div style={{ display: 'flex', gap: '8px' }}>- <Input placeholder="请输入验证码" />- <Button- onClick={handleGetCancelCode}+ <Input placeholder={t('pleaseEnterVerificationCode' as any)} />+ <Button+ onClick={handleGetCancelCode}disabled={codeCountdown > 0}loading={codeCountdown > 0}>- {codeCountdown > 0 ? `${codeCountdown}s后重发` : '获取验证码'}+ {codeCountdown > 0 ? `${codeCountdown}${t('resendAfter' as any)}` : t('getVerificationCode' as any)}</Button></div></Form.Item>--++<Form.Item><div style={{ display: 'flex', gap: '12px', justifyContent: 'flex-end' }}><Button onClick={() => setCancelModalVisible(false)}>- 取消+ {t('cancel')}</Button>- <Button- type="primary"- danger- htmlType="submit"+ <Button+ type="primary"+ danger+ htmlType="submit"loading={cancelLoading}>- 确认注销+ {t('confirmCancel' as any)}</Button></div></Form.Item>diff --git a/src/app/[lng]/profile/profile.module.css b/src/app/[lng]/profile/profile.module.cssindex cf6cb03d..e063b2de 100644--- a/src/app/[lng]/profile/profile.module.css+++ b/src/app/[lng]/profile/profile.module.css@@ -1,5 +1,14 @@.container {padding: 24px;+ display: flex;+ justify-content: center;+ min-height: 80vh;+ margin-top: 80px;+}++.profileContent {+ max-width: 800px;+ width: 100%;}.card {@@ -909,17 +918,19 @@/* 顶部头部信息卡片 */.headerCard {+ background-color: #F7F8FA;border-radius: 16px;- padding: 20px 0px;+ padding: 20px 30px;display: flex;- flex-direction: column;+ justify-content: center;align-items: flex-start;gap: 16px;+ margin-top: 18px;}.avatar {- width: 68px;- height: 68px;+ width: 90px;+ height: 90px;border-radius: 50%;overflow: hidden;background: #e9d5ff;@@ -938,6 +949,7 @@align-items: flex-start;gap: 4px;margin-top: 5px;+ margin-left: 10px;}.nameRow {@@ -978,7 +990,7 @@.scoreRowThis {display: flex;- flex-direction: row;+ flex-direction: column;align-items: baseline;gap: 8px;margin-top: 2px;@@ -993,10 +1005,8 @@margin-top: 2px;font-weight: 600;font-size: 18px;- background: linear-gradient(135deg, #a66ae4, #8b5cf6);- -webkit-background-clip: text;- -webkit-text-fill-color: transparent;- background-clip: text;+ background: #F2F3F5;+}/* 深色统计卡片 */@@ -1006,6 +1016,7 @@color: #e5e7eb;border: 1px solid rgba(255,255,255,0.06);overflow: hidden;+ margin-top: 20px;}.statsHeader {@@ -1040,8 +1051,8 @@}.logoHesd {- width: 38px;- height: 38px;+ width: 68px;+ height: 68px;}.statsItem {@@ -1192,4 +1203,67 @@.incomeButton:focus {outline: none;box-shadow: 0 0 0 3px rgba(166, 106, 228, 0.35), 0 2px 8px rgba(166, 106, 228, 0.35);+}++/* Edit Card 样式 */+.editCard {+ background: white;+ border-radius: 12px;+ padding: 24px 0;+}++.editCard > div {+ display: flex;+ flex-direction: row;+ align-items: center;+ justify-content: space-between;+ margin-bottom: 35px;+}++.editCard > div:last-child {+ margin-bottom: 0;+}++.editCard .scoreLabel {+ font-weight: 600;+ font-size: 16px;+ color: #374151;+ min-width: 60px;+}++.editCard .fieldContainer {+ display: flex;+ align-items: center;+ gap: 12px;+ flex: 1;+ margin-top: 10px;+ width: 100%;+}++.editCard .fieldInput {+ flex: 1;+ background-color: #F2F3F5;+ padding: 15px 12px;+ border-radius: 8px;+ border: none;+ color: #374151;+ font-size: 14px;+ min-width: 200px;+}++.editCard .fieldButton {+ color: #424A57;+ cursor: pointer;+ font-size: 14px;+ font-weight: 600;+ padding: 15px 16px;+ background-color: #F2F3F5;+ border-radius: 8px;+ border: none;+ transition: all 0.2s ease;+}++.editCard .fieldButton:hover {+ background-color: #e2e8f0;+ color: #8b5cf6;}\ No newline at end of filediff --git a/src/app/i18n/locales/en/profile.json b/src/app/i18n/locales/en/profile.jsonindex a050922d..1369539d 100644--- a/src/app/i18n/locales/en/profile.json+++ b/src/app/i18n/locales/en/profile.json@@ -150,7 +150,19 @@},"vipHonorText": "VIP Member","inviteCode": "Invite Code",+ "edit": "Edit",+ "copy": "Copy","copySuccess": "Copied",+ "cancelAccount": "Cancel Account",+ "cancelAccountWarning": "Account cancellation is irreversible. Once cancelled, all your data will be permanently deleted, including:",+ "cancelAccountDataList": "Personal profile and settings,All published content,Points and membership benefits,Order and payment records",+ "cancelAccountCaution": "Please proceed with caution!",+ "cancelAccountSecurity": "For your account security, please get a verification code for identity verification first.",+ "verificationCode": "Verification Code",+ "pleaseEnterVerificationCode": "Please enter verification code",+ "getVerificationCode": "Get Verification Code",+ "resendAfter": "s before resend",+ "confirmCancel": "Confirm Cancellation","stats": {"totalEarned": "Total Earned","balance": "Balance",diff --git a/src/app/i18n/locales/zh-CN/profile.json b/src/app/i18n/locales/zh-CN/profile.jsonindex 2c389eff..4b13f6fb 100644--- a/src/app/i18n/locales/zh-CN/profile.json+++ b/src/app/i18n/locales/zh-CN/profile.json@@ -150,7 +150,19 @@},"vipHonorText": "您是尊贵的VIP用户","inviteCode": "邀请码",+ "edit": "编辑",+ "copy": "复制","copySuccess": "已复制",+ "cancelAccount": "注销账户",+ "cancelAccountWarning": "注销账户是不可逆的操作,一旦注销,您的所有数据将被永久删除,包括:",+ "cancelAccountDataList": "个人资料和设置,所有发布的内容,积分和会员权益,订单和支付记录",+ "cancelAccountCaution": "请谨慎操作!",+ "cancelAccountSecurity": "为了您的账户安全,请先获取验证码进行身份验证。",+ "verificationCode": "验证码",+ "pleaseEnterVerificationCode": "请输入验证码",+ "getVerificationCode": "获取验证码",+ "resendAfter": "s后重发",+ "confirmCancel": "确认注销","stats": {"totalEarned": "累计赚钱","balance": "当前余额",