import { useStore } from '@/store/root' import { getConfig, getFacilitiesList } from '@/http/api/base' import { getShopAndBuildingList } from '@/http/api/shop' import { getCurrentFloor } from '@/http/api/building' import Message from '@/base/Message/Message' export const useInitConfigAndMallInfo = async () => { try { const _config = await getConfig() const store = useStore() store.SET_CONFIG(_config.data) const [_currentFloor, _shopAndBuilding, _facilityList] = await Promise.all([ getCurrentFloor(), getShopAndBuildingList(), getFacilitiesList() ]) const { shopList, buildingList } = _shopAndBuilding.data store.SET_CURRENT_FLOOR(_currentFloor.data) store.SET_SHOP_LIST(shopList) store.SET_BUILDING_LIST(buildingList) store.SET_FACILITY_LIST(_facilityList.data) } catch (error) { Message({ text: '获取数据失败', type: 'success' }) } }