| | |
| | | <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')"> |
| | |
| | | </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" /> |
| | |
| | | |
| | | <!-- 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"> |
| | |
| | | <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) }}% |
| | |
| | | if (!symbol) return |
| | | router.push({ |
| | | path: '/trade/options', |
| | | query: { symbol, activeTab: type || 'cryptos' } |
| | | query: { symbol, activeTab: type || activeTab.value } |
| | | }) |
| | | } |
| | | |
| | |
| | | }) |
| | | |
| | | 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([]) |
| | | |
| | |
| | | |
| | | 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 = { |
| | |
| | | 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 { |