Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RB-studyChina-20250617
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
SparkProjects
RB-studyChina-20250617
Commits
bede2e03
Commit
bede2e03
authored
Jun 21, 2025
by
俞嘉婷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
游戏。。。
parent
72058707
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
47 additions
and
102 deletions
+47
-102
game.ts
mock/game.ts
+18
-34
index.ts
src/api/index.ts
+0
-8
GamePage.tsx
src/pages/GamePage/GamePage.tsx
+8
-32
index.jsx
src/panels/FailPopup/index.jsx
+3
-0
gameStore.ts
src/store/gameStore.ts
+18
-28
No files found.
mock/game.ts
View file @
bede2e03
...
@@ -10,49 +10,33 @@ export default [
...
@@ -10,49 +10,33 @@ export default [
message
:
"message"
,
message
:
"message"
,
data
:
AESEncrypt
(
JSON
.
stringify
({
data
:
AESEncrypt
(
JSON
.
stringify
({
recordId
:
"recordId"
,
recordId
:
"recordId"
,
countdownSeconds
:
110
,
countdownSeconds
:
26
,
remainTipTimes
:
3
,
targetConfig
:
{
}),
"7A2F4B8D1E6C3905"
,
"cDOiBC1n2QrkAY2P"
),
target1
:
10
,
// 背包数量
target2
:
23
,
// 飞机数量
},
}),
"4fe20bdefdd4804f"
,
"cDOiBC1n2QrkAY2P"
),
// data: "TtL6pvFMpXEajymGe7uOoiD0iaAnxxtuOFqvG+Vo0R4qzJQlb+eQneEkPKv+nNsXKJHVe/hfKTQAMj6FuC2Ltg=="
// data: "TtL6pvFMpXEajymGe7uOoiD0iaAnxxtuOFqvG+Vo0R4qzJQlb+eQneEkPKv+nNsXKJHVe/hfKTQAMj6FuC2Ltg=="
}
}
},
},
},
},
{
url
:
'/game/suggest.do'
,
response
:
({
query
})
=>
{
return
{
code
:
"123"
,
success
:
true
,
message
:
"message"
,
data
:
null
}
},
},
{
url
:
'/game/middleSubmit.do'
,
response
:
({
query
})
=>
{
return
{
code
:
"123"
,
success
:
true
,
message
:
"message"
,
data
:
null
}
},
},
{
{
url
:
'/game/submit.do'
,
url
:
'/game/submit.do'
,
response
:
({
query
})
=>
{
response
:
({
query
})
=>
{
return
{
return
{
code
:
"123"
,
"success"
:
true
,
success
:
true
,
"code"
:
""
,
message
:
"message"
,
"message"
:
""
,
data
:
{
"data"
:
{
drawChance
:
3
,
"gotSpInfo"
:
{
title
:
"5555"
,
"spId"
:
"sp_landmark1"
,
desc
:
"123123123"
,
"name"
:
"北京"
,
score
:
10
,
"icon"
:
"https://www.baidu.com/tiananmen.png"
},
"rewardDrawTimes"
:
1
,
"leftGameTimes"
:
2
}
}
}
}
}
,
}
},
},
]
]
src/api/index.ts
View file @
bede2e03
...
@@ -149,14 +149,6 @@ const API = generateAPI({
...
@@ -149,14 +149,6 @@ const API = generateAPI({
uri
:
`game/start.do`
,
uri
:
`game/start.do`
,
withToken
:
true
,
withToken
:
true
,
},
},
suggest
:
{
uri
:
`game/suggest.do`
,
withToken
:
true
,
},
middleSubmit
:
{
uri
:
`game/middleSubmit.do`
,
withToken
:
true
,
},
submit
:
{
submit
:
{
uri
:
`game/submit.do`
,
uri
:
`game/submit.do`
,
withToken
:
true
,
withToken
:
true
,
...
...
src/pages/GamePage/GamePage.tsx
View file @
bede2e03
...
@@ -19,8 +19,6 @@ import { _throttle } from "@/utils/utils.ts";
...
@@ -19,8 +19,6 @@ import { _throttle } from "@/utils/utils.ts";
import
{
GameEvent
,
globalEvent
}
from
"@/pages/GamePage/GameEvent.ts"
;
import
{
GameEvent
,
globalEvent
}
from
"@/pages/GamePage/GameEvent.ts"
;
import
{
LOG_KEY
,
pageView
,
sensorLog
}
from
"@/utils/sensors"
;
import
{
LOG_KEY
,
pageView
,
sensorLog
}
from
"@/utils/sensors"
;
import
{
ModalCtrl
}
from
"@/core/ctrls/ModalCtrl"
;
import
{
ModalCtrl
}
from
"@/core/ctrls/ModalCtrl"
;
import
FailPopup
from
'@/panels/FailPopup/index.jsx'
import
VictoryPopup
from
'@/panels/VictoryPopup/index.jsx'
import
"./js/output"
;
import
"./js/output"
;
...
@@ -55,9 +53,9 @@ class GamePage extends React.Component<any, any> {
...
@@ -55,9 +53,9 @@ class GamePage extends React.Component<any, any> {
window
.
addEventListener
(
'resize'
,
function
()
{
store
.
game
.
stage
.
resize
()
});
window
.
addEventListener
(
'resize'
,
function
()
{
store
.
game
.
stage
.
resize
()
});
//展示游戏,传入数据
//展示游戏,传入数据
store
.
game
.
showGame
({
store
.
game
.
showGame
({
targetStudy
:
1
,
//背包数量
targetStudy
:
gameStore
.
gameInfo
.
targetConfig
.
target
1
,
//背包数量
targetTravel
:
1
,
//飞机数量
targetTravel
:
gameStore
.
gameInfo
.
targetConfig
.
target2
,
//飞机数量
time
:
120
,
//时间,秒计
time
:
gameStore
.
gameInfo
.
countdownSeconds
,
//时间,秒计
needGuide
:
store
.
indexData
?.
newGuideFlag
==
1
,
needGuide
:
store
.
indexData
?.
newGuideFlag
==
1
,
})
})
if
(
store
.
indexData
?.
newGuideFlag
==
1
)
{
if
(
store
.
indexData
?.
newGuideFlag
==
1
)
{
...
@@ -68,11 +66,12 @@ class GamePage extends React.Component<any, any> {
...
@@ -68,11 +66,12 @@ class GamePage extends React.Component<any, any> {
console
.
log
(
e
)
//成功
console
.
log
(
e
)
//成功
if
(
e
.
data
===
true
)
{
if
(
e
.
data
===
true
)
{
//成功
//成功
let
param
=
{
"recordId"
:
1234
,
"score"
:
507
,
"success"
:
true
,
"timestamp"
:
1749800591737
}
// 得分【1个背包100分,1个飞机1分】
this
.
submitGame
(
param
)
const
score
=
0
;
// TODO
gameStore
.
submit
(
score
,
true
)
}
else
{
}
else
{
cons
ole
.
log
(
e
.
data
)
cons
t
score
=
0
;
// TODO
ModalCtrl
.
showModal
(
FailPopup
,
e
.
data
);
gameStore
.
submit
(
score
,
false
,
e
.
data
)
// {
// {
// targetStudy: 1,//还差合成数量
// targetStudy: 1,//还差合成数量
// targetTravel: 2,
// targetTravel: 2,
...
@@ -103,29 +102,6 @@ class GamePage extends React.Component<any, any> {
...
@@ -103,29 +102,6 @@ class GamePage extends React.Component<any, any> {
}
}
//提交游戏
submitGame
=
async
(
param
)
=>
{
let
gameData
:
any
=
await
API
.
submitGame
({
param
:
param
})
gameData
=
{
"success"
:
true
,
"code"
:
""
,
"message"
:
""
,
"data"
:
{
"gotSpInfo"
:
{
"spId"
:
"sp_landmark1"
,
"name"
:
"北京"
,
"icon"
:
"https://www.baidu.com/tiananmen.png"
},
"rewardDrawTimes"
:
1
,
"leftGameTimes"
:
2
}
}
if
(
gameData
.
data
?.
gotSpInfo
)
{
ModalCtrl
.
showModal
(
VictoryPopup
,
gameData
.
data
);
}
}
render
()
{
render
()
{
return
<
div
className=
{
styles
.
root
}
ref=
{
(
el
)
=>
this
.
gameDiv
=
el
}
>
return
<
div
className=
{
styles
.
root
}
ref=
{
(
el
)
=>
this
.
gameDiv
=
el
}
>
...
...
src/panels/FailPopup/index.jsx
View file @
bede2e03
...
@@ -29,10 +29,13 @@ class FailPopup extends React.Component {
...
@@ -29,10 +29,13 @@ class FailPopup extends React.Component {
//再玩一次
//再玩一次
onReceive
=
()
=>
{
onReceive
=
()
=>
{
ModalCtrl
.
closeModal
();
ModalCtrl
.
closeModal
();
PageCtrl
.
changePage
(
HomePage
);
//回到首页
/*
//重玩游戏
//重玩游戏
if (store.game) {
if (store.game) {
store.game.dispatchGlobalEvent("restartGame", { targetStudy: 1, targetTravel: 1, time: 120 })
store.game.dispatchGlobalEvent("restartGame", { targetStudy: 1, targetTravel: 1, time: 120 })
}
}
*/
}
}
render
()
{
render
()
{
...
...
src/store/gameStore.ts
View file @
bede2e03
...
@@ -4,8 +4,8 @@ import { AESDecrypt, AESEncrypt } from "@/utils/Crypto.ts";
...
@@ -4,8 +4,8 @@ import { AESDecrypt, AESEncrypt } from "@/utils/Crypto.ts";
import
{
PageCtrl
}
from
"@/core/ctrls/PageCtrl.tsx"
;
import
{
PageCtrl
}
from
"@/core/ctrls/PageCtrl.tsx"
;
import
HomePage
from
"@/pages/HomePage/HomePage.tsx"
;
import
HomePage
from
"@/pages/HomePage/HomePage.tsx"
;
import
{
ModalCtrl
}
from
"@/core/ctrls/ModalCtrl.tsx"
;
import
{
ModalCtrl
}
from
"@/core/ctrls/ModalCtrl.tsx"
;
import
Settlechance
from
"@/components/settlechance/settlechance"
;
import
FailPopup
from
'@/panels/FailPopup/index.jsx'
import
Settlenochance
from
"@/components/settlenochance/settlenochance"
;
import
VictoryPopup
from
'@/panels/VictoryPopup/index.jsx'
class
GameStore
{
class
GameStore
{
...
@@ -15,11 +15,11 @@ class GameStore {
...
@@ -15,11 +15,11 @@ class GameStore {
gameInfo
=
{
gameInfo
=
{
recordId
:
""
,
recordId
:
""
,
levelIndex
:
-
1
,
levelIdxArr
:
[],
countdownSeconds
:
180
,
countdownSeconds
:
180
,
remainTipTimes
:
0
,
targetConfig
:
{
cd
:
180
,
target1
:
0
,
// 背包数量
target2
:
0
,
// 飞机数量
},
isSubmit
:
false
,
isSubmit
:
false
,
}
}
...
@@ -28,41 +28,31 @@ class GameStore {
...
@@ -28,41 +28,31 @@ class GameStore {
const
{
success
,
data
:
d
}
=
await
API
.
start
();
const
{
success
,
data
:
d
}
=
await
API
.
start
();
if
(
!
success
)
return
false
;
if
(
!
success
)
return
false
;
const
data
=
JSON
.
parse
(
AESDecrypt
(
d
,
"
7A2F4B8D1E6C3905
"
,
"cDOiBC1n2QrkAY2P"
))
as
any
;
const
data
=
JSON
.
parse
(
AESDecrypt
(
d
,
"
4fe20bdefdd4804f
"
,
"cDOiBC1n2QrkAY2P"
))
as
any
;
this
.
gameInfo
.
levelIdxArr
.
sort
(()
=>
Math
.
random
()
-
0.5
);
this
.
gameInfo
.
levelIndex
=
-
1
;
this
.
gameInfo
.
isSubmit
=
false
;
this
.
gameInfo
.
isSubmit
=
false
;
this
.
gameInfo
.
recordId
=
data
.
recordId
;
this
.
gameInfo
.
recordId
=
data
.
recordId
;
this
.
gameInfo
.
countdownSeconds
=
data
.
countdownSeconds
;
this
.
gameInfo
.
countdownSeconds
=
data
.
countdownSeconds
;
this
.
gameInfo
.
remainTipTimes
=
data
.
remainTipTimes
this
.
gameInfo
.
targetConfig
=
data
.
targetConfig
return
success
;
return
success
;
}
}
async
suggest
()
{
const
{
success
,
data
}
=
await
API
.
suggest
();
return
success
;
}
async
middleSubmit
(
score
:
number
)
{
async
submitGame
(
score
:
number
)
{
if
(
this
.
gameInfo
.
isSubmit
)
{
if
(
this
.
gameInfo
.
isSubmit
)
{
return
;
return
;
}
}
const
d
=
{
const
d
=
{
recordId
:
this
.
gameInfo
.
recordId
,
score
,
timestamp
:
Date
.
now
(),
};
};
console
.
log
(
1
,
d
);
const
param
=
AESEncrypt
(
JSON
.
stringify
(
d
),
"4fe20bdefdd4804f"
,
"cDOiBC1n2QrkAY2P"
);
const
param
=
AESEncrypt
(
JSON
.
stringify
(
d
),
"7A2F4B8D1E6C3905"
,
"cDOiBC1n2QrkAY2P"
);
const
{
success
,
data
}
=
await
API
.
middleS
ubmit
({
param
});
const
{
success
,
data
}
=
await
API
.
s
ubmit
({
param
});
return
success
;
return
success
;
}
}
async
submit
(
score
:
number
)
{
async
submit
(
score
:
number
,
suc
:
boolean
,
gameData
?:
any
)
{
if
(
this
.
gameInfo
.
isSubmit
)
{
if
(
this
.
gameInfo
.
isSubmit
)
{
return
;
return
;
}
}
...
@@ -72,10 +62,11 @@ class GameStore {
...
@@ -72,10 +62,11 @@ class GameStore {
const
d
=
{
const
d
=
{
recordId
:
this
.
gameInfo
.
recordId
,
recordId
:
this
.
gameInfo
.
recordId
,
score
,
score
,
success
:
suc
,
timestamp
:
Date
.
now
(),
timestamp
:
Date
.
now
(),
};
};
console
.
log
(
2
,
d
);
console
.
log
(
2
,
d
);
const
param
=
AESEncrypt
(
JSON
.
stringify
(
d
),
"
7A2F4B8D1E6C3905
"
,
"cDOiBC1n2QrkAY2P"
);
const
param
=
AESEncrypt
(
JSON
.
stringify
(
d
),
"
4fe20bdefdd4804f
"
,
"cDOiBC1n2QrkAY2P"
);
const
{
success
,
data
}
=
await
API
.
submit
({
param
});
const
{
success
,
data
}
=
await
API
.
submit
({
param
});
if
(
!
success
)
{
if
(
!
success
)
{
...
@@ -83,12 +74,11 @@ class GameStore {
...
@@ -83,12 +74,11 @@ class GameStore {
return
success
;
return
success
;
}
}
if
(
data
.
drawChance
)
{
if
(
suc
)
{
ModalCtrl
.
showModal
(
Settlechance
,
{
data
}
);
ModalCtrl
.
showModal
(
VictoryPopup
,
data
);
}
else
{
}
else
{
ModalCtrl
.
showModal
(
Settlenochance
,
{
data
}
);
ModalCtrl
.
showModal
(
FailPopup
,
gameData
);
}
}
return
success
;
return
success
;
}
}
}
}
...
...
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