From 844b755f20d6c20604b6d0b74be7e97cdc8fecbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E4=B8=81?= Date: Thu, 9 Jul 2026 02:42:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E8=B5=84=E4=BA=A7?= =?UTF-8?q?=E6=9B=B2=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/assetCurve.ts | 43 +++++ src/components/AssetCurveCard.vue | 269 ++++++++++++++++++++++++++++++ src/locales/en.json | 14 +- src/locales/ja.json | 14 +- src/locales/ko.json | 14 +- src/locales/zh-CN.json | 14 +- src/locales/zh-TW.json | 14 +- src/views/Profile.vue | 3 + 8 files changed, 380 insertions(+), 5 deletions(-) create mode 100644 src/api/assetCurve.ts create mode 100644 src/components/AssetCurveCard.vue diff --git a/src/api/assetCurve.ts b/src/api/assetCurve.ts new file mode 100644 index 0000000..9179a32 --- /dev/null +++ b/src/api/assetCurve.ts @@ -0,0 +1,43 @@ +import { get } from './request' +import type { ApiResponse } from './types' + +export type AssetCurveRange = '1D' | '1W' | '1M' | '1Y' | 'YTD' | 'ALL' + +export interface AssetCurvePoint { + ts: number + totalAsset: number + isRealtime?: boolean +} + +export interface AssetCurveData { + range: AssetCurveRange + startTs: number + endTs: number + currentAsset: number + changeAmount: number + changePercent: number + noHistory: boolean + points: AssetCurvePoint[] +} + +export interface AssetCurveResponse extends ApiResponse { + data: AssetCurveData +} + +/** + * GET /uas/getAssetCurveClient + * 获取用户资产曲线 + */ +export async function getAssetCurve( + range: AssetCurveRange, + config?: { headers?: Record }, +): Promise { + return get('/uas/getAssetCurveClient', { range }, config) +} + +export const ASSET_CURVE_RANGES: AssetCurveRange[] = ['1D', '1W', '1M', '1Y', 'YTD', 'ALL'] + +export function formatAssetChange(amount: number, percent: number): string { + const sign = amount >= 0 ? '+' : '' + return `${sign}$${Math.abs(amount).toFixed(2)} (${sign}${Math.abs(percent).toFixed(2)}%)` +} diff --git a/src/components/AssetCurveCard.vue b/src/components/AssetCurveCard.vue new file mode 100644 index 0000000..671bf51 --- /dev/null +++ b/src/components/AssetCurveCard.vue @@ -0,0 +1,269 @@ + + + + + diff --git a/src/locales/en.json b/src/locales/en.json index af6cab8..30468a2 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -362,7 +362,19 @@ "avatarUploadFailed": "Failed to upload avatar", "memberCenter": "Member Center", "depositCoin": "Deposit", - "withdrawCoin": "Withdraw" + "withdrawCoin": "Withdraw", + "assetCurve": { + "title": "Asset Trend", + "loadFailed": "Failed to load asset curve", + "range": { + "1D": "1D", + "1W": "1W", + "1M": "1M", + "1Y": "1Y", + "YTD": "YTD", + "ALL": "All" + } + } }, "memberCenter": { "title": "Member Center", diff --git a/src/locales/ja.json b/src/locales/ja.json index 8a960cf..67bb97b 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -362,7 +362,19 @@ "avatarUploadFailed": "アバターのアップロードに失敗しました", "memberCenter": "メンバー", "depositCoin": "入金", - "withdrawCoin": "出金" + "withdrawCoin": "出金", + "assetCurve": { + "title": "資産推移", + "loadFailed": "資産曲線の読み込みに失敗しました", + "range": { + "1D": "1日", + "1W": "1週", + "1M": "1月", + "1Y": "1年", + "YTD": "年初来", + "ALL": "すべて" + } + } }, "memberCenter": { "title": "メンバーセンター", diff --git a/src/locales/ko.json b/src/locales/ko.json index 0b9c12f..dcf03ab 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -362,7 +362,19 @@ "avatarUploadFailed": "아바타 업로드에 실패했습니다", "memberCenter": "멤버십", "depositCoin": "입금", - "withdrawCoin": "출금" + "withdrawCoin": "출금", + "assetCurve": { + "title": "자산 추이", + "loadFailed": "자산 곡선을 불러오지 못했습니다", + "range": { + "1D": "1일", + "1W": "1주", + "1M": "1개월", + "1Y": "1년", + "YTD": "연초 이후", + "ALL": "전체" + } + } }, "memberCenter": { "title": "멤버 센터", diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index c7b6cb8..6c144d0 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -362,7 +362,19 @@ "avatarUploadFailed": "头像上传失败", "memberCenter": "会员中心", "depositCoin": "充币", - "withdrawCoin": "提币" + "withdrawCoin": "提币", + "assetCurve": { + "title": "资产走势", + "loadFailed": "资产曲线加载失败", + "range": { + "1D": "1天", + "1W": "1周", + "1M": "1月", + "1Y": "1年", + "YTD": "年初至今", + "ALL": "全部" + } + } }, "memberCenter": { "title": "会员中心", diff --git a/src/locales/zh-TW.json b/src/locales/zh-TW.json index bb21fa1..25f9fc7 100644 --- a/src/locales/zh-TW.json +++ b/src/locales/zh-TW.json @@ -362,7 +362,19 @@ "avatarUploadFailed": "頭像上傳失敗", "memberCenter": "會員中心", "depositCoin": "充幣", - "withdrawCoin": "提幣" + "withdrawCoin": "提幣", + "assetCurve": { + "title": "資產走勢", + "loadFailed": "資產曲線載入失敗", + "range": { + "1D": "1天", + "1W": "1週", + "1M": "1月", + "1Y": "1年", + "YTD": "年初至今", + "ALL": "全部" + } + } }, "memberCenter": { "title": "會員中心", diff --git a/src/views/Profile.vue b/src/views/Profile.vue index cd4f522..7442d66 100644 --- a/src/views/Profile.vue +++ b/src/views/Profile.vue @@ -33,6 +33,8 @@ --> + +
{{ t('profile.walletOverview') }} @@ -134,6 +136,7 @@ import { useUserStore, type UserInfo } from '../stores/user' import { setSelfUsername, setSelfHeaderImg } from '@/api/user' import { getLockMoney } from '@/api/earnActivity' import { upload } from '@/api/fileUpload' +import AssetCurveCard from '@/components/AssetCurveCard.vue' import type { LocaleCode } from '@/plugins/i18n' interface SettingItem {