From 543735d5141ce80b5f48c1a0d777fc29b0b34c86 Mon Sep 17 00:00:00 2001
From: 李 <344137771@qq.com>
Date: Wed, 03 Jun 2026 18:27:50 +0800
Subject: [PATCH] 1
---
src/views/home/index.vue | 51 ++++++++++++++++++++++++++++++++++++---------------
1 files changed, 36 insertions(+), 15 deletions(-)
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index 434d035..6f46501 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -4,7 +4,7 @@
<div class="header">
<div class="header-left">
<img src="@/assets/image/login_logo.png" alt="Wealthinfra" class="logo" />
- <span class="logo-text">1m</span>
+ <span class="logo-text">Bitget</span>
</div>
<div class="header-right">
<div class="lang-selector" @click="$router.push('/language')">
@@ -93,6 +93,12 @@
</div>
<span>{{ $t('withdraw') }}</span>
</div>
+ <div class="quick-item" @click="$router.push('/cryptos/loan')">
+ <div class="quick-icon">
+ <img src="@/assets/image/dk.png" alt="loan" />
+ </div>
+ <span>{{ $t('home.loan') }}</span>
+ </div>
<div class="quick-item" @click="$router.push('/customerService')">
<div class="quick-icon">
<img src="@/assets/image/lxkf.png" alt="service" />
@@ -123,9 +129,10 @@
<!-- Trading Instruments -->
<div class="trading-section">
- <div class="trading-tabs trading-tabs--single">
- <div class="tab-item active">
- {{ $t('加密货币') }}
+ <div class="trading-tabs">
+ <div class="tab-item" v-for="tab in marketTabs" :key="tab.value"
+ :class="{ active: activeTab === tab.value }" @click="switchTab(tab.value)">
+ {{ $t(tab.label) }}
</div>
</div>
<div class="trading-pairs">
@@ -135,7 +142,7 @@
<div class="pair-symbol">
<img v-if="getPairIconUrl(pair)" :src="getPairIconUrl(pair)" alt=""
class="pair-symbol-icon" />
- {{ pair.symboltxt.toUpperCase() }}
+ {{ (pair.symboltxt || pair.symbol || '').toUpperCase() }}
</div>
<div class="pair-change" :class="pair.change >= 0 ? 'up' : 'down'">
{{ pair.change >= 0 ? '+' : '' }}{{ pair.change.toFixed(4) }}%
@@ -281,7 +288,7 @@
if (!symbol) return
router.push({
path: '/trade/options',
- query: { symbol, activeTab: type || 'cryptos' }
+ query: { symbol, activeTab: type || activeTab.value }
})
}
@@ -313,6 +320,13 @@
})
const tradingPairs = ref([])
+const activeTab = ref('cryptos')
+const marketTabs = [
+ { label: '加密货币', value: 'cryptos' },
+ { label: '股票', value: 'US-stocks' },
+ { label: 'ETF', value: 'indices' },
+ { label: '外汇', value: 'forex' },
+]
// 新闻列表,用于横向滚动轮播(与 news/index.vue 同源:_getUsHeadNews)
const newsList = ref([])
@@ -321,12 +335,19 @@
function getPairIconUrl(pair) {
if (!pair) return ''
+ if (activeTab.value === 'US-stocks' || activeTab.value === 'indices') return ''
return pair.iconImg ? `${IMG_PATH}/symbol/${pair.iconImg}.png` : ''
}
-// 获取交易数据(仅数字货币)
+function switchTab(tab) {
+ if (activeTab.value === tab) return
+ activeTab.value = tab
+ fetchTradingData()
+}
+
+// 获取交易数据
const fetchTradingData = async () => {
- const type = 'cryptos'
+ const type = activeTab.value
try {
const params = {
@@ -350,19 +371,19 @@
const spread = basePrice * 0.0001 // 很小的价差
const sellPrice = (basePrice - spread).toFixed(4)
const buyPrice = (basePrice + spread).toFixed(4)
- const symboltxt = item.enName
+ const symboltxt = item.enName || item.name || item.symbol
const symbolStr = item.symbol || '--'
const iconImg = item.symbol_data || (symbolStr.includes('/') ? symbolStr.split('/')[0].toLowerCase() : symbolStr.replace(/USDT$/i, '').toLowerCase()) || symbolStr.toLowerCase()
return {
- symboltxt: symboltxt,
+ symboltxt,
symbol: symbolStr,
- type: type,
- iconImg: iconImg,
+ type,
+ iconImg,
price: basePrice.toFixed(4),
change: changeRatio,
- sellPrice: sellPrice,
- buyPrice: buyPrice,
- klineData: klineData
+ sellPrice,
+ buyPrice,
+ klineData
}
})
} else {
--
Gitblit v1.9.3