统一中间层楼层展示为MF
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-19 16:37:16 +08:00
parent d199b4602f
commit 97788a3e9f
4 changed files with 24 additions and 3 deletions

View File

@@ -19,11 +19,13 @@ export const formatNavFloorLabel = (floorId: string) => {
const value = Number(match[1])
if (Number.isNaN(value)) return floorId
if (value === 1.5) return 'MF'
return value < 0 ? `B${Math.abs(value)}` : `${value}F`
}
export const navFloorIdFromLabel = (labelOrId: string) => {
if (floorIdPattern.test(labelOrId)) return labelOrId
if (labelOrId.trim().toUpperCase() === 'MF') return 'L1.5'
const basementMatch = labelOrId.match(/^B(\d+(?:\.\d+)?)$/i)
if (basementMatch) return `L-${basementMatch[1]}`

View File

@@ -225,8 +225,8 @@ export const formatSgsFloorLabel = (floorCode?: string | null, floorName?: strin
const basementMatch = floorCode?.match(/^L-(\d+(?:\.\d+)?)$/)
if (basementMatch) return `B${basementMatch[1]}`
const floorMatch = floorCode?.match(/^L(\d+(?:\.\d+)?)$/)
if (floorMatch) return `${floorMatch[1]}F`
const floorMatch = floorCode?.match(/^L(\d+(?:\.\d+)?)$/)
if (floorMatch) return floorMatch[1] === '1.5' ? 'MF' : `${floorMatch[1]}F`
return floorName || floorCode || '未知楼层'
}