diff --git a/apps/user/app/(main)/(content)/(user)/dashboard/content.tsx b/apps/user/app/(main)/(content)/(user)/dashboard/content.tsx index 53688e7..2791295 100644 --- a/apps/user/app/(main)/(content)/(user)/dashboard/content.tsx +++ b/apps/user/app/(main)/(content)/(user)/dashboard/content.tsx @@ -5,6 +5,7 @@ import Recharge from '@/components/subscribe/recharge'; import Renewal from '@/components/subscribe/renewal'; import ResetTraffic from '@/components/subscribe/reset-traffic'; import useGlobalStore from '@/config/use-global'; +import { getStat } from '@/services/common/common'; import { queryUserSubscribe, resetUserSubscribeToken } from '@/services/user/user'; import { useQuery } from '@tanstack/react-query'; import { Button } from '@workspace/airo-ui/components/button'; @@ -136,11 +137,9 @@ export default function Content() { {/* 账户概况 Card */}
- {userSubscribe?.[0]?.status === 1 ? ( -

- {t('accountOverview')} -

- ) : null} +

+ {t('accountOverview')} +

{user?.auth_methods?.[0]?.auth_identifier}

@@ -148,7 +147,7 @@ export default function Content() {
- {t('annualPlanUser')} + {userSubscribe?.length > 0 ?
1
: t('noYPlan')}
@@ -173,9 +172,11 @@ export default function Content() {

{t('planStatus')} - - {t('inEffect')} - + {userSubscribe?.length > 0 && userSubscribe?.[0]?.status === 1 ? ( + + {t('inEffect')} + + ) : null}

-
- {t('planExpirationTime')} - {formatDate(userSubscribe?.[0]?.expire_time, false)} -
-
- - {userSubscribe?.[0]?.subscribe.name} - -
- -
-
- {t('availableDevices')} -
- {Array.from({ length: userSubscribe?.[0]?.subscribe.device_limit }).map( - (_, index) => { - return ( -
1 ? 'bg-[#225BA9]' : 'bg-[#D9D9D9]'}`} - >
- ); - }, - )} + {userSubscribe?.length ? ( + <> +
+ {t('planExpirationTime')} + {formatDate(userSubscribe?.[0]?.expire_time, false)}
-
- - {t('online')} - {userSubscribe?.[0]?.subscribe.device_limit} - -
-
-
- - {t('usedTrafficTotalTraffic')} - - /{' '} - - - - {t('remaining')} - {100 - - Math.round( - (((userSubscribe?.[0]?.upload || 0) + (userSubscribe?.[0]?.download || 0)) / - (userSubscribe?.[0]?.traffic || 1)) * - 100, - )} - % - -
-
-
-
-
+
+ + {userSubscribe?.[0]?.subscribe.name} + +
+
+
+ {t('availableDevices')} +
+ {Array.from({ length: userSubscribe?.[0]?.subscribe.device_limit }).map( + (_, index) => { + return ( +
1 ? 'bg-[#225BA9]' : 'bg-[#D9D9D9]'}`} + >
+ ); + }, + )} +
+
+ + {t('online')} + {userSubscribe?.[0]?.subscribe.device_limit} + +
+
+
+ + {t('usedTrafficTotalTraffic')} + + /{' '} + + + + {t('remaining')} + {100 - + Math.round( + (((userSubscribe?.[0]?.upload || 0) + (userSubscribe?.[0]?.download || 0)) / + (userSubscribe?.[0]?.traffic || 1)) * + 100, + )} + % + +
+
+
+
+
+ + ) : ( +
{t('noPlanAvailable')}
+ )} {/* 网站公告 Card */} @@ -339,7 +346,7 @@ export default function Content() { {t('nextResetDays')}

- {userSubscribe?.[0] + {userSubscribe?.[0].reset_time ? differenceInDays(new Date(userSubscribe?.[0].reset_time), new Date()) : t('noReset')}

diff --git a/apps/user/app/(main)/(content)/(user)/order/page.tsx b/apps/user/app/(main)/(content)/(user)/order/page.tsx index efe9961..844e948 100644 --- a/apps/user/app/(main)/(content)/(user)/order/page.tsx +++ b/apps/user/app/(main)/(content)/(user)/order/page.tsx @@ -19,7 +19,7 @@ export default function Page() { const ref = useRef(null); const OrderDetailDialogRef = useRef(null); - const handlePayment = (orderNo) => { + const handlePayment = async (orderNo) => { const data = await purchaseCheckout({ orderNo: orderNo, returnUrl: window.location.href, diff --git a/apps/user/locales/en-US/dashboard.json b/apps/user/locales/en-US/dashboard.json index 473fc6a..8a8c783 100644 --- a/apps/user/locales/en-US/dashboard.json +++ b/apps/user/locales/en-US/dashboard.json @@ -3,7 +3,8 @@ "accountOverview": "Account Overview", "address1": "Address 1", "announcementTitle": "Site Announcements", - "annualPlanUser": "Annual Plan User", + "annualMonthPlanUser": "Monthly Plan User", + "annualYearPlanUser": "Annual Plan User", "availableDevices": "Available Devices", "beginnerTutorial": "Beginner Tutorial", "cancel": "Cancel", @@ -28,7 +29,9 @@ "mySubscriptions": "My Subscriptions", "nextResetDays": "Next Reset in Days", "noLimit": "No Limit", + "noPlanAvailable": "No Plan Available", "noReset": "No Reset", + "noYPlan": "No Plan Active", "online": "Online: ", "pageOf": "Page {pageIndex} of {pageCount}", "pinnedAnnouncement": "[Pinned]", diff --git a/apps/user/locales/zh-CN/dashboard.json b/apps/user/locales/zh-CN/dashboard.json index 348e73f..52cbfc6 100644 --- a/apps/user/locales/zh-CN/dashboard.json +++ b/apps/user/locales/zh-CN/dashboard.json @@ -3,7 +3,8 @@ "accountOverview": "账户概况", "address1": "地址1", "announcementTitle": "网站公告", - "annualPlanUser": "年度套餐用户", + "annualMonthPlanUser": "月度套餐用户", + "annualYearPlanUser": "年度套餐用户", "availableDevices": "可用设备", "beginnerTutorial": "新手教程", "cancel": "取消", @@ -28,7 +29,9 @@ "mySubscriptions": "我的订阅", "nextResetDays": "下次重置/天", "noLimit": "无限制", + "noPlanAvailable": "暂无套餐", "noReset": "不重置", + "noYPlan": "尚未有套餐生效", "online": "在线:", "pageOf": "第 {pageIndex} 页,共 {pageCount} 页", "pinnedAnnouncement": "【置顶公告】",