zzzz
2024-04-19 35f3f260f3d3c51ac2256899ade3b9a144b46b28
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 = [];
@@ -77,11 +69,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 +79,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);