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 ...@@ -88,18 +88,18 @@ let baseUrl = '' // 默认URL
// 初始化 webview URL // 初始化 webview URL
const initWebviewUrl = async () => { const initWebviewUrl = async () => {
const options = pageOptions.value const options = pageOptions.value
console.log('页面参数 options:', options)
// 如果没有直接传入 URL,则从接口获取游戏配置
if (!baseUrl) { if (!baseUrl) {
// 从接口获取游戏配置 // 从接口获取游戏配置
const configRes = await fetchGameActConfigJSON() const configRes = await fetchGameActConfigJSON()
console.log('游戏配置接口返回:', configRes) console.log('游戏配置接口返回:', configRes)
if (configRes && configRes.data) { if (configRes && configRes.data) {
const gameType = 'lianliankan' // 从链接参数中获取 gameType,默认为 'lianliankan'
const gameType = options.gameType || 'lianliankan'
if (configRes.data[gameType] && configRes.data[gameType].url) { baseUrl = configRes.data[gameType].url
baseUrl = configRes.data[gameType].url
}
} }
} }
...@@ -121,13 +121,18 @@ const initWebviewUrl = async () => { ...@@ -121,13 +121,18 @@ const initWebviewUrl = async () => {
// scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene // scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
const scene = options.scene ? decodeURIComponent(decodeURIComponent(options.scene)) : null const scene = options.scene ? decodeURIComponent(decodeURIComponent(options.scene)) : null
// 清理不需要传递给 H5 的参数
const cleanOptions = { ...options } const cleanOptions = { ...options }
delete cleanOptions.scene delete cleanOptions.scene
delete cleanOptions.url delete cleanOptions.url
delete cleanOptions.baseUrl delete cleanOptions.baseUrl
// gameType 不需要传递给 H5,因为它只是用来选择 baseUrl
delete cleanOptions.gameType
console.warn("scene", scene) console.log("scene 参数:", scene)
console.warn("cleanOptions", cleanOptions) console.log("清理后的 options:", cleanOptions)
console.log("原始 options:", options)
// 将 options 的所有参数原样作为查询参数传给 H5,并补齐 cuk // 将 options 的所有参数原样作为查询参数传给 H5,并补齐 cuk
const params = { ...cleanOptions } const params = { ...cleanOptions }
...@@ -268,6 +273,15 @@ onLoad(async (options) => { ...@@ -268,6 +273,15 @@ onLoad(async (options) => {
pageOptions.value = options pageOptions.value = options
console.log('页面参数:', options) console.log('页面参数:', options)
// 设置页面导航栏样式为自定义(去掉默认导航栏)
// #ifdef MP-WEIXIN
wx.setPageStyle({
style: {
navigationStyle: 'custom'
}
})
// #endif
wx.showShareMenu({ wx.showShareMenu({
withShareTicket: true, withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']// shareAppMessage表示"发送给朋友"按钮,shareTimeline表示"分享到朋友圈"按钮 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