From c8cb4500a3699f5fc997ae13dba4b947acee0845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E4=B8=81?= Date: Sun, 26 Jul 2026 20:32:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E9=92=B1=E5=8C=85?= =?UTF-8?q?=20History=20=E9=BB=98=E8=AE=A4=E5=B1=95=E7=A4=BA=E5=B9=B6?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98=E5=88=B0=E6=9C=9F=EF=BC=8C?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=AD=9B=E9=80=89=E4=B8=8E=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- src/api/historyRecord.ts | 28 +- src/components/WalletDateRangePicker.vue | 610 +++++++++++++++++++++++ src/locales/en.json | 20 + src/locales/ja.json | 20 + src/locales/ko.json | 20 + src/locales/zh-CN.json | 20 + src/locales/zh-TW.json | 20 + src/views/Wallet.vue | 279 ++++++++++- 8 files changed, 1001 insertions(+), 16 deletions(-) create mode 100644 src/components/WalletDateRangePicker.vue diff --git a/src/api/historyRecord.ts b/src/api/historyRecord.ts index b5c8656..4f40693 100644 --- a/src/api/historyRecord.ts +++ b/src/api/historyRecord.ts @@ -52,6 +52,8 @@ export interface HistoryRecordItem { eventId?: number marketID?: string | number marketId?: string | number + /** 问题/事件到期时间(列表接口关联填充) */ + endDate?: string } /** GET /hr/getHistoryRecordPublic 请求参数 */ @@ -63,6 +65,8 @@ export interface GetHistoryRecordPublicParams { title?: string name?: string bio?: string + /** 记录类型:TRADE / SPLIT / MERGE 等 */ + type?: string createdAtRange?: string[] } @@ -76,6 +80,8 @@ export interface GetHistoryRecordListClientParams { title?: string name?: string bio?: string + /** 记录类型:TRADE / SPLIT / MERGE 等 */ + type?: string createdAtRange?: string[] isFunding?: boolean } @@ -111,7 +117,8 @@ export async function getHistoryRecordListClient( title: params.title, name: params.name, bio: params.bio, - createdAtRange: params.createdAtRange, + type: params.type, + 'createdAtRange[]': params.createdAtRange, isFunding: params.isFunding === undefined ? undefined : String(params.isFunding), }) return get('/hr/getHistoryRecordListClient', query, config) @@ -132,7 +139,8 @@ export async function getHistoryRecordPublic( title: params.title, name: params.name, bio: params.bio, - createdAtRange: params.createdAtRange, + type: params.type, + 'createdAtRange[]': params.createdAtRange, }) return get('/hr/getHistoryRecordPublic', query) } @@ -164,6 +172,8 @@ export interface HistoryDisplayItem { tradeEventSlug?: string /** 跳转详情 query.marketId */ detailMarketId?: string + /** 问题到期时间展示文案,如 "Jul 26, 2026" */ + expiresAt?: string } function formatTimeAgo(dateStr: string | undefined, timestamp?: number): string { @@ -179,6 +189,18 @@ function formatTimeAgo(dateStr: string | undefined, timestamp?: number): string return new Date(ms).toLocaleDateString() } +function formatExpiresAt(endDate: string | undefined): string { + if (!endDate) return '' + try { + const d = new Date(endDate) + return !Number.isNaN(d.getTime()) + ? d.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' }) + : endDate + } catch { + return endDate + } +} + /** 将相对路径转为完整 URL */ function toFullIconUrl(icon: string | undefined): string | undefined { if (!icon?.trim()) return undefined @@ -226,6 +248,7 @@ export function mapHistoryRecordToDisplayItem(record: HistoryRecordItem): Histor const rawMk = record.marketID ?? record.marketId const detailMarketId = rawMk != null && String(rawMk).trim() !== '' ? String(rawMk).trim() : undefined + const expiresAt = formatExpiresAt(record.endDate) return { id, market, @@ -244,6 +267,7 @@ export function mapHistoryRecordToDisplayItem(record: HistoryRecordItem): Histor tradeEventId: tradeEventId || undefined, tradeEventSlug: tradeEventSlug || undefined, detailMarketId, + expiresAt: expiresAt || undefined, } } diff --git a/src/components/WalletDateRangePicker.vue b/src/components/WalletDateRangePicker.vue new file mode 100644 index 0000000..41182ae --- /dev/null +++ b/src/components/WalletDateRangePicker.vue @@ -0,0 +1,610 @@ + + + + + diff --git a/src/locales/en.json b/src/locales/en.json index 67372fd..3cb84aa 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -272,6 +272,25 @@ "openOrders": "Open orders", "history": "History", "searchPlaceholder": "Search", + "searchEventPlaceholder": "Search", + "date": "Date", + "dateFrom": "Start date", + "dateTo": "End date", + "clearFilters": "Clear", + "clearDateRange": "Clear date range", + "setDate": "Set date", + "dateRangeHint": "Select start date, then end date", + "typeFilter": "Type", + "datePreset": { + "today": "Today", + "yesterday": "Yesterday", + "lastWeek": "Last week", + "lastMonth": "Last month", + "last3Months": "Last 3 months", + "ytd": "Year to date", + "lastYear": "Last year", + "all": "All" + }, "currentValue": "Current value", "closeLosses": "Close Losses", "all": "All", @@ -283,6 +302,7 @@ "noHistoryFound": "You haven't traded any polymarkets yet", "historySideBuy": "BUY", "historySideSell": "SELL", + "historyTypeTrade": "Trade", "historyTypeSplit": "SPLIT", "historyTypeMerge": "MERGE", "historyTypeRedeem": "REDEEM", diff --git a/src/locales/ja.json b/src/locales/ja.json index b03b922..52472ae 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -272,6 +272,25 @@ "openOrders": "未約定", "history": "履歴", "searchPlaceholder": "検索", + "searchEventPlaceholder": "検索", + "date": "日付", + "dateFrom": "開始日", + "dateTo": "終了日", + "clearFilters": "クリア", + "clearDateRange": "日付範囲をクリア", + "setDate": "日付を設定", + "dateRangeHint": "開始日を選び、続けて終了日を選んでください", + "typeFilter": "タイプ", + "datePreset": { + "today": "今日", + "yesterday": "昨日", + "lastWeek": "先週", + "lastMonth": "先月", + "last3Months": "直近3ヶ月", + "ytd": "年初来", + "lastYear": "昨年", + "all": "すべて" + }, "currentValue": "現在価値", "closeLosses": "損失決済", "all": "全て", @@ -283,6 +302,7 @@ "noHistoryFound": "まだ取引履歴がありません", "historySideBuy": "買い", "historySideSell": "売り", + "historyTypeTrade": "取引", "historyTypeSplit": "スプリット", "historyTypeMerge": "マージ", "historyTypeRedeem": "償還", diff --git a/src/locales/ko.json b/src/locales/ko.json index 7423315..c68ca5a 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -272,6 +272,25 @@ "openOrders": "미체결", "history": "내역", "searchPlaceholder": "검색", + "searchEventPlaceholder": "검색", + "date": "날짜", + "dateFrom": "시작일", + "dateTo": "종료일", + "clearFilters": "초기화", + "clearDateRange": "날짜 범위 지우기", + "setDate": "날짜 설정", + "dateRangeHint": "시작일을 선택한 뒤 종료일을 선택하세요", + "typeFilter": "유형", + "datePreset": { + "today": "오늘", + "yesterday": "어제", + "lastWeek": "지난주", + "lastMonth": "지난달", + "last3Months": "최근 3개월", + "ytd": "올해 누적", + "lastYear": "작년", + "all": "전체" + }, "currentValue": "현재 가치", "closeLosses": "손실 청산", "all": "전체", @@ -283,6 +302,7 @@ "noHistoryFound": "아직 거래 내역이 없습니다", "historySideBuy": "매수", "historySideSell": "매도", + "historyTypeTrade": "거래", "historyTypeSplit": "스플릿", "historyTypeMerge": "머지", "historyTypeRedeem": "상환", diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index 538ad16..19874d2 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -272,6 +272,25 @@ "openOrders": "未成交", "history": "历史", "searchPlaceholder": "搜索", + "searchEventPlaceholder": "搜索", + "date": "日期", + "dateFrom": "开始日期", + "dateTo": "结束日期", + "clearFilters": "清空", + "clearDateRange": "清空日期范围", + "setDate": "设置日期", + "dateRangeHint": "先点开始日期,再点结束日期", + "typeFilter": "类型", + "datePreset": { + "today": "今天", + "yesterday": "昨天", + "lastWeek": "上周", + "lastMonth": "上月", + "last3Months": "近 3 个月", + "ytd": "今年至今", + "lastYear": "去年", + "all": "全部" + }, "currentValue": "当前价值", "closeLosses": "平仓亏损", "all": "全部", @@ -283,6 +302,7 @@ "noHistoryFound": "您还未进行过任何交易", "historySideBuy": "买入", "historySideSell": "卖出", + "historyTypeTrade": "交易", "historyTypeSplit": "拆分", "historyTypeMerge": "合并", "historyTypeRedeem": "赎回", diff --git a/src/locales/zh-TW.json b/src/locales/zh-TW.json index 212a674..a170694 100644 --- a/src/locales/zh-TW.json +++ b/src/locales/zh-TW.json @@ -272,6 +272,25 @@ "openOrders": "未成交", "history": "歷史", "searchPlaceholder": "搜尋", + "searchEventPlaceholder": "搜尋", + "date": "日期", + "dateFrom": "開始日期", + "dateTo": "結束日期", + "clearFilters": "清空", + "clearDateRange": "清空日期範圍", + "setDate": "設定日期", + "dateRangeHint": "先點開始日期,再點結束日期", + "typeFilter": "類型", + "datePreset": { + "today": "今天", + "yesterday": "昨天", + "lastWeek": "上週", + "lastMonth": "上月", + "last3Months": "近 3 個月", + "ytd": "今年至今", + "lastYear": "去年", + "all": "全部" + }, "currentValue": "當前價值", "closeLosses": "平倉虧損", "all": "全部", @@ -283,6 +302,7 @@ "noHistoryFound": "您還未進行過任何交易", "historySideBuy": "買入", "historySideSell": "賣出", + "historyTypeTrade": "交易", "historyTypeSplit": "拆分", "historyTypeMerge": "合併", "historyTypeRedeem": "贖回", diff --git a/src/views/Wallet.vue b/src/views/Wallet.vue index 5624c6b..afced36 100644 --- a/src/views/Wallet.vue +++ b/src/views/Wallet.vue @@ -49,13 +49,62 @@
- - {{ t('wallet.positions') }} - {{ t('wallet.openOrders') }} - {{ t('wallet.history') }} - {{ t('deposit.depositHistory') }} - {{ t('wallet.withdrawals') }} - +
+ + {{ t('wallet.positions') }} + {{ t('wallet.openOrders') }} + {{ t('wallet.history') }} + {{ t('deposit.depositHistory') }} + {{ t('wallet.withdrawals') }} + +
+ + + + + + {{ opt.label }} + + + + + + {{ t('wallet.clearFilters') }} + +
+