From 30d1ee7be942d7a2201e1ab2ca7d96badff8bf50 Mon Sep 17 00:00:00 2001
From: 李 <344137771@qq.com>
Date: Sat, 23 May 2026 11:23:00 +0800
Subject: [PATCH] 1
---
src/components/Transform/list-quotation/index.vue | 64 ++++++++++++++++++++++---------
1 files changed, 45 insertions(+), 19 deletions(-)
diff --git a/src/components/Transform/list-quotation/index.vue b/src/components/Transform/list-quotation/index.vue
index a31897b..fb2f09f 100644
--- a/src/components/Transform/list-quotation/index.vue
+++ b/src/components/Transform/list-quotation/index.vue
@@ -20,12 +20,13 @@
</div>
</van-cell>
<transition-group :name="type" tag="div">
- <div v-if="active == 0" :key="active">
+ <div v-if="active == 0">
<van-cell v-for="item in listData" :key="item.id">
- <ul class="flex justify-between w-full items-center" @click="onItemClick(item)">
+ <ul class="flex justify-between w-full items-center" @click="onItemClick(item)">
<li class="flex items-center left">
<img
- :src="item.symbol ? `${HOST_URL}/symbol/${item.symbol_data}.png` : handleImage('../../../assets/loading-default.png')"
+ :src="getSymbolImg(item)"
+ @error="onSymbolImgError"
alt="logo" class="w-72 h-72 rounded-full mr-16" />
<p class="flex flex-col">
<span class="flex items-end font-32 flex items-center">
@@ -36,15 +37,15 @@
<!-- <span class="font-24 text-grey" style="position: relative; top: 1px">
{{ item.name && item.name.replace(item.symbol.toUpperCase(), '') || '--' }}</span> -->
</span>
- <span class="font-24 text-grey text-left">{{ $t('成交量') + ' ' + (item.amount * 1).toFixed(2) }}</span>
+ <!-- <span class="font-24 text-grey text-left">{{ $t('成交量') + ' ' + (item.amount * 1).toFixed(2) }}</span> -->
</p>
</li>
<li class="flex flex-col items-end mid">
- <p class="textColor font-32 font-600">{{ item.close || '--' }}</p>
+ <p class="textColor font-32 font-600">{{ item.close.toFixed(4) || '--' }}</p>
<p class="font-24 text-grey">{{ currency.currency_symbol }}
{{ item.close && item.symbol_data.toUpperCase() == 'SHIB' ? (item.close * currency.rate).toFixed(8) :
(item.close *
- currency.rate).toFixed(6)/1 || '--' }}</p>
+ currency.rate).toFixed(4) || '--' }}</p>
</li>
<li class="right flex items-center justify-end">
<p class="w-153 font-31 h-71 bg-green text-white border-0 text-center btn" v-if="item.change_ratio > 0">
@@ -55,12 +56,13 @@
</ul>
</van-cell>
</div>
- <div v-else :key="active">
+ <div v-else>
<van-cell v-for="item in showList" :key="item.id">
<ul class="flex justify-between w-full items-center" @click="onItemClick(item)">
<li class="flex items-center left">
- <img :src="`${HOST_URL}/symbol/${item.symbol_data}.png`" alt="logo"
- class="w-72 h-72 rounded-full mr-16" />
+ <img :src="getSymbolImg(item)"
+ @error="onSymbolImgError"
+ alt="logo" class="w-72 h-72 rounded-full mr-16" />
<p class="flex flex-col">
<span class="flex items-end font-32 flex items-center">
<span class="textColor font-600 font-30">{{ arrGk(item.name.toUpperCase())[0] }}</span>
@@ -74,10 +76,10 @@
</p>
</li>
<li class="flex flex-col items-end mid">
- <p class="textColor font-32 font-600">{{ item.close }}</p>
+ <p class="textColor font-32 font-600">{{ item.close.toFixed(4) }}</p>
<p class="font-24 text-grey">{{ currency.currency_symbol }} {{ item.close &&
item.symbol_data.toUpperCase() == 'SHIB' ? (item.close * currency.rate).toFixed(8) : (item.close *
- currency.rate).toFixed(6) / 1 || '--' }}</p>
+ currency.rate).toFixed(4) || '--' }}</p>
</li>
<li class="right flex items-center justify-end text-right">
<div v-if="active == 3" class="textColor w-182 font-700 font-24">
@@ -110,13 +112,16 @@
import ExTabs from "@/components/Transform/ex-tabs/index.vue";
import { HOST_URL } from '@/config'
import { SET_CURRENCY } from "@/store/const.store";
+const defaultLogo = new URL('@/assets/imgs/logo.png', import.meta.url).href;
export default {
name: 'ListQuotation',
data() {
return {
fixDate,
HOST_URL,
+ defaultLogo,
active: 0,
+ showList: [],
type: 'left' //left 从左往右 right 从有王座
}
},
@@ -158,20 +163,36 @@
methods: {
...mapActions('home', [SET_CURRENCY]),
onItemClick(item) {
- if (this.tabActive == 2) { //现货
+ const tab = this.tabActive !== undefined && this.tabActive !== null ? Number(this.tabActive) : 2;
+ if (tab === 1) {
+ // 现货
this.$router.push({
path: `/cryptos/trade/${item.symbol}`
});
- } else {
- setStorage('symbol', item.symbol)
+ } else if (tab === 3) {
+ // 期权:交割合约,跳转交易页并带 selectIndex=2
+ setStorage('symbol', item.symbol);
this.$router.push({
- path: `/cryptos/perpetualContract/${item.symbol}`,
+ path: '/trade/index',
+ query: { selectIndex: 2 }
+ });
+ } else {
+ // 全部(0) 或 永续(2)
+ setStorage('symbol', item.symbol);
+ this.$router.push({
+ path: `/trade/index`,
query: { type: 'cryptos' }
});
}
},
- handleImage(url) {
- return new URL(url, import.meta.url).href
+ getSymbolImg(item) {
+ if (item?.symbol && item?.symbol_data && this.HOST_URL) {
+ return `${this.HOST_URL}/symbol/${(item.symbol_data + '').toLowerCase()}.png`;
+ }
+ return this.defaultLogo;
+ },
+ onSymbolImgError(e) {
+ if (e?.target) e.target.src = this.defaultLogo;
},
onTabs(val) {
if (this.active < val) {
@@ -225,6 +246,7 @@
this.showList = [...this.listData].sort(this.compare("volume", 'up'))
}
this.$forceUpdate()
+ // console.log("aaaaaaaaa", this.showList, this.listData);
}
}
}
@@ -233,7 +255,7 @@
@import "@/assets/init.scss";
#cryptos {
-
+
.left-enter-active,
.left-leave-active,
.right-enter-active,
@@ -241,7 +263,11 @@
will-change: transform;
transition: all 250ms;
}
-
+.van-cell {
+ padding: 25px 15px !important;
+ background-color: #fff !important;
+ border-radius: 10px !important;
+}
.textColor {
color: $text_color4;
}
--
Gitblit v1.9.3