From 8588fe30f17d0d28190a279aab8675de0dbf1a5b Mon Sep 17 00:00:00 2001
From: lxf <1371462558@qq.com>
Date: Wed, 16 Jul 2025 18:46:29 +0800
Subject: [PATCH] 个人添加图片
---
src/components/Transform/trade-head/index.vue | 68 ++++++++++++++++++++++++++--------
1 files changed, 52 insertions(+), 16 deletions(-)
diff --git a/src/components/Transform/trade-head/index.vue b/src/components/Transform/trade-head/index.vue
index fddbef9..6878814 100644
--- a/src/components/Transform/trade-head/index.vue
+++ b/src/components/Transform/trade-head/index.vue
@@ -7,7 +7,7 @@
<div class="flex items-center">
<!-- 没有切换模式的 -->
- <img v-if="isReturn" src="@/assets/image/icon_back_1.png" @click="backPath()" class="w-40 h-40 back mr-50"
+ <img v-if="isReturn" src="@/assets/image/icon_back.png" @click="backPath()" class="w-40 h-40 back mr-50"
alt="">
<template v-if="!isChange">
<img src="../../../assets/theme/dark/image/black-convert.png" alt="convert-img" class="w-35 h-35"
@@ -16,7 +16,7 @@
<!-- 在切换模式下 -->
<template v-if="isChange">
<template v-if="isNight">
- <img src="../../../assets/image/icon_back_1.png" class="w-40 h-40 back mr-50" alt="" @click="backPath()">
+ <img src="../../../assets/image/icon_back.png" class="w-40 h-40 back mr-50" alt="" @click="backPath()">
<img src="./white-convert.png" alt="convert-img" class="w-35 h-35" @click="onSidebar" />
</template>
<template v-else>
@@ -42,8 +42,11 @@
v-if="isCollect" />
<img v-else src="../../../assets/image/icon-star.png" class="w-30 h-30 mr-10 ml-20" @click="openCurrency" />
</div>
- <img v-if="isTrade" src="../../../assets/image/kline.png" class="w-44 h-44 right" alt=""
- @click="$router.push(`/cryptos/trendDetails/${symbol}?kineType=trade`)">
+ <img src="../../../assets/image/public/record.png" alt="record-img" class="w-44 h-44 "
+ @click="goHistory" />
+
+ <!-- <img v-if="isTrade" src="../../../assets/image/kline.png" class="w-44 h-44 right" alt=""
+ @click="$router.push(`/cryptos/trendDetails/${symbol}?kineType=trade`)"> -->
</div>
</div>
<!-- 左侧边弹出菜单 -->
@@ -82,7 +85,7 @@
</template>
<script>
-import { setStorage, handleImage } from '@/utils/utis.js'
+import { getStorage, setStorage, handleImage } from '@/utils/utis.js'
import { Popup, showSuccessToast } from "vant";
import { mapGetters } from "vuex";
import { _getHomeList, _collect, _deleteCollect, _checkIsInCollect } from "@/service/home.api";
@@ -90,6 +93,7 @@
import { useRouter } from "vue-router";
import addCurrency from '@/components/add-currency/index.vue'
import { _isItemHasAdd, _isItemHasAddGlobal } from '@/service/quotes.api'
+import {_getCoinList} from '@/service/quotes.api'
const router = useRouter()
export default {
name: "contractHeader",
@@ -222,14 +226,45 @@
}
this.show = false
},
- onSidebar() { // 侧边栏打开
+ goHistory() {
+ if (this.$store.state.user.userInfo.token) {
+ let type = 'cryptos'
+ if (this.$route.query.type) {
+ type = this.$route.query.type
+ }
+ this.$router.push(`/cryptos/tradeRecord/${this.symbol}/?type=forex`)
+ } else {
+ this.$router.push('/login')
+ }
+ },
+ async onSidebar() { // 侧边栏打开
// console.log(this.userInfo)
- this.coins = this.coinList.map(item => item.symbol)
+ // 优先用本地缓存的 coins
+ let arr = getStorage('qoutes')
+ let coninArr = ''
+ console.log('arr:', arr)
+
+ if (arr && arr.length) {
+ // 如果本地有 coins,优先用本地
+ arr.forEach(item => {
+ coninArr += item.symbol + ','
+ })
+ } else {
+ // 如果本地没有 coins,拉取接口
+ const quotesData = await _getCoinList()
+ console.log('quotesData:', quotesData)
+ quotesData.forEach(item => {
+ coninArr += item.symbol + ','
+ })
+ setStorage('qoutes', { coins: quotesData }) // 存到本地
+ }
+ this.coins = coninArr
+ // this.coins = this.coinList.map(item => item.symbol)
this.show = true
this.fetchList()
},
fetchList() { // 获取行情
- _getHomeList(this.coins.join(',')).then(list => {
+ _getHomeList(this.coins).then(list => {
// console.log(list)
this.list = list
if (this.timeout) {
@@ -290,17 +325,18 @@
this.$emit('changeNight', !this.isNight)
},
backPath() {
- if (this.$route.query?.from === 'trade') {
- this.$router.push('/trade/index?tabActive=1')
- } else if (this.$route.query.isOptional == 1) {
- this.$router.push('/optional/index')
- }
+ this.$router.go(-1)
+ // if (this.$route.query?.from === 'trade') {
+ // this.$router.push('/trade/index?tabActive=1')
+ // } else if (this.$route.query.isOptional == 1) {
+ // this.$router.push('/optional/index')
+ // }
// else if (this.$route.query.isOptional == 2){
// this.$router.push('/optional/search')
// }
- else {
- this.$router.push('/quotes/index?tabActive=1')
- }
+ // else {
+ // this.$router.push('/quotes/index?tabActive=1')
+ // }
},
//打开自选弹窗
openCurrency() {
--
Gitblit v1.9.3