From 402042e2ee63f1ed5b1d5d6df483270ab996e76e Mon Sep 17 00:00:00 2001
From: jhzh <1628036192@qq.com>
Date: Sun, 15 Sep 2024 18:55:42 +0800
Subject: [PATCH] 1

---
 src/page/quotes.vue |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/page/quotes.vue b/src/page/quotes.vue
index 59295f1..fd99514 100644
--- a/src/page/quotes.vue
+++ b/src/page/quotes.vue
@@ -152,8 +152,21 @@
       if (!this.coinList.length) {
         await this.SET_COIN_LIST();
       }
-      const coins = this.coinList.map((item) => item.symbol);
-      const mainArray = coins.filter((item) => !this.newcoinArr.includes(item));
+	  const coins = this.coinList.map((item) => item.symbol);
+	  
+	  const prioritize = ['btc', 'eth']; // 需要优先排序的币种
+	  
+	  // 按照优先级对 coins 数组进行排序
+	  const sortedCoins = coins.sort((a, b) => {
+	    const aIndex = prioritize.indexOf(a);
+	    const bIndex = prioritize.indexOf(b);
+	  
+	    if (aIndex === -1 && bIndex === -1) return 0; // 两者都不在优先级列表中,不做排序
+	    if (aIndex === -1) return 1; // b 在优先级列表中,a 不在,b 排在前面
+	    if (bIndex === -1) return -1; // a 在优先级列表中,b 不在,a 排在前面
+	    return aIndex - bIndex; // 根据优先级排序
+	  });
+      const mainArray = sortedCoins.filter((item) => !this.newcoinArr.includes(item));
       const data = await _getHomeList(mainArray.join(","));
       this.tabList[0]["data"] = data.filter((item) =>
         this.myList.includes(item.symbol)

--
Gitblit v1.9.3