From 9f43fe468cef9edaa75c79c16490a0499b9f05c8 Mon Sep 17 00:00:00 2001 From: jiannibang <271381693@qq.com> Date: Mon, 31 Jul 2023 13:25:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=201F2F=E8=A7=86=E4=B8=BA=E7=9B=B8?= =?UTF-8?q?=E5=B7=AE=E4=B8=80=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data-helper.js | 17 +++++++++++++---- project.config.json | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/data-helper.js b/data-helper.js index c7aeee0..36224fc 100644 --- a/data-helper.js +++ b/data-helper.js @@ -25,7 +25,10 @@ const FacilityCodeMap = { bc: 26, etxsj: 69, }; - +const floorDiffMap = { + "3_5": 1, + "5_3": 1, +}; export const attachGraphSingle = ({ graph, key, value }) => { graph[key] = { ...graph[key], @@ -256,8 +259,14 @@ export const handleData = ( const { floorOrder: floorOrderJ, NavPoint: des } = list[j]; const leftKey = floorOrderI + "_" + src; const rightKey = floorOrderJ + "_" + des; - const floorDiff = Math.abs(floorOrderI - floorOrderJ); const isUp = Number(floorOrderJ) > Number(floorOrderI); + const floorDiffKey = isUp + ? `${floorOrderI}_${floorOrderJ}` + : `${floorOrderJ}_${floorOrderI}`; + const floorDiff = + floorDiffKey in floorDiffMap && floorDiffMap + ? floorDiffMap[floorDiffKey] + : Math.abs(floorOrderI - floorOrderJ); if (ftData[leftKey]) return; if (ftData[rightKey]) return; const leftValue = { @@ -266,7 +275,7 @@ export const handleData = ( ? Infinity : list.isEscalator ? 7000 * floorDiff - : 10000 + floorDiff * 1000, + : 7000 + floorDiff * 1000, }; const rightValue = { [leftKey]: @@ -274,7 +283,7 @@ export const handleData = ( ? Infinity : list.isEscalator ? 7000 * floorDiff - : 10000 + floorDiff * 1000, + : 7000 + floorDiff * 1000, }; attachGraph({ graph, diff --git a/project.config.json b/project.config.json index 8c80c18..658e90a 100644 --- a/project.config.json +++ b/project.config.json @@ -2,7 +2,7 @@ "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", "cloudfunctionRoot": "cloudfunctions/", "setting": { - "urlCheck": false, + "urlCheck": true, "es6": false, "enhance": true, "postcss": true,