Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GeekLearnMathWeapp
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
frontend
GeekLearnMathWeapp
Commits
cc815f9a
Commit
cc815f9a
authored
Jun 16, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update
parent
165d1ca6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
19 deletions
+26
-19
modal-name.tsx
src/pages/accept-pk/components/modal-name.tsx
+4
-1
index.tsx
src/pages/accept-pk/index.tsx
+19
-3
count-up.tsx
src/pages/game/play/components/count-up.tsx
+1
-1
index.ts
src/pages/game/play/model/index.ts
+0
-8
types.ts
src/pages/game/play/model/types.ts
+1
-5
index.tsx
src/pages/prepare/index.tsx
+1
-1
No files found.
src/pages/accept-pk/components/modal-name.tsx
View file @
cc815f9a
...
...
@@ -19,9 +19,11 @@ const randomPick = (arr: string[]) => {
const
ModalName
=
({
isVisible
,
onClose
,
onFinish
,
}:
{
isVisible
:
boolean
onClose
:
()
=>
void
onClose
:
()
=>
void
;
onFinish
:
()
=>
void
;
})
=>
{
const
[
name
,
setName
]
=
useState
(
'小明'
)
const
[
generating
,
{
setTrue
,
setFalse
}]
=
useBoolean
(
false
)
...
...
@@ -90,6 +92,7 @@ const ModalName = ({
size=
"large"
image=
{
styles
.
footerButton
}
hoverImage=
{
styles
.
footerHoverButton
}
onClick=
{
onFinish
}
>
确定
</
Button
>
...
...
src/pages/accept-pk/index.tsx
View file @
cc815f9a
import
{
useDidShow
,
useRouter
}
from
'@tarojs/taro'
import
{
useDidShow
,
useRouter
,
navigateTo
}
from
'@tarojs/taro'
import
{
View
,
Image
,
Text
}
from
'@tarojs/components'
import
{
useBoolean
}
from
'@/hooks'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
...
...
@@ -14,6 +14,8 @@ const AcceptPk = () => {
const
router
=
useRouter
<
{
initiator
?:
string
;
stageId
?:
string
}
>
()
const
details
=
useStoreState
((
state
)
=>
state
.
battlesModel
.
details
)
const
userInfo
=
useStoreState
((
state
)
=>
state
.
userModel
.
userInfo
)
const
fetchUserDetails
=
useStoreActions
(
(
actions
)
=>
actions
.
battlesModel
.
fetchUserDetails
)
...
...
@@ -27,6 +29,20 @@ const AcceptPk = () => {
}
})
const
toGame
=
()
=>
{
navigateTo
({
url
:
`/pages/game/play/index?id=
${
router
.
params
.
stageId
}
`
})
}
const
handleClick
=
()
=>
{
if
(
!
userInfo
.
nickName
)
{
setTrue
()
}
else
{
toGame
()
}
}
return
(
<
View
className=
{
styles
.
container
}
>
<
TopHeader
/>
...
...
@@ -94,13 +110,13 @@ const AcceptPk = () => {
<
View
className=
{
styles
.
bottom
}
>
<
Image
className=
{
styles
.
clickImage
}
onClick=
{
setTrue
}
onClick=
{
handleClick
}
src=
{
assetsPk
[
'accept-click.png'
].
u
}
/>
</
View
>
</
View
>
<
ModalName
isVisible=
{
isVisible
}
onClose=
{
setFalse
}
/>
<
ModalName
isVisible=
{
isVisible
}
onClose=
{
setFalse
}
onFinish=
{
toGame
}
/>
</
View
>
)
}
...
...
src/pages/game/play/components/count-up.tsx
View file @
cc815f9a
...
...
@@ -23,7 +23,7 @@ const CountUp = (props: CountUpProps) => {
const
questionList
=
useStoreState
(
state
=>
state
.
gameModel
.
questionList
)
const
isSubmit
=
useStoreState
(
state
=>
state
.
gameModel
.
isSubmit
)
const
submit
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
submit
)
const
pkDetail
=
useStoreState
(
state
=>
state
.
gameModel
.
pkDetail
)
const
pkDetail
=
useStoreState
(
state
=>
state
.
battlesModel
.
details
)
const
[
isExceed
,
exceedActions
]
=
useBoolean
(
false
)
const
[
isStarted
,
startActions
]
=
useBoolean
(
false
)
...
...
src/pages/game/play/model/index.ts
View file @
cc815f9a
...
...
@@ -35,7 +35,6 @@ const stopCounter = () => getCounter()?.stop()
const
startCounter
=
()
=>
getCounter
()?.
start
()
const
gameModel
:
GameModel
=
{
pkDetail
:
null
,
counterId
:
COUNTER_ID
,
questionList
:
[],
errList
:
[],
...
...
@@ -59,13 +58,6 @@ const gameModel: GameModel = {
upGear
:
true
},
getPkDetail
:
thunk
(
async
(
actions
,
payload
)
=>
{
try
{
const
{
data
}
=
await
fetchUserDetails
(
payload
)
actions
.
updateState
({
pkDetail
:
data
})
}
catch
(
err
)
{}
}),
bornTimes
:
3
,
modalContinueVisible
:
false
,
gameStartTime
:
0
,
...
...
src/pages/game/play/model/types.ts
View file @
cc815f9a
...
...
@@ -2,7 +2,7 @@ import { Action, Computed, Thunk } from 'easy-peasy'
import
{
AppStoreModel
}
from
'@/store/store-model'
import
{
type
StageDetail
,
type
CompleteStageOut
,
PkDetails
type
CompleteStageOut
}
from
'@/api'
import
{
QuestionType
,
...
...
@@ -39,8 +39,6 @@ export interface GameModelState {
counterId
:
string
;
rightIcon
:
string
|
null
;
pkDetail
:
PkDetails
|
null
;
}
export
interface
GameModel
extends
GameModelState
{
...
...
@@ -71,6 +69,4 @@ export interface GameModel extends GameModelState {
submit
:
Thunk
<
GameModel
,
void
,
void
,
AppStoreModel
>
;
reborn
:
Thunk
<
GameModel
,
void
,
void
,
AppStoreModel
>
;
getPkDetail
:
Thunk
<
GameModel
,
{
userId
:
number
;
stageId
:
number
},
void
,
AppStoreModel
>
;
}
src/pages/prepare/index.tsx
View file @
cc815f9a
...
...
@@ -131,7 +131,7 @@ const Prepare = () => {
getQuestionList(+router.params.id || 1).then(() => {
isClickRef.current = false
navigateTo({
url: `
/
pages
/
game
/
play
/
index
?
id
=
$
{
router
.
params
.
id
}
&
isBattle
=
true
&
initiatorTime
=
30
`
url: `
/
pages
/
game
/
play
/
index
?
id
=
$
{
router
.
params
.
id
}
`
})
})
}
...
...
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