整理文档并接入 H5 体验测试链路

This commit is contained in:
2026-03-27 15:36:27 +08:00
parent 0e025c3426
commit 0e0a724025
55 changed files with 4177 additions and 55 deletions

View File

@@ -8,6 +8,7 @@ import {
} from '../../engine/map/mapEngine'
import { loadRemoteMapConfig } from '../../utils/remoteMapConfig'
import { type AnimationLevel } from '../../utils/animationLevel'
import { type H5ExperienceFallbackPayload, type H5ExperienceRequest } from '../../game/experience/h5Experience'
type CompassTickData = {
angle: number
long: boolean
@@ -848,8 +849,8 @@ Page({
mapEngine = null
}
mapEngine = new MapEngine(INTERNAL_BUILD_VERSION, {
onData: (patch) => {
mapEngine = new MapEngine(INTERNAL_BUILD_VERSION, {
onData: (patch) => {
const nextPatch = patch as Partial<MapPageData>
const includeDebugFields = this.data.showDebugPanel
const includeRulerFields = this.data.showCenterScaleRuler
@@ -988,11 +989,14 @@ Page({
})
}
if (this.data.showGameInfoPanel) {
this.scheduleGameInfoPanelSnapshotSync()
}
},
})
if (this.data.showGameInfoPanel) {
this.scheduleGameInfoPanelSnapshotSync()
}
},
onOpenH5Experience: (request) => {
this.openH5Experience(request)
},
})
const storedUserSettings = loadStoredUserSettings()
if (storedUserSettings.animationLevel) {
@@ -1390,6 +1394,12 @@ Page({
mapEngine.handleConnectMockHeartRateBridge()
},
handleOpenWebViewTest() {
wx.navigateTo({
url: '/pages/webview-test/webview-test',
})
},
handleMockBridgeUrlInput(event: WechatMiniprogram.Input) {
this.setData({
mockBridgeUrlDraft: event.detail.value,
@@ -1887,6 +1897,42 @@ Page({
}
},
handleOpenPendingContentCard() {
if (mapEngine) {
mapEngine.openPendingContentCard()
}
},
openH5Experience(request: H5ExperienceRequest) {
wx.navigateTo({
url: '/pages/experience-webview/experience-webview',
success: (result) => {
const eventChannel = result.eventChannel
eventChannel.on('fallback', (payload: H5ExperienceFallbackPayload) => {
if (mapEngine) {
mapEngine.handleH5ExperienceFallback(payload)
}
})
eventChannel.on('close', () => {
if (mapEngine) {
mapEngine.handleH5ExperienceClosed()
}
})
eventChannel.on('submitResult', () => {
if (mapEngine) {
mapEngine.handleH5ExperienceClosed()
}
})
eventChannel.emit('init', request)
},
fail: () => {
if (mapEngine) {
mapEngine.handleH5ExperienceFallback(request.fallback)
}
},
})
},
handleCloseContentCard() {
if (mapEngine) {
mapEngine.closeContentCard()