新增:锁仓信息展示
This commit is contained in:
parent
10b271e3d8
commit
69c4223af1
@ -17,6 +17,23 @@ export interface GetPmEarnActivityPublicResponse extends ApiResponse<PmEarnActiv
|
|||||||
msg: string
|
msg: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 个人锁仓情况(polymarket.PmMoneyLock) */
|
||||||
|
export interface PmMoneyLock {
|
||||||
|
ID?: number
|
||||||
|
userId?: number
|
||||||
|
locked?: number
|
||||||
|
freeMoney?: number
|
||||||
|
unlockDate?: string
|
||||||
|
typeId?: number
|
||||||
|
[key: string]: unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GetLockMoneyResponse extends ApiResponse<PmMoneyLock> {
|
||||||
|
code: number
|
||||||
|
data?: PmMoneyLock
|
||||||
|
msg: string
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GET /pmEarnActivity/getPmEarnActivityPublic
|
* GET /pmEarnActivity/getPmEarnActivityPublic
|
||||||
* 获取公开赚钱活动配置列表,无需鉴权
|
* 获取公开赚钱活动配置列表,无需鉴权
|
||||||
@ -24,3 +41,13 @@ export interface GetPmEarnActivityPublicResponse extends ApiResponse<PmEarnActiv
|
|||||||
export async function getPmEarnActivityPublic(): Promise<GetPmEarnActivityPublicResponse> {
|
export async function getPmEarnActivityPublic(): Promise<GetPmEarnActivityPublicResponse> {
|
||||||
return get<GetPmEarnActivityPublicResponse>('/pmEarnActivity/getPmEarnActivityPublic')
|
return get<GetPmEarnActivityPublicResponse>('/pmEarnActivity/getPmEarnActivityPublic')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GET /pmMoneyLock/getMyMoneyLock
|
||||||
|
* 获取当前用户锁仓金额,需鉴权
|
||||||
|
*/
|
||||||
|
export async function getLockMoney(
|
||||||
|
config?: { headers?: Record<string, string> },
|
||||||
|
): Promise<GetLockMoneyResponse> {
|
||||||
|
return get<GetLockMoneyResponse>('/pmMoneyLock/getMyMoneyLock', undefined, config)
|
||||||
|
}
|
||||||
|
|||||||
@ -435,15 +435,18 @@
|
|||||||
"earnActivity": {
|
"earnActivity": {
|
||||||
"title": "Earn Liquidity",
|
"title": "Earn Liquidity",
|
||||||
"subtitle": "Participate to earn extra returns",
|
"subtitle": "Participate to earn extra returns",
|
||||||
"duration": "Duration",
|
"tiersTitle": "Activity Tiers",
|
||||||
"unlimited": "Unlimited",
|
"myLockInfo": "My Lock Info",
|
||||||
"extraProfitRate": "Extra Profit Rate",
|
"lockedAmount": "Locked Amount",
|
||||||
"notice": "This page is for viewing only. Please use API for locking operations.",
|
"freeAmount": "Free Amount",
|
||||||
"tiersTitle": "Profit Tiers",
|
"unlockDate": "Unlock Date",
|
||||||
"minAmount": "Min Amount (USDC)",
|
|
||||||
"tierLevel": "Tier {n}",
|
"tierLevel": "Tier {n}",
|
||||||
"expectedProfit": "Expected Profit",
|
"minAmount": "Min Amount (USDC)",
|
||||||
"days": "{n} Days"
|
"expectedProfit": "Expected APY",
|
||||||
|
"duration": "Duration",
|
||||||
|
"days": "{n} Days",
|
||||||
|
"unlimited": "Unlimited",
|
||||||
|
"notice": "Note: Actual returns may fluctuate based on market conditions. The platform reserves the right of final interpretation."
|
||||||
},
|
},
|
||||||
"locale": {
|
"locale": {
|
||||||
"zh": "简体中文",
|
"zh": "简体中文",
|
||||||
|
|||||||
@ -435,15 +435,18 @@
|
|||||||
"earnActivity": {
|
"earnActivity": {
|
||||||
"title": "流動性を稼いでロック",
|
"title": "流動性を稼いでロック",
|
||||||
"subtitle": "キャンペーンに参加して追加收益を獲得",
|
"subtitle": "キャンペーンに参加して追加收益を獲得",
|
||||||
"duration": "期間",
|
"tiersTitle": "キャンペーンティア",
|
||||||
|
"myLockInfo": "マイロック情報",
|
||||||
|
"lockedAmount": "ロック合計額",
|
||||||
|
"freeAmount": "出金可能額",
|
||||||
|
"unlockDate": "ロック解除日時",
|
||||||
|
"tierLevel": "第 {n} ティア",
|
||||||
|
"minAmount": "最低金額 (USDC)",
|
||||||
|
"expectedProfit": "予想年利",
|
||||||
|
"duration": "ロック期間",
|
||||||
|
"days": "{n} 日",
|
||||||
"unlimited": "無制限",
|
"unlimited": "無制限",
|
||||||
"extraProfitRate": "追加利益率",
|
"notice": "注意: 実際の収益は市場の状況により変動する場合があります。最終的な解釈権はプラットフォームに帰属します。"
|
||||||
"notice": "このペンは表示のみを目的としています。ロック操作はAPIを通じて行ってください。",
|
|
||||||
"tiersTitle": "利益ティア",
|
|
||||||
"minAmount": "最小金額 (USDC)",
|
|
||||||
"tierLevel": "ティア {n}",
|
|
||||||
"expectedProfit": "予想利益",
|
|
||||||
"days": "{n} 日"
|
|
||||||
},
|
},
|
||||||
"locale": {
|
"locale": {
|
||||||
"zh": "简体中文",
|
"zh": "简体中文",
|
||||||
|
|||||||
@ -435,15 +435,18 @@
|
|||||||
"earnActivity": {
|
"earnActivity": {
|
||||||
"title": "유동성 획득 잠금",
|
"title": "유동성 획득 잠금",
|
||||||
"subtitle": "이벤트에 참여하여 추가 수익 획득",
|
"subtitle": "이벤트에 참여하여 추가 수익 획득",
|
||||||
"duration": "기간",
|
"tiersTitle": "이벤트 티어",
|
||||||
"unlimited": "무제한",
|
"myLockInfo": "내 잠금 정보",
|
||||||
"extraProfitRate": "추가 이익률",
|
"lockedAmount": "전체 잠금 금액",
|
||||||
"notice": "이 페이지는 조회 전용입니다. 잠금 작업은 API를 통해 진행해 주세요.",
|
"freeAmount": "출금 가능 금액",
|
||||||
"tiersTitle": "수익 티어",
|
"unlockDate": "잠금 해제 시간",
|
||||||
"minAmount": "최소 금액 (USDC)",
|
|
||||||
"tierLevel": "티어 {n}",
|
"tierLevel": "티어 {n}",
|
||||||
"expectedProfit": "예상 수익",
|
"minAmount": "최소 금액 (USDC)",
|
||||||
"days": "{n}일"
|
"expectedProfit": "예상 연수익률",
|
||||||
|
"duration": "잠금 기간",
|
||||||
|
"days": "{n}일",
|
||||||
|
"unlimited": "무제한",
|
||||||
|
"notice": "주의: 실제 수익은 시장 상황에 따라 변동될 수 있습니다. 최종 해석 권한은 플랫폼에 있습니다."
|
||||||
},
|
},
|
||||||
"locale": {
|
"locale": {
|
||||||
"zh": "简体中文",
|
"zh": "简体中文",
|
||||||
|
|||||||
@ -447,15 +447,18 @@
|
|||||||
"earnActivity": {
|
"earnActivity": {
|
||||||
"title": "锁仓赚取流动性",
|
"title": "锁仓赚取流动性",
|
||||||
"subtitle": "参与活动获得额外收益",
|
"subtitle": "参与活动获得额外收益",
|
||||||
"duration": "活动时长",
|
"tiersTitle": "活动档位",
|
||||||
"unlimited": "不限时",
|
"myLockInfo": "我的锁仓情况",
|
||||||
"extraProfitRate": "额外利润比例",
|
"lockedAmount": "当前流动性锁仓金额",
|
||||||
"notice": "此页面仅供查看,锁仓操作请通过 API 进行。",
|
"freeAmount": "可提现金额",
|
||||||
"tiersTitle": "收益挡位",
|
"unlockDate": "解锁时间",
|
||||||
"minAmount": "最小金额 (USDC)",
|
"tierLevel": "第 {n} 档",
|
||||||
"tierLevel": "挡位 {n}",
|
"minAmount": "起存金额 (USDC)",
|
||||||
"expectedProfit": "预期利润",
|
"expectedProfit": "预期年化",
|
||||||
"days": "{n} 天"
|
"duration": "锁仓期限",
|
||||||
|
"days": "{n} 天",
|
||||||
|
"unlimited": "无限制",
|
||||||
|
"notice": "注意:实际收益可能会根据市场情况有所波动,最终解释权归平台所有。"
|
||||||
},
|
},
|
||||||
"locale": {
|
"locale": {
|
||||||
"zh": "简体中文",
|
"zh": "简体中文",
|
||||||
|
|||||||
@ -435,15 +435,18 @@
|
|||||||
"earnActivity": {
|
"earnActivity": {
|
||||||
"title": "鎖倉賺取流動性",
|
"title": "鎖倉賺取流動性",
|
||||||
"subtitle": "參與活動獲得額外收益",
|
"subtitle": "參與活動獲得額外收益",
|
||||||
"duration": "活動時長",
|
"tiersTitle": "活動檔位",
|
||||||
"unlimited": "不限時",
|
"myLockInfo": "我的鎖倉情況",
|
||||||
"extraProfitRate": "額外利潤比例",
|
"lockedAmount": "當前流動性鎖倉金額",
|
||||||
"notice": "此頁面僅供查看,鎖倉操作請透過 API 進行。",
|
"freeAmount": "可提現金額",
|
||||||
"tiersTitle": "收益檔位",
|
"unlockDate": "解鎖時間",
|
||||||
"minAmount": "最小金額 (USDC)",
|
"tierLevel": "第 {n} 檔",
|
||||||
"tierLevel": "檔位 {n}",
|
"minAmount": "起存金額 (USDC)",
|
||||||
"expectedProfit": "預期利潤",
|
"expectedProfit": "預期年化",
|
||||||
"days": "{n} 天"
|
"duration": "鎖倉期限",
|
||||||
|
"days": "{n} 天",
|
||||||
|
"unlimited": "無限制",
|
||||||
|
"notice": "注意:實際收益可能會根據市場情況有所波動,最終解釋權歸平台所有。"
|
||||||
},
|
},
|
||||||
"locale": {
|
"locale": {
|
||||||
"zh": "繁體中文",
|
"zh": "繁體中文",
|
||||||
|
|||||||
@ -9,6 +9,29 @@
|
|||||||
<p class="header-sub">{{ t('earnActivity.subtitle') }}</p>
|
<p class="header-sub">{{ t('earnActivity.subtitle') }}</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="card lock-info-card" v-if="userStore.isLoggedIn">
|
||||||
|
<h2 class="tiers-title">{{ t('earnActivity.myLockInfo') }}</h2>
|
||||||
|
<div class="lock-info-content" v-if="!lockLoading">
|
||||||
|
<div class="info-row">
|
||||||
|
<span class="info-label">{{ t('earnActivity.lockedAmount') }}</span>
|
||||||
|
<span class="info-value highlight">{{ formatAmount(lockInfo?.locked) }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-divider"></div>
|
||||||
|
<div class="info-row">
|
||||||
|
<span class="info-label">{{ t('earnActivity.freeAmount') }}</span>
|
||||||
|
<span class="info-value">{{ formatAmount(lockInfo?.freeMoney) }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="info-divider"></div>
|
||||||
|
<div class="info-row">
|
||||||
|
<span class="info-label">{{ t('earnActivity.unlockDate') }}</span>
|
||||||
|
<span class="info-value">{{ formatUnlockDate(lockInfo?.unlockDate) }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div v-else class="lock-loading">
|
||||||
|
<v-progress-circular indeterminate size="24" width="2" color="#5b5bd6" />
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section class="card tiers-card" v-if="activityList.length > 0">
|
<section class="card tiers-card" v-if="activityList.length > 0">
|
||||||
<h2 class="tiers-title">{{ t('earnActivity.tiersTitle') }}</h2>
|
<h2 class="tiers-title">{{ t('earnActivity.tiersTitle') }}</h2>
|
||||||
<div class="tier-list">
|
<div class="tier-list">
|
||||||
@ -19,7 +42,7 @@
|
|||||||
<div class="tier-content">
|
<div class="tier-content">
|
||||||
<div class="info-row">
|
<div class="info-row">
|
||||||
<span class="info-label">{{ t('earnActivity.minAmount') }}</span>
|
<span class="info-label">{{ t('earnActivity.minAmount') }}</span>
|
||||||
<span class="info-value">{{ item.minAmount ? item.minAmount.toLocaleString() : '--' }}</span>
|
<span class="info-value">{{ formatAmount(item.minAmount) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="info-divider"></div>
|
<div class="info-divider"></div>
|
||||||
<div class="info-row">
|
<div class="info-row">
|
||||||
@ -49,14 +72,26 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import { useI18n } from 'vue-i18n'
|
import { useI18n } from 'vue-i18n'
|
||||||
import { getPmEarnActivityPublic } from '@/api/earnActivity'
|
import { getPmEarnActivityPublic, getLockMoney } from '@/api/earnActivity'
|
||||||
import type { PmEarnActivityItem } from '@/api/earnActivity'
|
import type { PmEarnActivityItem, PmMoneyLock } from '@/api/earnActivity'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
const activityList = ref<PmEarnActivityItem[]>([])
|
const activityList = ref<PmEarnActivityItem[]>([])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
|
const lockInfo = ref<PmMoneyLock | null>(null)
|
||||||
|
const lockLoading = ref(false)
|
||||||
|
|
||||||
|
const formatAmount = (val: number | string | undefined | null) => {
|
||||||
|
if (val == null) return '0'
|
||||||
|
const num = typeof val === 'string' ? parseFloat(val) : val
|
||||||
|
if (!Number.isFinite(num)) return '0'
|
||||||
|
return Math.floor(num / 1000000).toLocaleString()
|
||||||
|
}
|
||||||
|
|
||||||
const formatRate = (rate: number | null) => {
|
const formatRate = (rate: number | null) => {
|
||||||
if (!rate) return '--'
|
if (!rate) return '--'
|
||||||
return `${(rate * 100).toFixed(0)}%`
|
return `${(rate * 100).toFixed(0)}%`
|
||||||
@ -68,6 +103,11 @@ const formatDuration = (seconds: number | null) => {
|
|||||||
return t('earnActivity.days', { n: days })
|
return t('earnActivity.days', { n: days })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const formatUnlockDate = (dateStr: string | undefined | null) => {
|
||||||
|
if (!dateStr || dateStr === '0001-01-01T00:00:00Z') return '--'
|
||||||
|
return new Date(dateStr).toLocaleString()
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
@ -80,7 +120,27 @@ onMounted(async () => {
|
|||||||
} finally {
|
} finally {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (userStore.isLoggedIn) {
|
||||||
|
fetchLockInfo()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function fetchLockInfo() {
|
||||||
|
const headers = userStore.getAuthHeaders()
|
||||||
|
if (!headers) return
|
||||||
|
lockLoading.value = true
|
||||||
|
try {
|
||||||
|
const res = await getLockMoney({ headers })
|
||||||
|
if (res.code === 0 && res.data) {
|
||||||
|
lockInfo.value = res.data
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to fetch lock info:', error)
|
||||||
|
} finally {
|
||||||
|
lockLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@ -213,6 +273,12 @@ onMounted(async () => {
|
|||||||
background: #e5e7eb;
|
background: #e5e7eb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.lock-loading {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 16px 0;
|
||||||
|
}
|
||||||
|
|
||||||
.notice-card {
|
.notice-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user