From 07e667b0511d7354b9c7e4657ee1b0a86b36d4ef Mon Sep 17 00:00:00 2001 From: xixiibn5100 <1584914306@qq.com> Date: Tue, 17 Dec 2024 15:25:47 +0800 Subject: [PATCH 1/2] fix(freeRoom): unexpected undefined buildName --- src/constants/freeroomMap.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/constants/freeroomMap.ts b/src/constants/freeroomMap.ts index db72a901..c833cc70 100644 --- a/src/constants/freeroomMap.ts +++ b/src/constants/freeroomMap.ts @@ -1,4 +1,5 @@ export const freeroomMap = { + 机: "机械楼", 子: "子良楼", 教: "新教楼", 文: "文荟楼", From a63fdbbe33b6814aa915940a3aac28366fe4e190 Mon Sep 17 00:00:00 2001 From: xixiibn5100 <1584914306@qq.com> Date: Sat, 4 Jan 2025 14:00:31 +0800 Subject: [PATCH 2/2] perf(freeRoom): add freeroomMap catch-all logic --- src/pages/freeroom/index.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/pages/freeroom/index.vue b/src/pages/freeroom/index.vue index c65155c1..aa4772bb 100644 --- a/src/pages/freeroom/index.vue +++ b/src/pages/freeroom/index.vue @@ -61,9 +61,10 @@ const building = computed(() => { const tmp: Record = {}; serviceStore.zf.roomInfo.data?.forEach((item: Room) => { - if (!tmp[freeroomMap[item.buildName[0]]]) - tmp[freeroomMap[item.buildName[0]]] = []; - tmp[freeroomMap[item.buildName[0]]].push(item); + // TODO: 上报无教学楼匹配 + const fullBuildName = freeroomMap[item.buildName[0]] || "未知教室"; + if (!tmp[fullBuildName]) tmp[fullBuildName] = []; + tmp[fullBuildName].push(item); }); Object.keys(tmp).forEach((key) => { buildingList.push({