|
|
|
@ -2,31 +2,17 @@ import axios from "axios"; |
|
|
|
import icons from "./image-helper"; |
|
|
|
let mallInfos = new Map(); |
|
|
|
|
|
|
|
export const code = "project-200"; |
|
|
|
export const baseUrl = "https://project-iot.test.1000my.com"; |
|
|
|
export const get = async (url = "", data = {}) => { |
|
|
|
const response = await fetch(baseUrl + url, { |
|
|
|
method: "POST", |
|
|
|
headers: { |
|
|
|
"Content-Type": "application/json", |
|
|
|
}, |
|
|
|
body: JSON.stringify({ ...data, mallCode: code }), |
|
|
|
}); |
|
|
|
return response.json(); |
|
|
|
}; |
|
|
|
const getMallInfo = async () => { |
|
|
|
const { name, city, groundFloorOrder, scale, offsetToNorth } = { |
|
|
|
name: "桥北万象", |
|
|
|
city: "南京", |
|
|
|
groundFloorOrder: 2, |
|
|
|
|
|
|
|
const getMallInfo = async (code) => { |
|
|
|
const { groundFloorOrder, scale, offsetToNorth } = { |
|
|
|
groundFloorOrder: 0, |
|
|
|
scale: 0.15, |
|
|
|
offsetToNorth: 0, |
|
|
|
}; |
|
|
|
document.title = name; |
|
|
|
|
|
|
|
const mall = { |
|
|
|
baseUrl, |
|
|
|
name, |
|
|
|
city, |
|
|
|
code, |
|
|
|
groundFloorIndex: groundFloorOrder, |
|
|
|
needSpotLight: false, |
|
|
|
@ -40,8 +26,14 @@ const getMallInfo = async () => { |
|
|
|
shopInfoUrl: `${baseUrl}/api/guide/v1/web/getMapInfo?projectCode=${code}`, |
|
|
|
}; |
|
|
|
|
|
|
|
const [cdnUrl, mapDataJSON, [buildingList, serverShopInfo], facs, theme] = |
|
|
|
await Promise.all([ |
|
|
|
const [ |
|
|
|
cdnUrl, |
|
|
|
mapDataJSON, |
|
|
|
[buildingList, serverShopInfo], |
|
|
|
facs, |
|
|
|
theme, |
|
|
|
{ cityName, projectName }, |
|
|
|
] = await Promise.all([ |
|
|
|
(async () => { |
|
|
|
try { |
|
|
|
const { |
|
|
|
@ -105,7 +97,23 @@ const getMallInfo = async () => { |
|
|
|
return {}; |
|
|
|
} |
|
|
|
})(), |
|
|
|
(async () => { |
|
|
|
try { |
|
|
|
const { |
|
|
|
data: { data }, |
|
|
|
} = await axios.get( |
|
|
|
`${baseUrl}/api/guide/v1/web/getMallData?projectCode=${code}` |
|
|
|
); |
|
|
|
return data; |
|
|
|
} catch (error) { |
|
|
|
console.error(error); |
|
|
|
return {}; |
|
|
|
} |
|
|
|
})(), |
|
|
|
]); |
|
|
|
mall.name = projectName; |
|
|
|
document.title = projectName; |
|
|
|
mall.city = cityName; |
|
|
|
const mapData = JSON.parse(mapDataJSON)[0]; |
|
|
|
mall.floors = buildingList[0].floorList.map(({ floor, floorOrder }) => ({ |
|
|
|
name: floor, |
|
|
|
|