diff --git a/src/components/ShopList/ShopList.js b/src/components/ShopList/ShopList.js
index b602b67..72dd01a 100644
--- a/src/components/ShopList/ShopList.js
+++ b/src/components/ShopList/ShopList.js
@@ -10,10 +10,7 @@ const ShopList = ({
format = null,
floorOrder = null,
}) => {
- const shops = mall.shopInfo.reduce(
- (acc, { shopList }) => acc.concat(shopList),
- []
- );
+ const shops = format ? mall.sortedShops : mall.shops;
const upperQ = q ? q.toUpperCase() : "";
const filteredShops = shops
.filter(({ yaxis }) => yaxis)
@@ -49,6 +46,7 @@ const ShopList = ({
(format === null ? true : shopFormat === format) &&
(floorOrder === null ? true : floorOrder1 === floorOrder)
);
+
const listRef = useRef(null);
return (
diff --git a/src/js/helpers/data-helper.js b/src/js/helpers/data-helper.js
index c292667..02395e1 100644
--- a/src/js/helpers/data-helper.js
+++ b/src/js/helpers/data-helper.js
@@ -53,13 +53,14 @@ const getMallInfo = async ({ memberID }) => {
} = await axios.get(
`${cdnUrl}/ar/${code}/config.json?t=${new Date().getTime()}`
);
- // if (mapUrl) config.mapDataUrl = mapUrl;
- // if (shopUrl) config.shopInfoUrl = shopUrl;
+ if (mapUrl) config.mapDataUrl = mapUrl;
+ if (shopUrl) config.shopInfoUrl = shopUrl;
} catch (error) {
console.log("获取config失败");
}
const [
+ recIndexMap,
mapDataJSON,
serverShopInfo,
facs,
@@ -68,6 +69,24 @@ const getMallInfo = async ({ memberID }) => {
menu,
{ shopCouponMap, userLevel },
] = await Promise.all([
+ (async () => {
+ try {
+ const {
+ data: {
+ data: { recommendList },
+ },
+ } = await axios.get(
+ `${baseUrl}/api/guidance/v1/web/getBrandShopList?projectCode=${code}`
+ );
+ return recommendList.reduce(
+ (acc, nxt, i) => ({ ...acc, [nxt.shopCode]: i }),
+ {}
+ );
+ } catch (error) {
+ console.error(error);
+ return {};
+ }
+ })(),
(async () => {
try {
const {
@@ -126,6 +145,7 @@ const getMallInfo = async ({ memberID }) => {
return { shopCouponMap: {} };
})(),
]);
+
mall.name = "SKP";
document.title = "成都SKP";
mall.city = "成都";
@@ -189,6 +209,13 @@ const getMallInfo = async ({ memberID }) => {
mapData.buildArr.forEach(({ mapData: { parkArea } }) => {
parkArea.forEach(({ parkNum }) => mall.lots.push(parkNum));
});
+ mall.shops = shopInfo.reduce((acc, { shopList }) => acc.concat(shopList), []);
+ mall.sortedShops = [...mall.shops];
+ mall.sortedShops.sort(
+ (a, b) =>
+ (a.shopCode in recIndexMap ? recIndexMap[a.shopCode] : Infinity) -
+ (b.shopCode in recIndexMap ? recIndexMap[b.shopCode] : Infinity)
+ );
Object.assign(mall, {
floorData: mall.floors,