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
e1325640
Commit
e1325640
authored
Nov 05, 2025
by
spc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed
parent
234b1e4a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
7 deletions
+27
-7
home.js
api/home.js
+3
-1
webview.vue
pages/gameWebview/webview.vue
+24
-6
No files found.
api/home.js
View file @
e1325640
...
...
@@ -14,4 +14,6 @@ export const fetchHomeInfo = () => api.get('/c/user/index');
export
const
fetchCanEatIndex
=
()
=>
api
.
get
(
'/c/eat/index'
);
export
const
fetchCanEatJoin
=
(
data
)
=>
api
.
post
(
'/c/eat/join'
,
data
);
export
const
fetchHomeJSON
=
()
=>
api
.
get
(
'/c/front/content'
,{
type
:
'home_V1'
});
export
const
fetchHomeJSON
=
()
=>
api
.
get
(
'/c/front/content'
,
{
type
:
'home_V1'
});
export
const
fetchGameActConfigJSON
=
()
=>
api
.
get
(
'/c/front/content'
,
{
type
:
'gameActConfig'
});
pages/gameWebview/webview.vue
View file @
e1325640
<
template
>
<view
class=
"webview-container"
>
<!-- Webview内容 -->
<web-view
:src=
"webviewUrl"
:key=
"webviewUrl"
@
message=
"getMessage"
class=
"webview-content"
></web-view>
<web-view
:src=
"webviewUrl"
:key=
"webviewUrl"
@
message=
"getMessage"
class=
"webview-content"
></web-view>
</view>
</
template
>
...
...
@@ -11,6 +10,7 @@ import { ref, watch, nextTick } from 'vue'
import
{
useUserStore
}
from
'@/stores/user.js'
import
{
useGlobalStore
}
from
'../../stores/global'
import
{
fetchSyWebviewJSON
}
from
'../../api/sywebview'
import
{
fetchGameActConfigJSON
}
from
'../../api/home'
import
{
onLoad
,
onShow
,
onShareAppMessage
,
onShareTimeline
,
onPageScroll
}
from
"@dcloudio/uni-app"
;
import
{
jump
,
JumpType
}
from
'../../utils'
import
md
from
'../../md'
;
...
...
@@ -80,16 +80,35 @@ const getMessage = (e) => {
share
.
value
=
messageData
[
messageData
.
length
-
1
]
}
}
let
baseUrl
=
''
// 默认URL
// 初始化 webview URL
const
initWebviewUrl
=
async
()
=>
{
// 使用固定的基础URL,从 options 中获取或使用默认值
const
options
=
pageOptions
.
value
let
baseUrl
=
'https://momclub-test.feihe.com/h5/game/index.html'
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
}
}
}
if
(
!
baseUrl
)
{
uni
.
redirectTo
({
url
:
'/pages/index/index'
})
return
}
// 如果 baseUrl 已经包含协议,直接使用;否则添加协议
if
(
!
baseUrl
.
startsWith
(
'http://'
)
&&
!
baseUrl
.
startsWith
(
'https://'
))
{
...
...
@@ -205,7 +224,6 @@ watch(() => registered.value, (newVal, oldVal) => {
if
(
newVal
)
{
nextTick
(()
=>
{
initWebviewUrl
()
initWebviewUrl
()
})
}
})
...
...
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