This commit is contained in:
@@ -411,10 +411,28 @@ const main = async () => {
|
||||
await mkdir(outputDir, { recursive: true })
|
||||
|
||||
const sdkManifest = await getJson(`${apiRoot}/gis/sdk/maps/${encodeURIComponent(mapId)}/manifest`)
|
||||
const accessibleFloors = (sdkManifest.floors || []).filter((floor) => {
|
||||
const selectedFloors = (sdkManifest.floors || []).filter((floor) => {
|
||||
const code = String(floor.floorCode || '').trim().toUpperCase()
|
||||
return Boolean(code && floor.modelUrl && (!requestedFloors.size || requestedFloors.has(code)))
|
||||
return Boolean(code && (!requestedFloors.size || requestedFloors.has(code)))
|
||||
})
|
||||
const accessibleFloors = (await Promise.all(selectedFloors.map(async (floor) => {
|
||||
if (floor.modelUrl) return floor
|
||||
|
||||
const bundle = await getJson(
|
||||
`${apiRoot}/gis/sdk/floors/${encodeURIComponent(String(floor.floorId))}/bundle`
|
||||
)
|
||||
const modelUrl = String(bundle?.model?.modelUrl || '').trim()
|
||||
if (!modelUrl) {
|
||||
throw new Error(`${floor.floorCode}: SDK manifest and floor bundle both lack a model URL`)
|
||||
}
|
||||
return {
|
||||
...floor,
|
||||
modelUrl,
|
||||
modelVersion: String(
|
||||
bundle?.model?.modelVersion || bundle?.dataVersion || floor.modelVersion || sdkManifest.dataVersion || 'unversioned'
|
||||
)
|
||||
}
|
||||
}))).filter(Boolean)
|
||||
const sdkFloorsByCode = new Map((sdkManifest.floors || []).map((floor) => (
|
||||
[String(floor.floorCode || '').trim().toUpperCase(), floor]
|
||||
)))
|
||||
|
||||
@@ -43,20 +43,28 @@ const h5JavaScriptCode = h5JavaScriptFiles
|
||||
.map((filePath) => readText(filePath))
|
||||
.join('\n')
|
||||
|
||||
// H5 uses the embedded Tencent JS map and the backend route service. The
|
||||
// historical external-map handoff must not be required by this bundle check.
|
||||
for (const required of [
|
||||
'第三方',
|
||||
'打开地图',
|
||||
'jweixin',
|
||||
'miniProgram',
|
||||
'/pages/open-location/index',
|
||||
'baidumap://',
|
||||
'iosamap://',
|
||||
'androidamap://'
|
||||
'/gis/outdoor-map',
|
||||
'/routes/plan',
|
||||
'/places/suggestions',
|
||||
'/geocoding/reverse',
|
||||
'重新检测',
|
||||
'手动选择起点',
|
||||
'地图选点',
|
||||
'semanticEnterBuilding'
|
||||
]) {
|
||||
assertContains(h5JavaScriptCode, required, 'H5 全量 JS')
|
||||
}
|
||||
|
||||
for (const forbidden of ['native-location']) {
|
||||
for (const forbidden of [
|
||||
'OutdoorNavigationPanel',
|
||||
'打开地图导航',
|
||||
'baidumap://',
|
||||
'iosamap://',
|
||||
'androidamap://'
|
||||
]) {
|
||||
assertNotContains(h5JavaScriptCode, forbidden, 'H5 全量 JS')
|
||||
}
|
||||
|
||||
@@ -78,32 +86,22 @@ const mpArrivalPanelTemplatePath = path.join(
|
||||
'ArrivalPanel.wxml'
|
||||
)
|
||||
const mpArrivalPanelTemplate = readText(mpArrivalPanelTemplatePath)
|
||||
assertContains(mpArrivalPanelCode, '打开地图导航', 'mp-weixin 来馆组件')
|
||||
assertContains(
|
||||
mpArrivalPanelCode,
|
||||
'../../services/WechatOpenLocationService.js',
|
||||
'mp-weixin 来馆组件'
|
||||
)
|
||||
assertContains(mpArrivalPanelCode, 'typeChange', 'mp-weixin 来馆组件')
|
||||
assertContains(mpArrivalPanelTemplate, '去这里', 'mp-weixin 来馆模板')
|
||||
assertNotContains(mpArrivalPanelCode, 'third-party-providers', 'mp-weixin 来馆组件')
|
||||
assertNotContains(mpArrivalPanelTemplate, 'provider-sheet', 'mp-weixin 来馆模板')
|
||||
assertNotContains(mpArrivalPanelTemplate, '第三方导航', 'mp-weixin 来馆模板')
|
||||
|
||||
const mpAppConfigPath = path.join(mpRoot, 'app.json')
|
||||
const mpAppConfig = JSON.parse(readText(mpAppConfigPath))
|
||||
if (!mpAppConfig.pages?.includes('pages/open-location/index')) {
|
||||
throw new Error('mp-weixin app.json 未注册 open-location 页面')
|
||||
}
|
||||
|
||||
console.log(JSON.stringify({
|
||||
h5: {
|
||||
html: path.relative(projectRoot, htmlPath),
|
||||
entry: path.relative(projectRoot, entryPath),
|
||||
pageChunk: path.relative(projectRoot, pageChunkPath),
|
||||
navigationMode: 'third-party-providers'
|
||||
navigationMode: 'embedded-tencent-map'
|
||||
},
|
||||
mpWeixin: {
|
||||
component: path.relative(projectRoot, mpArrivalPanelPath),
|
||||
template: path.relative(projectRoot, mpArrivalPanelTemplatePath),
|
||||
navigationMode: 'native-location'
|
||||
navigationMode: 'arrival-target-selection'
|
||||
}
|
||||
}, null, 2))
|
||||
|
||||
Reference in New Issue
Block a user