完善原生内容卡与H5详情分工

This commit is contained in:
2026-03-27 21:03:55 +08:00
parent 0e0a724025
commit 0703fd47a2
21 changed files with 903 additions and 83 deletions

View File

@@ -39,19 +39,29 @@ function emitCloseAndBack(payload) {
Page({
data: {
pageTitle: '内容体验',
pageSubtitle: '',
presentation: 'sheet',
webViewSrc: '',
webViewReady: false,
loadErrorText: '',
panelBodyHeightPx: 420,
},
onLoad() {
const systemInfo = wx.getSystemInfoSync()
const windowHeight = typeof systemInfo.windowHeight === 'number' ? systemInfo.windowHeight : 700
pageResolved = false
currentRequest = null
currentEventChannel = null
this.setData({
pageTitle: '内容体验',
pageSubtitle: '',
presentation: 'sheet',
webViewSrc: '',
webViewReady: false,
loadErrorText: '',
panelBodyHeightPx: Math.max(420, Math.floor(windowHeight * 0.62)),
})
try {
@@ -66,14 +76,21 @@ Page({
currentEventChannel.on('init', (request) => {
currentRequest = request
wx.setNavigationBarTitle({
title: request.title || '内容体验',
fail() {},
})
const presentation = request.presentation || 'sheet'
const panelHeightPx = presentation === 'dialog'
? Math.max(420, Math.floor(windowHeight * 0.7))
: presentation === 'fullscreen'
? Math.max(520, windowHeight - 24)
: Math.max(420, Math.floor(windowHeight * 0.72))
const headerHeightPx = presentation === 'fullscreen' ? 84 : 76
this.setData({
pageTitle: request.title || '内容体验',
pageSubtitle: request.subtitle || '',
presentation,
webViewSrc: buildWebViewSrc(request),
webViewReady: true,
loadErrorText: '',
panelBodyHeightPx: Math.max(240, panelHeightPx - headerHeightPx),
})
})
},
@@ -124,4 +141,8 @@ Page({
})
emitFallbackAndClose()
},
handleCloseTap() {
emitCloseAndBack({})
},
})