{"ast":null,"code":"import \"core-js/modules/es.array.push.js\";\nimport { getStorage, setStorage, changeTheme } from \"@/utils/utis\";\nimport { SET_COIN_LIST, SET_CURRENCY, SET_COIN_SYMBOL_ARR, SET_KEFU, SET_THEME } from \"@/store/const.store\";\nimport { _getCoins, _getExchangeRate } from \"@/API/home.api\";\nimport { customer } from \"@/API/user.api\";\nexport default {\n namespaced: true,\n state: {\n currency: {},\n // 当前汇率\n coinArr: [],\n // 解构出来的币种数组\n hotArr: [],\n // 热门币种\n coinList: [],\n // 品种\n kefu_url: \"\",\n theme: \"light\"\n },\n getters: {\n coinList: state => state.coinList,\n coinArr: state => state.coinArr,\n hotArr: state => state.hotArr,\n currency: state => state.currency,\n kefu_url: state => state.kefu_url,\n theme: state => state.theme\n },\n mutations: {\n [SET_THEME]: (state, theme) => {\n state.theme = theme;\n window.document.documentElement.setAttribute(\"data-theme\", theme);\n changeTheme(theme);\n setStorage(\"theme\", theme);\n },\n [SET_COIN_LIST](state, list) {\n state.coinList = list;\n },\n [SET_CURRENCY](state, currency) {\n state.currency = currency;\n },\n [SET_COIN_SYMBOL_ARR](state, list) {\n const arr = [];\n const hots = [];\n list.map(item => {\n arr.push(item.symbol);\n if (item.isTop === \"1\") {\n // 热门\n hots.push(item.symbol);\n }\n });\n state.coinArr = arr;\n state.hotArr = hots;\n },\n [SET_KEFU](state, url) {\n state.kefu_url = url;\n }\n },\n actions: {\n async [SET_COIN_LIST]({\n commit,\n state\n }) {\n // 获取配置的币种\n\n const list = await _getCoins().catch(err => {\n Promise.reject(err);\n });\n commit(SET_COIN_SYMBOL_ARR, list); // 原数据\n commit(SET_COIN_LIST, list); // 拆分的单个数据\n Promise.resolve(list);\n },\n async [SET_CURRENCY]({\n commit,\n state,\n rootState\n }) {\n // 设置汇率\n console.log(\"rootState\", rootState);\n const currency = await _getExchangeRate({\n token: rootState.user.userInfo.token\n }).catch(err => Promise.reject(err));\n commit(SET_CURRENCY, currency);\n },\n actionsToken({\n commit\n }, data) {\n commit(\"SET_TOKEN\", data);\n },\n actionsStatus({\n commit\n }, data) {\n commit(\"SET_STATUS\", data);\n },\n async [SET_KEFU]({\n commit,\n state,\n rootState\n }) {\n // 设置汇率\n\n const data = await customer().catch(err => Promise.reject(err));\n let url = data.customer_service_url;\n commit(SET_KEFU, url);\n }\n }\n};","map":{"version":3,"names":["getStorage","setStorage","changeTheme","SET_COIN_LIST","SET_CURRENCY","SET_COIN_SYMBOL_ARR","SET_KEFU","SET_THEME","_getCoins","_getExchangeRate","customer","namespaced","state","currency","coinArr","hotArr","coinList","kefu_url","theme","getters","mutations","window","document","documentElement","setAttribute","list","arr","hots","map","item","push","symbol","isTop","url","actions","commit","catch","err","Promise","reject","resolve","rootState","console","log","token","user","userInfo","actionsToken","data","actionsStatus","customer_service_url"],"sources":["/Users/admin/Desktop/yueankeji/new_exchange/src/store/modules/home.store.js"],"sourcesContent":["import { getStorage, setStorage, changeTheme } from \"@/utils/utis\";\nimport {\n SET_COIN_LIST,\n SET_CURRENCY,\n SET_COIN_SYMBOL_ARR,\n SET_KEFU,\n SET_THEME,\n} from \"@/store/const.store\";\nimport { _getCoins, _getExchangeRate } from \"@/API/home.api\";\nimport { customer } from \"@/API/user.api\";\n\nexport default {\n namespaced: true,\n state: {\n currency: {}, // 当前汇率\n coinArr: [], // 解构出来的币种数组\n hotArr: [], // 热门币种\n coinList: [], // 品种\n kefu_url: \"\",\n theme: \"light\",\n },\n getters: {\n coinList: (state) => state.coinList,\n coinArr: (state) => state.coinArr,\n hotArr: (state) => state.hotArr,\n currency: (state) => state.currency,\n kefu_url: (state) => state.kefu_url,\n theme: (state) => state.theme,\n },\n mutations: {\n [SET_THEME]: (state, theme) => {\n state.theme = theme;\n window.document.documentElement.setAttribute(\"data-theme\", theme);\n changeTheme(theme);\n setStorage(\"theme\", theme);\n },\n [SET_COIN_LIST](state, list) {\n state.coinList = list;\n },\n [SET_CURRENCY](state, currency) {\n state.currency = currency;\n },\n [SET_COIN_SYMBOL_ARR](state, list) {\n const arr = [];\n const hots = [];\n list.map((item) => {\n arr.push(item.symbol);\n if (item.isTop === \"1\") {\n // 热门\n hots.push(item.symbol);\n }\n });\n state.coinArr = arr;\n state.hotArr = hots;\n },\n [SET_KEFU](state, url) {\n state.kefu_url = url;\n },\n },\n actions: {\n async [SET_COIN_LIST]({ commit, state }) {\n // 获取配置的币种\n\n const list = await _getCoins().catch((err) => {\n Promise.reject(err);\n });\n commit(SET_COIN_SYMBOL_ARR, list); // 原数据\n commit(SET_COIN_LIST, list); // 拆分的单个数据\n Promise.resolve(list);\n },\n async [SET_CURRENCY]({ commit, state, rootState }) {\n // 设置汇率\n console.log(\"rootState\", rootState);\n const currency = await _getExchangeRate({\n token: rootState.user.userInfo.token,\n }).catch((err) => Promise.reject(err));\n commit(SET_CURRENCY, currency);\n },\n actionsToken({ commit }, data) {\n commit(\"SET_TOKEN\", data);\n },\n actionsStatus({ commit }, data) {\n commit(\"SET_STATUS\", data);\n },\n async [SET_KEFU]({ commit, state, rootState }) {\n // 设置汇率\n\n const data = await customer().catch((err) => Promise.reject(err));\n let url = data.customer_service_url;\n commit(SET_KEFU, url);\n },\n },\n};\n"],"mappings":";AAAA,SAASA,UAAU,EAAEC,UAAU,EAAEC,WAAW,QAAQ,cAAc;AAClE,SACEC,aAAa,EACbC,YAAY,EACZC,mBAAmB,EACnBC,QAAQ,EACRC,SAAS,QACJ,qBAAqB;AAC5B,SAASC,SAAS,EAAEC,gBAAgB,QAAQ,gBAAgB;AAC5D,SAASC,QAAQ,QAAQ,gBAAgB;AAEzC,eAAe;EACbC,UAAU,EAAE,IAAI;EAChBC,KAAK,EAAE;IACLC,QAAQ,EAAE,CAAC,CAAC;IAAE;IACdC,OAAO,EAAE,EAAE;IAAE;IACbC,MAAM,EAAE,EAAE;IAAE;IACZC,QAAQ,EAAE,EAAE;IAAE;IACdC,QAAQ,EAAE,EAAE;IACZC,KAAK,EAAE;EACT,CAAC;EACDC,OAAO,EAAE;IACPH,QAAQ,EAAG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