From 7a57bcc3208f804cde9915d361f1a738a4e88e1d Mon Sep 17 00:00:00 2001
From: zzzz <690498789@qq.com>
Date: Tue, 30 Apr 2024 16:54:03 +0800
Subject: [PATCH] first
---
src/store/modules/home.store.js | 52 +++++++++++++++++++++++++---------------------------
1 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/src/store/modules/home.store.js b/src/store/modules/home.store.js
index ca9e02c..41ea465 100644
--- a/src/store/modules/home.store.js
+++ b/src/store/modules/home.store.js
@@ -1,4 +1,4 @@
-import { getStorage, setStorage, changeTheme, fetchData } from "@/utils/utis";
+import { getStorage, setStorage, changeTheme } from "@/utils/utis";
import {
SET_COIN_LIST,
SET_CURRENCY,
@@ -6,7 +6,7 @@
SET_KEFU,
SET_THEME,
} from "@/store/const.store";
-import { _getCoins, _getExchangeRate } from "@/API/home.api";
+import { _getCoins, _getExchangeRate, itemlist } from "@/API/home.api";
import { customer } from "@/API/user.api";
export default {
@@ -15,38 +15,21 @@
currency: {}, // 当前汇率
coinArr: [], // 解构出来的币种数组
hotArr: [], // 热门币种
+ newcoinArr: [], // 热门币种
coinList: [], // 品种
kefu_url: "",
- theme: getStorage("theme") || "dark",
- baic: getStorage("baic") || "jy.coasdisxx123.online",
- baicArr: [],
+ theme: "light",
},
getters: {
coinList: (state) => state.coinList,
coinArr: (state) => state.coinArr,
hotArr: (state) => state.hotArr,
+ newcoinArr: (state) => state.newcoinArr,
currency: (state) => state.currency,
kefu_url: (state) => state.kefu_url,
theme: (state) => state.theme,
},
mutations: {
- SET_BAIC(state, payload) {
- console.log(payload);
- payload.unshift({
- title: "线路",
- type: "jy.coasdisxx123.online",
- value: 1,
- id: 10,
- });
- state.baicArr = payload;
- setStorage("baicArr", payload);
- },
- SET_BAIC_ARR(state, payload) {
- state.baic = payload;
- setStorage("baic", payload);
- window.location.reload(true);
- },
-
[SET_THEME]: (state, theme) => {
state.theme = theme;
window.document.documentElement.setAttribute("data-theme", theme);
@@ -59,6 +42,15 @@
[SET_CURRENCY](state, currency) {
state.currency = currency;
},
+ SET_NEW_CION_LIST(state, currency) {
+ const arr = [];
+ currency?.map((item) => {
+ arr.push(item.tokenCode);
+ });
+
+ state.newcoinArr = arr;
+ },
+
[SET_COIN_SYMBOL_ARR](state, list) {
const arr = [];
const hots = [];
@@ -69,6 +61,7 @@
hots.push(item.symbol);
}
});
+ console.log(arr, "===");
state.coinArr = arr;
state.hotArr = hots;
},
@@ -77,11 +70,6 @@
},
},
actions: {
- async setBaic({ commit }, data) {
- console.log(data, "type");
- commit("SET_BAIC", data);
- // window.localStorage.setItem("phones", userInfo.adminPhone);
- },
async [SET_COIN_LIST]({ commit, state }) {
// 获取配置的币种
@@ -92,6 +80,16 @@
commit(SET_COIN_LIST, list); // 拆分的单个数据
Promise.resolve(list);
},
+ async NEW_CION_LIST({ commit, state }) {
+ // 获取配置的币种
+
+ const list = await itemlist().catch((err) => {
+ Promise.reject(err);
+ });
+
+ commit("SET_NEW_CION_LIST", list); // 拆分的单个数据
+ Promise.resolve(list);
+ },
async [SET_CURRENCY]({ commit, state, rootState }) {
// 设置汇率
console.log("rootState", rootState);
--
Gitblit v1.9.3