Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
飞
飞鹤小程序
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
FH
飞鹤小程序
Commits
a416a38b
Commit
a416a38b
authored
Nov 07, 2025
by
spc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed
parent
c44f6126
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
7 deletions
+29
-7
gameActConfig.json
mock/gameActConfig.json
+8
-0
webview.vue
pages/gameWebview/webview.vue
+21
-7
No files found.
mock/gameActConfig.json
0 → 100644
View file @
a416a38b
{
"lianliankan"
:
{
"url"
:
"https://momclub-test.feihe.com/h5/game/index.html"
},
"demo"
:{
"url"
:
"https://www.baidu.com"
}
}
\ No newline at end of file
pages/gameWebview/webview.vue
View file @
a416a38b
...
@@ -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表示"分享到朋友圈"按钮
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment