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
25744edd
Commit
25744edd
authored
Jun 12, 2026
by
董政锦
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' into 'fix--game3-PC马的渲染'
# Conflicts: # frontend-h5/src/pages/game3/Game3.vue
parents
f807008f
c29b01c5
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
174 additions
and
62 deletions
+174
-62
socket_io.rs
backend/src/protocols/socket_io.rs
+36
-10
close.png
frontend-h5/src/assets/images/game1/close.png
+0
-0
utils.ts
frontend-h5/src/commons/utils.ts
+23
-2
useGameSocket.ts
frontend-h5/src/composables/useGameSocket.ts
+16
-8
Game.vue
frontend-h5/src/pages/game1/Game.vue
+12
-2
Game.vue
frontend-h5/src/pages/game2/Game.vue
+15
-4
Game3.vue
frontend-h5/src/pages/game3/Game3.vue
+17
-12
Game4.vue
frontend-h5/src/pages/game4/Game4.vue
+19
-10
Game5.vue
frontend-h5/src/pages/game5/Game5.vue
+21
-10
Game.vue
frontend-h5/src/pages/game6/Game.vue
+15
-4
No files found.
backend/src/protocols/socket_io.rs
View file @
25744edd
...
@@ -473,8 +473,9 @@ fn is_current_player_socket(userid: &str, socket: &SocketRef) -> bool {
...
@@ -473,8 +473,9 @@ fn is_current_player_socket(userid: &str, socket: &SocketRef) -> bool {
}
}
fn
push_room_score_ranking
()
->
bool
{
fn
push_room_score_ranking
()
->
bool
{
let
(
ranking
,
player_r
ank
s
,
current_player_ids
)
=
if
let
Ok
(
state
)
=
ROOM_STATE
.lock
()
{
let
(
ranking
,
player_r
esult
s
,
current_player_ids
)
=
if
let
Ok
(
state
)
=
ROOM_STATE
.lock
()
{
let
full_ranking
=
state
.full_score_ranking
();
let
full_ranking
=
state
.full_score_ranking
();
let
remaining_seconds
=
state
.remaining_running_secs
();
let
ranking
=
RoomState
::
ranking_payload
(
let
ranking
=
RoomState
::
ranking_payload
(
&
full_ranking
&
full_ranking
.iter
()
.iter
()
...
@@ -482,22 +483,31 @@ fn push_room_score_ranking() -> bool {
...
@@ -482,22 +483,31 @@ fn push_room_score_ranking() -> bool {
.cloned
()
.cloned
()
.collect
::
<
Vec
<
_
>>
(),
.collect
::
<
Vec
<
_
>>
(),
);
);
let
player_r
ank
s
=
full_ranking
let
player_r
esult
s
=
full_ranking
.into_iter
()
.into_iter
()
.enumerate
()
.enumerate
()
.map
(|(
index
,
player
)|
(
player
.wechat
,
json!
(
index
+
1
)))
.map
(|(
index
,
player
)|
{
(
player
.wechat
,
json!
({
"score"
:
player
.score
,
"rank"
:
index
+
1
,
"remainingSeconds"
:
remaining_seconds
}),
)
})
.collect
::
<
Vec
<
_
>>
();
.collect
::
<
Vec
<
_
>>
();
let
current_player_ids
=
state
.players
.keys
()
.cloned
()
.collect
::
<
HashSet
<
_
>>
();
let
current_player_ids
=
state
.players
.keys
()
.cloned
()
.collect
::
<
HashSet
<
_
>>
();
(
ranking
,
player_r
ank
s
,
current_player_ids
)
(
ranking
,
player_r
esult
s
,
current_player_ids
)
}
else
{
}
else
{
return
false
;
return
false
;
};
};
broadcast_room_rank
(
ranking
.clone
());
broadcast_room_rank
(
ranking
.clone
());
broadcast_room_rank_to_spectators
(
&
ranking
,
&
current_player_ids
);
broadcast_room_rank_to_spectators
(
&
ranking
,
&
current_player_ids
);
for
(
userid
,
r
ank
)
in
player_rank
s
{
for
(
userid
,
r
esult
)
in
player_result
s
{
emit_msgpack_to_user
(
&
userid
,
"submit_score_result"
,
&
ok_resp
(
Some
(
r
ank
)));
emit_msgpack_to_user
(
&
userid
,
"submit_score_result"
,
&
ok_resp
(
Some
(
r
esult
)));
}
}
true
true
...
@@ -677,12 +687,12 @@ async fn handle_room_command(
...
@@ -677,12 +687,12 @@ async fn handle_room_command(
if
let
Ok
(
mut
state
)
=
ROOM_STATE
.lock
()
{
if
let
Ok
(
mut
state
)
=
ROOM_STATE
.lock
()
{
// 当前h5进入的不是大屏开启的游戏房间
// 当前h5进入的不是大屏开启的游戏房间
if
gameId
!=
state
.current_game_id
.clone
()
.unwrap_or_default
()
{
if
gameId
!=
state
.current_game_id
.clone
()
.unwrap_or_default
()
{
let
title
=
state
.get_game_tilte
(
None
);
drop
(
state
);
drop
(
state
);
emit_msgpack
(
emit_msgpack
(
&
socket
,
&
socket
,
evt
,
evt
,
&
err_resp
(
&
format!
(
"当前游戏
- {} 房间还未开启"
,
title
),
None
),
&
err_resp
(
&
format!
(
"当前游戏
房间还未开启"
),
None
),
);
);
return
;
return
;
}
}
...
@@ -815,7 +825,21 @@ async fn handle_room_command(
...
@@ -815,7 +825,21 @@ async fn handle_room_command(
player
.score
=
score
;
player
.score
=
score
;
// player.wechat = wechat.to_string();
// player.wechat = wechat.to_string();
player
.online
=
true
;
player
.online
=
true
;
let
score
=
player
.score
;
let
rank
=
state
.player_rank
(
userid
);
let
remaining_seconds
=
state
.remaining_running_secs
();
drop
(
state
);
drop
(
state
);
emit_msgpack
(
&
socket
,
evt
,
&
ok_resp
(
rank
.map
(|
rank
|
{
json!
({
"score"
:
score
,
"rank"
:
rank
,
"remainingSeconds"
:
remaining_seconds
})
})),
);
return
;
return
;
// 方案1:每有一名玩家提交时发送给所有玩家跟管理员,玩家过多时发送太频繁,
// 方案1:每有一名玩家提交时发送给所有玩家跟管理员,玩家过多时发送太频繁,
...
@@ -944,11 +968,13 @@ async fn handle_room_command(
...
@@ -944,11 +968,13 @@ async fn handle_room_command(
.collect
::
<
Vec
<
_
>>
();
.collect
::
<
Vec
<
_
>>
();
CLIENT_PLAYER_MAP
.clear
();
CLIENT_PLAYER_MAP
.clear
();
emit_msgpack
(
&
socket
,
evt
,
&
ok_resp
(
None
));
// broadcast_msgpack_all_player_2(evt, &ok_resp(None));
for
player_socket
in
player_sockets
{
for
player_socket
in
player_sockets
{
_
=
player_socket
.disconnect
();
_
=
player_socket
.disconnect
();
}
}
emit_msgpack
(
&
socket
,
evt
,
&
ok_resp
(
None
));
}
}
// 获取房间状态
// 获取房间状态
"room_state"
=>
{
"room_state"
=>
{
...
...
frontend-h5/src/assets/images/game1/close.png
View replaced file @
f807008f
View file @
25744edd
2.54 KB
|
W:
|
H:
3.16 KB
|
W:
|
H:
2-up
Swipe
Onion skin
frontend-h5/src/commons/utils.ts
View file @
25744edd
...
@@ -382,4 +382,26 @@ export async function postJson(token: string, index: number) {
...
@@ -382,4 +382,26 @@ export async function postJson(token: string, index: number) {
}
catch
(
err
)
{
}
catch
(
err
)
{
console
.
error
(
"请求异常:"
,
err
);
console
.
error
(
"请求异常:"
,
err
);
}
}
}
}
\ No newline at end of file
export
async
function
postScreenGameScore
(
token
:
string
,
gameCode
:
string
,
score
:
number
)
{
try
{
const
resp
=
await
fetch
(
'https://api.guocai365.org.cn/api/offline_clearance/user/screen_game_score'
,
{
method
:
'POST'
,
headers
:
{
Authorization
:
token
,
'Content-Type'
:
'application/json'
,
},
body
:
JSON
.
stringify
({
game_code
:
gameCode
,
score
,
}),
});
if
(
!
resp
.
ok
)
{
console
.
error
(
'提交大屏游戏分数失败:'
,
resp
.
status
,
await
resp
.
text
());
}
}
catch
(
error
)
{
console
.
error
(
'提交大屏游戏分数异常:'
,
error
);
}
}
frontend-h5/src/composables/useGameSocket.ts
View file @
25744edd
...
@@ -2,7 +2,7 @@ import { ref } from 'vue'
...
@@ -2,7 +2,7 @@ import { ref } from 'vue'
import
{
useRouter
}
from
'vue-router'
import
{
useRouter
}
from
'vue-router'
import
type
{
Socket
}
from
'socket.io-client'
import
type
{
Socket
}
from
'socket.io-client'
import
{
initSocket
,
onSocketMessage
,
sendSocketMessage
}
from
'@/commons/ws'
import
{
initSocket
,
onSocketMessage
,
sendSocketMessage
}
from
'@/commons/ws'
import
{
$
read
,
$toast
,
postJson
}
from
'@/commons/utils'
import
{
$
getWechat
,
$read
,
$toast
,
postScreenGameScore
}
from
'@/commons/utils'
type
SocketPayload
=
{
type
SocketPayload
=
{
msg
?:
string
msg
?:
string
...
@@ -10,13 +10,18 @@ type SocketPayload = {
...
@@ -10,13 +10,18 @@ type SocketPayload = {
data
?:
any
data
?:
any
}
}
type
SubmittedGameScore
=
{
code
:
string
score
:
number
}
type
GameSocketOptions
=
{
type
GameSocketOptions
=
{
gameId
:
string
,
gameId
:
string
,
auth
:
any
,
auth
:
any
,
onConnect
?:
()
=>
void
,
onConnect
?:
()
=>
void
,
onShowRank
?:
(
data
:
any
)
=>
void
,
onShowRank
?:
(
data
:
any
)
=>
void
,
onGameStart
?:
(
data
:
any
)
=>
void
onGameStart
?:
(
data
:
any
)
=>
void
onScoreSubmitted
?:
(
is_save
:
boolean
,
data
:
any
)
=>
void
onScoreSubmitted
?:
(
is_save
:
boolean
,
data
:
any
)
=>
SubmittedGameScore
|
void
onRescoreSubmitted
?:
(
recount
:
number
)
=>
void
onRescoreSubmitted
?:
(
recount
:
number
)
=>
void
onRoomClosed
?:
(
data
:
any
)
=>
void
onRoomClosed
?:
(
data
:
any
)
=>
void
onGameRecover
?:
(
data
:
any
)
=>
void
onGameRecover
?:
(
data
:
any
)
=>
void
...
@@ -76,7 +81,6 @@ export function useGameSocket(options: GameSocketOptions) {
...
@@ -76,7 +81,6 @@ export function useGameSocket(options: GameSocketOptions) {
offSocketMessage
=
onSocketMessage
((
evt
,
payload
:
SocketPayload
)
=>
{
offSocketMessage
=
onSocketMessage
((
evt
,
payload
:
SocketPayload
)
=>
{
const
{
msg
,
state
,
data
}
=
payload
const
{
msg
,
state
,
data
}
=
payload
if
(
state
===
0
)
{
if
(
state
===
0
)
{
if
(
evt
==
'room_rank_result'
)
{
if
(
evt
==
'room_rank_result'
)
{
// options.show_rank?.(data);
// options.show_rank?.(data);
...
@@ -88,7 +92,7 @@ export function useGameSocket(options: GameSocketOptions) {
...
@@ -88,7 +92,7 @@ export function useGameSocket(options: GameSocketOptions) {
return
;
return
;
}
}
if
(
evt
===
'room_join_result'
)
{
if
(
evt
===
'room_join_result'
)
{
//
$toast(msg);
$toast
(
msg
);
// router.replace('/loading').then(() => { });
// router.replace('/loading').then(() => { });
return
;
return
;
}
}
...
@@ -159,16 +163,20 @@ export function useGameSocket(options: GameSocketOptions) {
...
@@ -159,16 +163,20 @@ export function useGameSocket(options: GameSocketOptions) {
break
break
}
}
case
'submit_score_save_result'
:
{
case
'submit_score_save_result'
:
{
// postJson()
const
submittedScore
=
options
.
onScoreSubmitted
?.(
true
,
data
)
options
.
onScoreSubmitted
?.(
true
,
data
)
const
token
=
$getWechat
()?.
token_origin
if
(
token
&&
submittedScore
&&
Number
.
isFinite
(
submittedScore
.
score
))
{
void
postScreenGameScore
(
token
,
submittedScore
.
code
,
submittedScore
.
score
)
}
break
break
}
}
case
'room_back_result'
:
{
case
'room_back_result'
:
{
options
.
onRoomBack
?.(
data
);
options
.
onRoomBack
?.(
data
);
break
;
break
;
}
}
case
'room_close_result'
:
{
case
'room_close_result'
:
{
//管理员发送了房间关闭的消息
$toast
(
'管理员关闭了游戏房间'
)
$toast
(
'管理员关闭了游戏房间,当前已断开连接'
);
socket
?.
disconnect
();
break
;
break
;
}
}
case
'room_rank_result'
:
{
case
'room_rank_result'
:
{
...
...
frontend-h5/src/pages/game1/Game.vue
View file @
25744edd
...
@@ -190,11 +190,20 @@ if (wechat) {
...
@@ -190,11 +190,20 @@ if (wechat) {
},
},
onScoreSubmitted
:
(
is_save
,
data
)
=>
{
onScoreSubmitted
:
(
is_save
,
data
)
=>
{
if
(
!
is_save
)
{
//非保存状态下
if
(
!
is_save
)
{
//非保存状态下
const
nextScore
=
Number
(
typeof
data
===
'object'
?
data
?.
score
:
NaN
)
const
nextRank
=
Number
(
typeof
data
===
'object'
?
data
?.
rank
:
data
)
const
nextRank
=
Number
(
typeof
data
===
'object'
?
data
?.
rank
:
data
)
const
remainingSeconds
=
Number
(
typeof
data
===
'object'
?
data
?.
remainingSeconds
:
NaN
)
if
(
Number
.
isFinite
(
nextScore
)
&&
nextScore
>=
0
)
{
tick
.
value
=
nextScore
}
if
(
Number
.
isFinite
(
nextRank
)
&&
nextRank
>
0
)
{
if
(
Number
.
isFinite
(
nextRank
)
&&
nextRank
>
0
)
{
rank
.
value
=
nextRank
rank
.
value
=
nextRank
}
}
if
(
Number
.
isFinite
(
remainingSeconds
)
&&
remainingSeconds
>=
0
)
{
countdownInterval
.
value
=
remainingSeconds
}
}
}
return
{
code
:
'JGQF'
,
score
:
tick
.
value
}
},
},
onRescoreSubmitted
:
(
_recount
)
=>
{
onRescoreSubmitted
:
(
_recount
)
=>
{
submitScore
(
true
);
submitScore
(
true
);
...
@@ -309,10 +318,11 @@ const showGameRuleHandler = () => {
...
@@ -309,10 +318,11 @@ const showGameRuleHandler = () => {
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.4
);
transform
:
translateX
(
-50%
)
scale
(
1.5
);
position
:
absolute
;
position
:
absolute
;
top
:
0
;
top
:
-73px
;
left
:
100%
;
left
:
100%
;
margin-left
:
-48px
;
}
}
}
}
</
style
>
</
style
>
frontend-h5/src/pages/game2/Game.vue
View file @
25744edd
...
@@ -196,10 +196,18 @@ if (wechat) {
...
@@ -196,10 +196,18 @@ if (wechat) {
},
},
onScoreSubmitted
:
(
is_save
,
data
)
=>
{
onScoreSubmitted
:
(
is_save
,
data
)
=>
{
if
(
!
is_save
)
{
//非保存状态下
if
(
!
is_save
)
{
//非保存状态下
const
nextScore
=
Number
(
typeof
data
===
'object'
?
data
?.
score
:
NaN
)
const
nextRank
=
Number
(
typeof
data
===
'object'
?
data
?.
rank
:
data
)
const
nextRank
=
Number
(
typeof
data
===
'object'
?
data
?.
rank
:
data
)
const
remainingSeconds
=
Number
(
typeof
data
===
'object'
?
data
?.
remainingSeconds
:
NaN
)
if
(
Number
.
isFinite
(
nextScore
)
&&
nextScore
>=
0
)
{
score
.
value
=
nextScore
}
if
(
Number
.
isFinite
(
nextRank
)
&&
nextRank
>
0
)
{
if
(
Number
.
isFinite
(
nextRank
)
&&
nextRank
>
0
)
{
rank
.
value
=
nextRank
rank
.
value
=
nextRank
}
}
if
(
Number
.
isFinite
(
remainingSeconds
)
&&
remainingSeconds
>=
0
)
{
countdownInterval
.
value
=
remainingSeconds
}
}
else
if
(
typeof
data
===
'object'
&&
data
)
{
}
else
if
(
typeof
data
===
'object'
&&
data
)
{
if
(
Array
.
isArray
(
data
.
list
))
{
if
(
Array
.
isArray
(
data
.
list
))
{
rankList
.
value
=
data
.
list
.
map
((
item
:
any
,
index
:
number
)
=>
({
rankList
.
value
=
data
.
list
.
map
((
item
:
any
,
index
:
number
)
=>
({
...
@@ -215,6 +223,7 @@ if (wechat) {
...
@@ -215,6 +223,7 @@ if (wechat) {
rank
.
value
=
nextRank
rank
.
value
=
nextRank
}
}
}
}
return
{
code
:
'JBJF'
,
score
:
score
.
value
}
},
},
onRescoreSubmitted
:
(
_recount
)
=>
{
onRescoreSubmitted
:
(
_recount
)
=>
{
submitScore
(
true
);
submitScore
(
true
);
...
@@ -383,10 +392,11 @@ const rankCloseHandler = () => {
...
@@ -383,10 +392,11 @@ 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.4
);
transform
:
translateX
(
-50%
)
scale
(
1.5
);
position
:
absolute
;
position
:
absolute
;
top
:
0
;
top
:
-73px
;
left
:
100%
;
left
:
100%
;
margin-left
:
-48px
;
}
}
}
}
...
@@ -482,9 +492,10 @@ const rankCloseHandler = () => {
...
@@ -482,9 +492,10 @@ 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.
4
);
transform
:
translateX
(
-50%
)
scale
(
1.
5
);
position
:
absolute
;
position
:
absolute
;
top
:
0
;
top
:
-35px
;
left
:
100%
;
left
:
100%
;
margin-left
:
-58px
;
}
}
</
style
>
</
style
>
frontend-h5/src/pages/game3/Game3.vue
View file @
25744edd
...
@@ -456,11 +456,15 @@ const rankCloseHandler = () => {
...
@@ -456,11 +456,15 @@ const rankCloseHandler = () => {
letter-spacing
:
4px
;
letter-spacing
:
4px
;
}
}
.rule-txt
{
.rule-close
{
font-size
:
26pt
;
width
:
57px
;
padding
:
40px
;
height
:
57px
;
margin-top
:
10px
;
background
:
v-bind
(
'imageUrls.close'
)
center
/
cover
no-repeat
;
color
:
#aa0000
;
transform
:
translateX
(
-50%
)
scale
(
1.5
);
position
:
absolute
;
top
:
-73px
;
left
:
100%
;
margin-left
:
-48px
;
}
}
}
}
...
@@ -563,12 +567,13 @@ const rankCloseHandler = () => {
...
@@ -563,12 +567,13 @@ const rankCloseHandler = () => {
}
}
.img-close
{
.img-close
{
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.4
);
transform
:
translateX
(
-50%
)
scale
(
1.5
);
position
:
absolute
;
position
:
absolute
;
top
:
0
;
top
:
-35px
;
left
:
100%
;
left
:
100%
;
margin-left
:
-58px
;
}
}
</
style
>
</
style
>
frontend-h5/src/pages/game4/Game4.vue
View file @
25744edd
...
@@ -49,7 +49,6 @@ const countdownInterval = ref(60)
...
@@ -49,7 +49,6 @@ const countdownInterval = ref(60)
const
isDivDescVisible
=
ref
(
false
)
const
isDivDescVisible
=
ref
(
false
)
const
tick
=
ref
(
0
)
// 点击次数/摇动次数
const
tick
=
ref
(
0
)
// 点击次数/摇动次数
const
rank
=
ref
(
0
)
// 排名
const
rank
=
ref
(
0
)
// 排名
const
level
=
ref
(
5
)
const
currentHorse
=
ref
(
imageUrls
.
horse
)
const
currentHorse
=
ref
(
imageUrls
.
horse
)
const
currentYaoyiyao
=
ref
(
imageUrls
.
yaoyiyao
)
const
currentYaoyiyao
=
ref
(
imageUrls
.
yaoyiyao
)
const
token
=
ref
(
wechat
?.
token
??
''
)
const
token
=
ref
(
wechat
?.
token
??
''
)
...
@@ -150,7 +149,6 @@ function startGameView() {
...
@@ -150,7 +149,6 @@ function startGameView() {
function
showScoreView
()
{
function
showScoreView
()
{
stopGameCountdown
()
stopGameCountdown
()
setDivDescVisible
(
false
)
setDivDescVisible
(
false
)
level
.
value
=
rank
.
value
currentView
.
value
=
'score'
currentView
.
value
=
'score'
}
}
...
@@ -192,18 +190,28 @@ if (wechat) {
...
@@ -192,18 +190,28 @@ if (wechat) {
startGameView
()
startGameView
()
},
},
onScoreSubmitted
:
(
is_save
,
data
)
=>
{
onScoreSubmitted
:
(
is_save
,
data
)
=>
{
if
(
!
is_save
)
{
const
nextScore
=
Number
(
typeof
data
===
'object'
?
data
?.
score
:
NaN
)
const
nextRank
=
Number
(
typeof
data
===
'object'
?
data
?.
rank
:
data
)
const
nextRank
=
Number
(
typeof
data
===
'object'
?
data
?.
rank
:
data
)
if
(
Number
.
isFinite
(
nextRank
)
&&
nextRank
>
0
)
{
const
remainingSeconds
=
Number
(
typeof
data
===
'object'
?
data
?.
remainingSeconds
:
NaN
)
rank
.
value
=
nextRank
if
(
!
is_save
&&
Number
.
isFinite
(
nextScore
)
&&
nextScore
>=
0
)
{
}
tick
.
value
=
nextScore
}
}
if
(
!
is_save
&&
Number
.
isFinite
(
remainingSeconds
)
&&
remainingSeconds
>=
0
)
{
countdownInterval
.
value
=
remainingSeconds
}
if
(
Number
.
isFinite
(
nextRank
)
&&
nextRank
>
0
)
{
rank
.
value
=
nextRank
}
return
{
code
:
'CMYF'
,
score
:
tick
.
value
}
},
},
onRescoreSubmitted
:
(
_recount
)
=>
{
onRescoreSubmitted
:
(
_recount
)
=>
{
submitScore
(
true
)
submitScore
(
true
)
},
},
onRoomClosed
:
showLoadingView
,
onRoomClosed
:
showLoadingView
,
onRoomBack
:
handleRoomBack
,
onRoomBack
:
handleRoomBack
,
onGameRecover
:()
=>
{
debugger
}
})
})
_offSocketMessage
.
value
=
offSocketMessage
_offSocketMessage
.
value
=
offSocketMessage
}
}
...
@@ -249,7 +257,7 @@ onBeforeUnmount(() => {
...
@@ -249,7 +257,7 @@ onBeforeUnmount(() => {
<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"
:currentHorse=
"currentHorse"
:currentYaoyiyao=
"currentYaoyiyao"
:countdown-interval=
"countdownInterval"
:currentHorse=
"currentHorse"
:currentYaoyiyao=
"currentYaoyiyao"
:countdown-interval=
"countdownInterval"
:is-div-desc-visible=
"isDivDescVisible"
@
touch=
"touchHandler"
/>
:is-div-desc-visible=
"isDivDescVisible"
@
touch=
"touchHandler"
/>
<ScoreView
v-else
:image-urls=
"imageUrls"
:tick=
"tick"
:level=
"
level
"
@
replay=
"replayGame"
<ScoreView
v-else
:image-urls=
"imageUrls"
:tick=
"tick"
:level=
"
rank
"
@
replay=
"replayGame"
@
back=
"backToWaiting"
/>
@
back=
"backToWaiting"
/>
</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;"
>
...
@@ -286,10 +294,11 @@ onBeforeUnmount(() => {
...
@@ -286,10 +294,11 @@ onBeforeUnmount(() => {
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.4
);
transform
:
translateX
(
-50%
)
scale
(
1.5
);
position
:
absolute
;
position
:
absolute
;
top
:
0
;
top
:
-73px
;
left
:
100%
;
left
:
100%
;
margin-left
:
-48px
;
}
}
}
}
</
style
>
</
style
>
frontend-h5/src/pages/game5/Game5.vue
View file @
25744edd
...
@@ -220,10 +220,18 @@ if (wechat) {
...
@@ -220,10 +220,18 @@ if (wechat) {
},
},
onScoreSubmitted
:
(
is_save
,
data
)
=>
{
onScoreSubmitted
:
(
is_save
,
data
)
=>
{
if
(
!
is_save
)
{
//非保存状态下
if
(
!
is_save
)
{
//非保存状态下
const
nextScore
=
Number
(
typeof
data
===
'object'
?
data
?.
score
:
NaN
)
const
nextRank
=
Number
(
typeof
data
===
'object'
?
data
?.
rank
:
data
)
const
nextRank
=
Number
(
typeof
data
===
'object'
?
data
?.
rank
:
data
)
const
remainingSeconds
=
Number
(
typeof
data
===
'object'
?
data
?.
remainingSeconds
:
NaN
)
if
(
Number
.
isFinite
(
nextScore
)
&&
nextScore
>=
0
)
{
tick
.
value
=
nextScore
}
if
(
Number
.
isFinite
(
nextRank
)
&&
nextRank
>
0
)
{
if
(
Number
.
isFinite
(
nextRank
)
&&
nextRank
>
0
)
{
rank
.
value
=
nextRank
rank
.
value
=
nextRank
}
}
if
(
Number
.
isFinite
(
remainingSeconds
)
&&
remainingSeconds
>=
0
)
{
countdownInterval
.
value
=
remainingSeconds
}
}
else
if
(
typeof
data
===
'object'
&&
data
)
{
}
else
if
(
typeof
data
===
'object'
&&
data
)
{
if
(
Array
.
isArray
(
data
.
list
))
{
if
(
Array
.
isArray
(
data
.
list
))
{
rankList
.
value
=
data
.
list
.
map
((
item
:
any
,
index
:
number
)
=>
({
rankList
.
value
=
data
.
list
.
map
((
item
:
any
,
index
:
number
)
=>
({
...
@@ -239,6 +247,7 @@ if (wechat) {
...
@@ -239,6 +247,7 @@ if (wechat) {
rank
.
value
=
nextRank
rank
.
value
=
nextRank
}
}
}
}
return
{
code
:
'QCNF'
,
score
:
tick
.
value
}
},
},
onRescoreSubmitted
:
(
_recount
)
=>
{
onRescoreSubmitted
:
(
_recount
)
=>
{
submitScore
(
true
);
submitScore
(
true
);
...
@@ -311,8 +320,8 @@ const rankCloseHandler = () => {
...
@@ -311,8 +320,8 @@ const rankCloseHandler = () => {
<div
class=
"col-3"
>
{{
tick
}}
</div>
<div
class=
"col-3"
>
{{
tick
}}
</div>
</div>
</div>
</div>
</div>
</div>
<div
class=
"img-close"
@
click=
"rankCloseHandler"
>
</div>
<
div
class=
"img-close"
@
click=
"rankCloseHandler"
></div>
<
/div>
</
template
>
</
template
>
<
template
#
gameRule
>
<
template
#
gameRule
>
<div
class=
"rule-container"
>
<div
class=
"rule-container"
>
...
@@ -371,10 +380,11 @@ const rankCloseHandler = () => {
...
@@ -371,10 +380,11 @@ 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.4
);
transform
:
translateX
(
-50%
)
scale
(
1.5
);
position
:
absolute
;
position
:
absolute
;
top
:
0
;
top
:
-73px
;
left
:
100%
;
left
:
100%
;
margin-left
:
-48px
;
}
}
}
}
...
@@ -463,9 +473,11 @@ const rankCloseHandler = () => {
...
@@ -463,9 +473,11 @@ const rankCloseHandler = () => {
.img-close
{
.img-close
{
width
:
57px
;
width
:
57px
;
height
:
57px
;
height
:
57px
;
border-radius
:
29px
;
background
:
v-bind
(
'imageUrls.close'
)
center
/
cover
no-repeat
;
background
:
v-bind
(
'imageUrls.close'
)
center
/
cover
;
transform
:
translateX
(
-50%
)
scale
(
1.5
);
transform
:
scale
(
0.7
);
position
:
absolute
;
margin-top
:
500px
;
top
:
-35px
;
left
:
100%
;
margin-left
:
-58px
;
}
}
</
style
>
</
style
>
\ No newline at end of file
frontend-h5/src/pages/game6/Game.vue
View file @
25744edd
...
@@ -203,10 +203,18 @@ if (wechat) {
...
@@ -203,10 +203,18 @@ if (wechat) {
},
},
onScoreSubmitted
:
(
is_save
,
data
)
=>
{
onScoreSubmitted
:
(
is_save
,
data
)
=>
{
if
(
!
is_save
)
{
//非保存状态下
if
(
!
is_save
)
{
//非保存状态下
const
nextScore
=
Number
(
typeof
data
===
'object'
?
data
?.
score
:
NaN
)
const
nextRank
=
Number
(
typeof
data
===
'object'
?
data
?.
rank
:
data
)
const
nextRank
=
Number
(
typeof
data
===
'object'
?
data
?.
rank
:
data
)
const
remainingSeconds
=
Number
(
typeof
data
===
'object'
?
data
?.
remainingSeconds
:
NaN
)
if
(
Number
.
isFinite
(
nextScore
)
&&
nextScore
>=
0
)
{
score
.
value
=
nextScore
}
if
(
Number
.
isFinite
(
nextRank
)
&&
nextRank
>
0
)
{
if
(
Number
.
isFinite
(
nextRank
)
&&
nextRank
>
0
)
{
rank
.
value
=
nextRank
rank
.
value
=
nextRank
}
}
if
(
Number
.
isFinite
(
remainingSeconds
)
&&
remainingSeconds
>=
0
)
{
countdownInterval
.
value
=
remainingSeconds
}
}
else
if
(
typeof
data
===
'object'
&&
data
)
{
}
else
if
(
typeof
data
===
'object'
&&
data
)
{
if
(
Array
.
isArray
(
data
.
list
))
{
if
(
Array
.
isArray
(
data
.
list
))
{
rankList
.
value
=
data
.
list
.
map
((
item
:
any
,
index
:
number
)
=>
({
rankList
.
value
=
data
.
list
.
map
((
item
:
any
,
index
:
number
)
=>
({
...
@@ -222,6 +230,7 @@ if (wechat) {
...
@@ -222,6 +230,7 @@ if (wechat) {
rank
.
value
=
nextRank
rank
.
value
=
nextRank
}
}
}
}
return
{
code
:
'FYDT'
,
score
:
score
.
value
}
},
},
onRescoreSubmitted
:
(
_recount
)
=>
{
onRescoreSubmitted
:
(
_recount
)
=>
{
submitScore
(
true
);
submitScore
(
true
);
...
@@ -378,10 +387,11 @@ const rankCloseHandler = () => {
...
@@ -378,10 +387,11 @@ 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.4
);
transform
:
translateX
(
-50%
)
scale
(
1.5
);
position
:
absolute
;
position
:
absolute
;
top
:
0
;
top
:
-73px
;
left
:
100%
;
left
:
100%
;
margin-left
:
-48px
;
}
}
}
}
...
@@ -471,9 +481,10 @@ const rankCloseHandler = () => {
...
@@ -471,9 +481,10 @@ 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.
4
);
transform
:
translateX
(
-50%
)
scale
(
1.
5
);
position
:
absolute
;
position
:
absolute
;
top
:
0
;
top
:
-35px
;
left
:
100%
;
left
:
100%
;
margin-left
:
-58px
;
}
}
</
style
>
</
style
>
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