Commit a416a38b authored by spc's avatar spc

fixed

parent c44f6126
{
"lianliankan": {
"url": "https://momclub-test.feihe.com/h5/game/index.html"
},
"demo":{
"url": "https://www.baidu.com"
}
}
\ No newline at end of file
......@@ -88,18 +88,18 @@ let baseUrl = '' // 默认URL
// 初始化 webview URL
const initWebviewUrl = async () => {
const options = pageOptions.value
console.log('页面参数 options:', options)
// 如果没有直接传入 URL,则从接口获取游戏配置
if (!baseUrl) {
// 从接口获取游戏配置
const configRes = await fetchGameActConfigJSON()
console.log('游戏配置接口返回:', configRes)
if (configRes && configRes.data) {
const gameType = 'lianliankan'
if (configRes.data[gameType] && configRes.data[gameType].url) {
baseUrl = configRes.data[gameType].url
}
// 从链接参数中获取 gameType,默认为 'lianliankan'
const gameType = options.gameType || 'lianliankan'
baseUrl = configRes.data[gameType].url
}
}
......@@ -121,13 +121,18 @@ const initWebviewUrl = async () => {
// scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
const scene = options.scene ? decodeURIComponent(decodeURIComponent(options.scene)) : null
// 清理不需要传递给 H5 的参数
const cleanOptions = { ...options }
delete cleanOptions.scene
delete cleanOptions.url
delete cleanOptions.baseUrl
// gameType 不需要传递给 H5,因为它只是用来选择 baseUrl
delete cleanOptions.gameType
console.warn("scene", scene)
console.warn("cleanOptions", cleanOptions)
console.log("scene 参数:", scene)
console.log("清理后的 options:", cleanOptions)
console.log("原始 options:", options)
// 将 options 的所有参数原样作为查询参数传给 H5,并补齐 cuk
const params = { ...cleanOptions }
......@@ -268,6 +273,15 @@ onLoad(async (options) => {
pageOptions.value = options
console.log('页面参数:', options)
// 设置页面导航栏样式为自定义(去掉默认导航栏)
// #ifdef MP-WEIXIN
wx.setPageStyle({
style: {
navigationStyle: 'custom'
}
})
// #endif
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']// shareAppMessage表示"发送给朋友"按钮,shareTimeline表示"分享到朋友圈"按钮
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment