import { i18n } from '@/i18n' import themes from '@/themes' export const actions = { SET_SHOP_LIST(list) { this.shopList = list }, SET_SELECTED_MODULE(moduleName) { this.selectedModule = moduleName }, SET_INDEX_LIST(list) { this.indexList = list }, SET_SIDEBAR_LIST(list) { this.sidebarList = list }, SET_BUILDING_LIST(list) { this.buildingList = list }, SET_FACILITY_LIST(list) { this.facilityList = list }, SET_LANGUAGE(language) { i18n.global.locale = language this.language = language }, SET_CONFIG(config) { this.config = config }, SET_SHOP(shop) { this.shop = shop }, SET_CURRENT_FLOOR(currentFloor) { this.currentFloor = currentFloor }, SET_SHOW_SEARCH(flag) { this.showSearch = flag }, SET_SHOW_VOICE(flag) { this.showVoice = flag }, SET_SHOW_DETAIL(flag) { this.showDetail = flag }, SET_ISUSE_FACE(flag) { this.isUseFace = flag }, SET_ISUSE_SPEECH(flag) { this.isUseSpeech = flag }, SET_MAP_DATA(data) { this.mapData = data }, SET_CURRENT_THEME(data) { this.currentThemeName = data const r = document.querySelector(':root') Object.entries(themes[data]).forEach(([cat, obj]) => { Object.entries(obj).forEach(([k, v]) => r.style.setProperty(`--${cat}-${k}`, v)) }) } }