Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fc-minigame
Project
Project
Details
Activity
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈冲
fc-minigame
Commits
d82cb786
Commit
d82cb786
authored
Jun 17, 2026
by
陈冲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复
parent
5e0ea925
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
70 additions
and
66 deletions
+70
-66
socket_io.rs
backend/src/protocols/socket_io.rs
+4
-0
Game.vue
frontend-h5/src/pages/game2/Game.vue
+12
-5
PlayingView.vue
frontend-h5/src/pages/game2/views/PlayingView.vue
+1
-1
Game3.vue
frontend-h5/src/pages/game3/Game3.vue
+13
-6
Game4.vue
frontend-h5/src/pages/game4/Game4.vue
+21
-41
ScoreView.vue
frontend-h5/src/pages/game4/views/ScoreView.vue
+2
-1
Game5.vue
frontend-h5/src/pages/game5/Game5.vue
+16
-10
Game.vue
frontend-h5/src/pages/game6/Game.vue
+1
-1
PlayingView.vue
frontend-h5/src/pages/game6/views/PlayingView.vue
+0
-1
No files found.
backend/src/protocols/socket_io.rs
View file @
d82cb786
...
@@ -827,6 +827,10 @@ async fn handle_room_command(
...
@@ -827,6 +827,10 @@ async fn handle_room_command(
round_id
,
round_id
,
GAME_START_COUNTDOWN_SECS
+
GAME_RUNNING_SECS
+
GAME_RESULT_WAIT_SECS
,
GAME_START_COUNTDOWN_SECS
+
GAME_RUNNING_SECS
+
GAME_RESULT_WAIT_SECS
,
);
);
// broadcast_msgpack_all_player(evt, &ok_resp(Some(json!({
// "index":game_index,
// ""
// }))));
broadcast_msgpack_all_player
(
evt
,
&
ok_resp
(
Some
(
json!
(
game_index
))));
broadcast_msgpack_all_player
(
evt
,
&
ok_resp
(
Some
(
json!
(
game_index
))));
//通知管理员
//通知管理员
emit_msgpack
(
&
socket
,
evt
,
&
ok_resp
(
Some
(
json!
(
game_index
))));
emit_msgpack
(
&
socket
,
evt
,
&
ok_resp
(
Some
(
json!
(
game_index
))));
...
...
frontend-h5/src/pages/game2/Game.vue
View file @
d82cb786
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
{
computed
,
onBeforeUnmount
,
onMounted
,
ref
}
from
'vue'
import
{
computed
,
onBeforeUnmount
,
onMounted
,
ref
}
from
'vue'
import
{
cssAssetUrl
}
from
'@/commons/assets.ts'
import
{
cssAssetUrl
}
from
'@/commons/assets.ts'
import
MobileStage
from
'@/components/MobileStage.vue'
import
MobileStage
from
'@/components/MobileStage.vue'
import
{
useGameSocket
,
sendGameMessage
,
userJoinStatus
,
joinSharedRoom
}
from
'@/composables/useGameSocket'
import
{
useGameSocket
,
sendGameMessage
,
userJoinStatus
,
userTop10RankStatus
,
joinSharedRoom
}
from
'@/composables/useGameSocket'
import
LoadingView
from
'./views/LoadingView.vue'
import
LoadingView
from
'./views/LoadingView.vue'
import
PlayingView
from
'./views/PlayingView.vue'
import
PlayingView
from
'./views/PlayingView.vue'
import
{
$format_str
,
$getWechat
,
$toast
}
from
'@/commons/utils.ts'
import
{
$format_str
,
$getWechat
,
$toast
}
from
'@/commons/utils.ts'
...
@@ -116,9 +116,16 @@ function startGameCountdown(seconds = 60) {
...
@@ -116,9 +116,16 @@ function startGameCountdown(seconds = 60) {
if
(
countdownInterval
.
value
<=
0
)
{
if
(
countdownInterval
.
value
<=
0
)
{
countdownInterval
.
value
=
0
countdownInterval
.
value
=
0
gameCountdownTimer
=
undefined
gameCountdownTimer
=
undefined
setDivDescVisible
(
false
)
currentView
.
value
===
'loading'
submitScore
(
true
)
if
(
userTop10RankStatus
.
value
)
{
showGameOverRank
()
userJoinStatus
.
value
=
false
;
showGameRank
.
value
=
false
;
$toast
(
'一人只能上榜领奖一次,您的福利已到手,把机会留给其他玩家吧'
,
30000
)
}
else
{
setDivDescVisible
(
false
)
submitScore
(
true
)
showGameOverRank
()
}
return
return
}
}
...
@@ -404,7 +411,7 @@ const rankCloseHandler = () => {
...
@@ -404,7 +411,7 @@ const rankCloseHandler = () => {
width
:
57px
;
width
:
57px
;
height
:
57px
;
height
:
57px
;
background
:
v-bind
(
'imageUrls.close'
)
center
/
cover
no-repeat
;
background
:
v-bind
(
'imageUrls.close'
)
center
/
cover
no-repeat
;
transform
:
translateX
(
-50%
)
scale
(
1.5
);
transform
:
translateX
(
-50%
)
scale
(
1.5
);
position
:
absolute
;
position
:
absolute
;
top
:
-73px
;
top
:
-73px
;
left
:
100%
;
left
:
100%
;
...
...
frontend-h5/src/pages/game2/views/PlayingView.vue
View file @
d82cb786
...
@@ -6,7 +6,7 @@ defineProps<{
...
@@ -6,7 +6,7 @@ defineProps<{
countdownInterval
:
number
countdownInterval
:
number
isDivDescVisible
:
boolean
isDivDescVisible
:
boolean
tick
:
number
tick
:
number
rank
:
number
rank
:
number
,
// currentGu: string
// currentGu: string
}
>
()
}
>
()
...
...
frontend-h5/src/pages/game3/Game3.vue
View file @
d82cb786
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
{
computed
,
onBeforeUnmount
,
onMounted
,
ref
}
from
'vue'
import
{
computed
,
onBeforeUnmount
,
onMounted
,
ref
}
from
'vue'
import
{
cssAssetUrl
}
from
'@/commons/assets.ts'
import
{
cssAssetUrl
}
from
'@/commons/assets.ts'
import
MobileStage
from
'@/components/MobileStage.vue'
import
MobileStage
from
'@/components/MobileStage.vue'
import
{
useGameSocket
,
joinSharedRoom
,
sendGameMessage
,
userJoinStatus
}
from
'@/composables/useGameSocket'
import
{
useGameSocket
,
joinSharedRoom
,
sendGameMessage
,
userJoinStatus
,
userTop10RankStatus
}
from
'@/composables/useGameSocket'
import
LoadingView
from
'./views/LoadingView.vue'
import
LoadingView
from
'./views/LoadingView.vue'
import
PlayingView
from
'./views/PlayingView.vue'
import
PlayingView
from
'./views/PlayingView.vue'
import
{
$getWechat
,
$toast
,
$is_run_local
}
from
'@/commons/utils.ts'
import
{
$getWechat
,
$toast
,
$is_run_local
}
from
'@/commons/utils.ts'
...
@@ -134,9 +134,16 @@ function startGameCountdown(seconds = 60) {
...
@@ -134,9 +134,16 @@ function startGameCountdown(seconds = 60) {
if
(
countdownInterval
.
value
<=
0
)
{
if
(
countdownInterval
.
value
<=
0
)
{
countdownInterval
.
value
=
0
countdownInterval
.
value
=
0
gameCountdownTimer
=
undefined
gameCountdownTimer
=
undefined
setDivDescVisible
(
false
)
currentView
.
value
===
'loading'
submitScore
(
true
)
if
(
userTop10RankStatus
.
value
)
{
showGameOverRank
()
userJoinStatus
.
value
=
false
;
showGameRank
.
value
=
false
;
$toast
(
'一人只能上榜领奖一次,您的福利已到手,把机会留给其他玩家吧'
,
30000
)
}
else
{
setDivDescVisible
(
false
)
submitScore
(
true
)
showGameOverRank
()
}
return
return
}
}
...
@@ -321,8 +328,8 @@ const rankCloseHandler = () => {
...
@@ -321,8 +328,8 @@ const rankCloseHandler = () => {
</
script
>
</
script
>
<
template
>
<
template
>
<MobileStage
v-if=
"token || isLocalMode"
:showGameRule=
"showGameRule"
:showGameRank=
"showGameRank"
ref=
"mobileStageRef"
<MobileStage
v-if=
"token || isLocalMode"
:showGameRule=
"showGameRule"
:showGameRank=
"showGameRank"
:background=
"`$
{renderBG()}`">
ref=
"mobileStageRef"
:background=
"`$
{renderBG()}`">
<template
#
gameRule
>
<template
#
gameRule
>
<div
class=
"rule-container"
>
<div
class=
"rule-container"
>
<div
class=
"rule-txt-container"
>
<div
class=
"rule-txt-container"
>
...
...
frontend-h5/src/pages/game4/Game4.vue
View file @
d82cb786
...
@@ -7,6 +7,7 @@ import {
...
@@ -7,6 +7,7 @@ import {
sendGameMessage
,
sendGameMessage
,
userJoinStatus
,
userJoinStatus
,
joinSharedRoom
,
joinSharedRoom
,
userTop10RankStatus
,
}
from
"@/composables/useGameSocket"
;
}
from
"@/composables/useGameSocket"
;
import
LoadingView
from
"./views/LoadingView.vue"
;
import
LoadingView
from
"./views/LoadingView.vue"
;
import
PlayingView
from
"./views/PlayingView.vue"
;
import
PlayingView
from
"./views/PlayingView.vue"
;
...
@@ -111,9 +112,15 @@ function startGameCountdown(seconds = 60) {
...
@@ -111,9 +112,15 @@ function startGameCountdown(seconds = 60) {
if
(
countdownInterval
.
value
<=
0
)
{
if
(
countdownInterval
.
value
<=
0
)
{
countdownInterval
.
value
=
0
;
countdownInterval
.
value
=
0
;
gameCountdownTimer
=
undefined
;
gameCountdownTimer
=
undefined
;
setDivDescVisible
(
false
);
if
(
userTop10RankStatus
.
value
)
{
submitScore
(
true
);
userJoinStatus
.
value
=
false
;
showScoreView
();
// showGameRank.value = false;
$toast
(
'一人只能上榜领奖一次,您的福利已到手,把机会留给其他玩家吧'
,
30000
)
}
else
{
setDivDescVisible
(
false
);
submitScore
(
true
);
showScoreView
();
}
return
;
return
;
}
}
...
@@ -173,9 +180,9 @@ function replayGame() {
...
@@ -173,9 +180,9 @@ function replayGame() {
startGameView
();
startGameView
();
}
}
function
backToWaiting
()
{}
function
backToWaiting
()
{
}
function
handleRoomBack
()
{}
function
handleRoomBack
()
{
}
const
touchHandler
=
()
=>
{
const
touchHandler
=
()
=>
{
tick
.
value
+=
5
;
tick
.
value
+=
5
;
...
@@ -257,12 +264,7 @@ onBeforeUnmount(() => {
...
@@ -257,12 +264,7 @@ onBeforeUnmount(() => {
</
script
>
</
script
>
<
template
>
<
template
>
<MobileStage
<MobileStage
v-if=
"token"
:showGameRule=
"showGameRule"
ref=
"mobileStageRef"
:background=
"stageBackground"
>
v-if=
"token"
:showGameRule=
"showGameRule"
ref=
"mobileStageRef"
:background=
"stageBackground"
>
<template
#
gameRule
>
<template
#
gameRule
>
<div
class=
"rule-container"
>
<div
class=
"rule-container"
>
<div
class=
"rule-txt-container"
>
<div
class=
"rule-txt-container"
>
...
@@ -280,43 +282,21 @@ onBeforeUnmount(() => {
...
@@ -280,43 +282,21 @@ onBeforeUnmount(() => {
</div>
</div>
</div>
</div>
</
template
>
</
template
>
<LoadingView
<LoadingView
v-if=
"currentView === 'loading'"
:image-urls=
"imageUrls"
:user-join-status=
"userJoinStatus"
v-if=
"currentView === 'loading'"
@
touchGameRule=
"showGameRuleHandler"
/>
:image-urls=
"imageUrls"
:user-join-status=
"userJoinStatus"
@
touchGameRule=
"showGameRuleHandler"
/>
<!-- <PlayingView v-else :image-urls="imageUrls" :tick="tick" :rank="rank" -->
<!-- <PlayingView v-else :image-urls="imageUrls" :tick="tick" :rank="rank" -->
<PlayingView
<PlayingView
v-else-if=
"currentView === 'playing'"
:image-urls=
"imageUrls"
:tick=
"tick"
:rank=
"rank"
v-else-if=
"currentView === 'playing'"
:currentHorse=
"currentHorse"
:currentYaoyiyao=
"currentYaoyiyao"
:countdown-interval=
"countdownInterval"
:image-urls=
"imageUrls"
:is-div-desc-visible=
"isDivDescVisible"
@
touch=
"touchHandler"
/>
:tick=
"tick"
<ScoreView
v-else
:image-urls=
"imageUrls"
:tick=
"tick"
:level=
"rank"
@
replay=
"replayGame"
@
back=
"backToWaiting"
/>
:rank=
"rank"
:currentHorse=
"currentHorse"
:currentYaoyiyao=
"currentYaoyiyao"
:countdown-interval=
"countdownInterval"
:is-div-desc-visible=
"isDivDescVisible"
@
touch=
"touchHandler"
/>
<ScoreView
v-else
:image-urls=
"imageUrls"
:tick=
"tick"
:level=
"rank"
@
replay=
"replayGame"
@
back=
"backToWaiting"
/>
</MobileStage>
</MobileStage>
<div
<div
v-else
style=
"
v-else
style=
"
text-align: center;
text-align: center;
width: 100vw;
width: 100vw;
height: 100vh;
height: 100vh;
line-height: 30;
line-height: 30;
font-size: 20px;
font-size: 20px;
"
"
>
>
请使用微信扫码进入游戏
请使用微信扫码进入游戏
</div>
</div>
</template>
</template>
...
...
frontend-h5/src/pages/game4/views/ScoreView.vue
View file @
d82cb786
...
@@ -34,7 +34,8 @@ onMounted(() => {
...
@@ -34,7 +34,8 @@ onMounted(() => {
<div></div>
<div></div>
<div>
{{
tick
}}
</div>
<div>
{{
tick
}}
</div>
<div>
最终排名
</div>
<div>
最终排名
</div>
<div>
第
<label>
{{
level
}}
</label>
名
</div>
<div
v-if=
"level>0"
>
第
<label>
{{
level
}}
</label>
名
</div>
<div
v-else
>
未上榜
</div>
</div>
</div>
</div>
</div>
<!--
<div
class=
"btn-group"
>
<!--
<div
class=
"btn-group"
>
...
...
frontend-h5/src/pages/game5/Game5.vue
View file @
d82cb786
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
{
computed
,
onBeforeUnmount
,
onMounted
,
ref
}
from
'vue'
import
{
computed
,
onBeforeUnmount
,
onMounted
,
ref
}
from
'vue'
import
{
assetUrl
,
cssAssetUrl
}
from
'@/commons/assets.ts'
import
{
assetUrl
,
cssAssetUrl
}
from
'@/commons/assets.ts'
import
MobileStage
from
'@/components/MobileStage.vue'
import
MobileStage
from
'@/components/MobileStage.vue'
import
{
useGameSocket
,
sendGameMessage
,
userJoinStatus
,
joinSharedRoom
}
from
'@/composables/useGameSocket'
import
{
useGameSocket
,
sendGameMessage
,
userJoinStatus
,
joinSharedRoom
,
userTop10RankStatus
}
from
'@/composables/useGameSocket'
import
LoadingView
from
'./views/LoadingView.vue'
import
LoadingView
from
'./views/LoadingView.vue'
import
PlayingView
from
'./views/PlayingView.vue'
import
PlayingView
from
'./views/PlayingView.vue'
import
ScoreView
from
'./views/ScoreView.vue'
import
ScoreView
from
'./views/ScoreView.vue'
...
@@ -162,9 +162,15 @@ function startGameCountdown(seconds = 60) {
...
@@ -162,9 +162,15 @@ function startGameCountdown(seconds = 60) {
if
(
countdownInterval
.
value
<=
0
)
{
if
(
countdownInterval
.
value
<=
0
)
{
countdownInterval
.
value
=
0
countdownInterval
.
value
=
0
gameCountdownTimer
=
undefined
gameCountdownTimer
=
undefined
setDivDescVisible
(
false
)
if
(
userTop10RankStatus
.
value
)
{
submitScore
(
true
)
userJoinStatus
.
value
=
false
;
showGameOverRank
()
// showGameRank.value = false;
$toast
(
'一人只能上榜领奖一次,您的福利已到手,把机会留给其他玩家吧'
,
30000
)
}
else
{
setDivDescVisible
(
false
)
submitScore
(
true
)
showGameOverRank
()
}
return
return
}
}
...
@@ -252,7 +258,7 @@ if (wechat) {
...
@@ -252,7 +258,7 @@ if (wechat) {
userid
:
wechat
.
token
,
userid
:
wechat
.
token
,
},
},
onConnect
:
()
=>
{
onConnect
:
()
=>
{
window
.
setTimeout
(()
=>
{
window
.
setTimeout
(()
=>
{
const
joined
=
joinSharedRoom
(
nickname
.
value
,
token
.
value
,
avatar
.
value
,
gameId
)
const
joined
=
joinSharedRoom
(
nickname
.
value
,
token
.
value
,
avatar
.
value
,
gameId
)
},
200
)
},
200
)
},
},
...
@@ -363,14 +369,14 @@ const rankCloseHandler = () => {
...
@@ -363,14 +369,14 @@ const rankCloseHandler = () => {
<div
class=
"row row-3"
>
<div
class=
"row row-3"
>
<div
class=
"col-1"
>
{{
rank
>
0
?
rank
:
'未上榜'
}}
</div>
<div
class=
"col-1"
>
{{
rank
>
0
?
rank
:
'未上榜'
}}
</div>
<div
class=
"col-2"
>
<div
class=
"col-2"
>
<div
class=
"avatar"
:style=
"
{ backgroundImage: `url(${avatar})`,top: '27px' }">
</div>
<div
class=
"avatar"
:style=
"
{ backgroundImage: `url(${avatar})`,
top: '27px' }">
</div>
<div>
{{
nickname
}}
</div>
<div>
{{
nickname
}}
</div>
</div>
</div>
<div
class=
"col-3"
>
{{
tick
}}
</div>
<div
class=
"col-3"
>
{{
tick
}}
</div>
</div>
</div>
</div>
</div>
<div
class=
"img-close"
@
click=
"rankCloseHandler"
></div>
<div
class=
"img-close"
@
click=
"rankCloseHandler"
></div>
</div>
</div>
</
template
>
</
template
>
<
template
#
gameRule
>
<
template
#
gameRule
>
<div
class=
"rule-container"
>
<div
class=
"rule-container"
>
...
@@ -389,8 +395,8 @@ const rankCloseHandler = () => {
...
@@ -389,8 +395,8 @@ const rankCloseHandler = () => {
</
template
>
</
template
>
<LoadingView
v-if=
"currentView === 'loading'"
:image-urls=
"imageUrls"
:user-join-status=
"userJoinStatus"
<LoadingView
v-if=
"currentView === 'loading'"
:image-urls=
"imageUrls"
:user-join-status=
"userJoinStatus"
@
touchGameRule=
"showGameRuleHandler"
/>
@
touchGameRule=
"showGameRuleHandler"
/>
<!-- <PlayingView v-else :image-urls="imageUrls" :tick="tick" :rank="rank" -->
<!-- <PlayingView v-else :image-urls="imageUrls" :tick="tick" :rank="rank" -->
<PlayingView
v-else-if=
"currentView === 'playing'"
:image-urls=
"imageUrls"
:tick=
"tick"
:rank=
"rank"
<PlayingView
v-else-if=
"currentView === 'playing'"
:image-urls=
"imageUrls"
:tick=
"tick"
:rank=
"rank"
:current-gu=
"currentGu"
:countdown-interval=
"countdownInterval"
:is-div-desc-visible=
"isDivDescVisible"
:current-gu=
"currentGu"
:countdown-interval=
"countdownInterval"
:is-div-desc-visible=
"isDivDescVisible"
@
hit=
"hitHandler"
/>
@
hit=
"hitHandler"
/>
<!-- <ScoreView v-else :image-urls="imageUrls" :rank="rank" :tick="tick" /> -->
<!-- <ScoreView v-else :image-urls="imageUrls" :rank="rank" :tick="tick" /> -->
...
@@ -429,7 +435,7 @@ const rankCloseHandler = () => {
...
@@ -429,7 +435,7 @@ const rankCloseHandler = () => {
width
:
57px
;
width
:
57px
;
height
:
57px
;
height
:
57px
;
background
:
v-bind
(
'imageUrls.close'
)
center
/
cover
no-repeat
;
background
:
v-bind
(
'imageUrls.close'
)
center
/
cover
no-repeat
;
transform
:
translateX
(
-50%
)
scale
(
1.5
);
transform
:
translateX
(
-50%
)
scale
(
1.5
);
position
:
absolute
;
position
:
absolute
;
top
:
-73px
;
top
:
-73px
;
left
:
100%
;
left
:
100%
;
...
...
frontend-h5/src/pages/game6/Game.vue
View file @
d82cb786
...
@@ -370,7 +370,7 @@ const rankCloseHandler = () => {
...
@@ -370,7 +370,7 @@ const rankCloseHandler = () => {
<LoadingView
v-if=
"currentView === 'loading'"
:image-urls=
"imageUrls"
:user-join-status=
"userJoinStatus"
<LoadingView
v-if=
"currentView === 'loading'"
:image-urls=
"imageUrls"
:user-join-status=
"userJoinStatus"
@
touchGameRule=
"showGameRuleHandler"
/>
@
touchGameRule=
"showGameRuleHandler"
/>
<PlayingView
v-else
:image-urls=
"imageUrls"
:tick=
"score"
:rank=
"rank"
:countdown-interval=
"countdownInterval"
<PlayingView
v-else
:image-urls=
"imageUrls"
:tick=
"score"
:rank=
"rank"
:countdown-interval=
"countdownInterval"
:is-div-desc-visible=
"isDivDescVisible"
@
touch=
"touchHandler"
:userTop10RankStatus=
"userTop10RankStatus"
/>
:is-div-desc-visible=
"isDivDescVisible"
@
touch=
"touchHandler"
/>
</MobileStage>
</MobileStage>
<div
v-else
style=
"text-align: center; width: 100vw; height: 100vh; line-height: 30; font-size: 20px;"
>
<div
v-else
style=
"text-align: center; width: 100vw; height: 100vh; line-height: 30; font-size: 20px;"
>
请使用微信扫码进入游戏
请使用微信扫码进入游戏
...
...
frontend-h5/src/pages/game6/views/PlayingView.vue
View file @
d82cb786
...
@@ -7,7 +7,6 @@ defineProps<{
...
@@ -7,7 +7,6 @@ defineProps<{
isDivDescVisible
:
boolean
isDivDescVisible
:
boolean
tick
:
number
tick
:
number
rank
:
number
rank
:
number
userTop10RankStatus
:
boolean
}
>
()
}
>
()
const
emit
=
defineEmits
<
{
const
emit
=
defineEmits
<
{
...
...
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