From 4931fb42270d5fd00a0a22270d684476ffa53917 Mon Sep 17 00:00:00 2001
From: 李凌 <344137771@qq.com>
Date: Sat, 11 Oct 2025 18:35:08 +0800
Subject: [PATCH] 1

---
 src/views/homePage/index.vue |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/views/homePage/index.vue b/src/views/homePage/index.vue
index a65c833..db02613 100644
--- a/src/views/homePage/index.vue
+++ b/src/views/homePage/index.vue
@@ -1,7 +1,7 @@
 <template>
     <div class="home_page">
 
-        <Head></Head>
+        <Head @search="onSearch"></Head>
         <!-- <div class="home_logo flex justify-center"><img src="@/assets/imgs/home/home_logo.png" alt=""></div> -->
         <!-- <van-swipe class="home_logo" :autoplay="3000" indicator-color="white">
             <van-swipe-item><img src="@/assets/imgs/home/Slider-1.jpg" alt=""></van-swipe-item>
@@ -118,7 +118,7 @@
     { key: 7, name: t('提现'), icon: new URL('@/assets/imgs/home/home_6.png', import.meta.url), path: '/cryptos/Withdraw/withdrawPage' },
     // { key: 8, name: t('卡券中心'), icon: new URL('@/assets/imgs/home/home_7.png', import.meta.url) },
     // { key: 9, name: t('闪兑'), icon: new URL('@/assets/imgs/home/home_8.png', import.meta.url), path: '/cryptos/exchangePage' },
-    { key: 9, name: t('划转'), icon: new URL('@/assets/imgs/home/home_8.png', import.meta.url), path: '/my/transfer' },
+    // { key: 9, name: t('划转'), icon: new URL('@/assets/imgs/home/home_8.png', import.meta.url), path: '/my/transfer' },
     // { key: 10, name: t('更多'), icon: new URL('@/assets/imgs/home/home_9.png', import.meta.url) },
 
     { key: 11, name: "STO", icon: new URL('@/assets/imgs/home/home_1.png', import.meta.url), path: '/ICO/ico' },
@@ -171,6 +171,8 @@
 
 //#region 行情数据----------------------------------------
 let qList = ref([])
+let qListCope = ref([]) // 备份数据
+let key = ref('') // 搜索关键词
 let timeout = ref(null)
 const coinArr = computed(() => store.getters['home/coinArr']);
 
@@ -181,7 +183,16 @@
     if (!(list instanceof Array)) {
         return
     }
-    qList.value = list;
+
+    // 通过关键字进行筛选
+    if (key.value) {
+        qList.value = list.filter(item => {
+            return item.symbol_data.toLowerCase().includes(key.value.toLowerCase()) || item.name.toLowerCase().includes(key.value.toLowerCase())
+        })
+    } else {
+        qList.value = list
+    }
+    qListCope.value = list; // 备份数据
 
     if (timeout.value) {
         clearTimeout(timeout.value)
@@ -192,6 +203,20 @@
 }
 fetchQList()
 
+// 搜索
+const onSearch = (val) => {
+    key.value = val
+
+    if (!val) {
+        qList.value = qListCope.value
+        return
+    }
+    let newList = qListCope.value.filter(item => {
+        return item.symbol_data.toLowerCase().includes(val.toLowerCase()) || item.name.toLowerCase().includes(val.toLowerCase())
+    })
+    qList.value = newList
+}
+
 onBeforeUnmount(() => {
     if (timeout.value) {
         clearTimeout(timeout.value)

--
Gitblit v1.9.3