import { useRootStore } from '@/store/root' import { getConfig, getFacilitiesList, getWeather } from '@/http/api/base' import { getShopAndBuildingList } from '@/http/api/shop' import { getDeviceInfo } from '@/http/api/building' import { getShopListByFloor, getShopListByIndustry, getBrandInfo } from '@/http/api/brand' import Message from '@/base/Message/Message' export const useInitConfigAndMallInfo = async () => { try { const _config = await getConfig() const store = useRootStore() store.SET_CONFIG(_config.data) const [_DeviceInfo, _shopAndBuilding, _facilityList, _weather, _shopListByFloor, _shopListByIndustry, _brandInfo] = await Promise.all([ getDeviceInfo(), getShopAndBuildingList(), getFacilitiesList(), getWeather(), getShopListByFloor(), getShopListByIndustry(), getBrandInfo() ]) const { shopList, buildingList } = _shopAndBuilding.data store.SET_DEVICE(_DeviceInfo.data) store.SET_SHOP_LIST(shopList) store.SET_BUILDING_LIST(buildingList) store.SET_BRAND_INFO(_brandInfo.data) store.SET_SHOP_LIST_BY_FLOOR(_shopListByFloor.data.list) store.SET_SHOP_LIST_BY_INDUSTRY(_shopListByIndustry.data.list) store.SET_FACILITY_LIST(_facilityList.data) store.SET_WEATHER(_weather.data) } catch (error) { Message({ text: '初始化数据失败', type: 'success' }) } }