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
2dfaaf17
Commit
2dfaaf17
authored
Mar 30, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 答题
parent
e581a256
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
11 deletions
+14
-11
answer-blank.module.scss
src/pages/game/play/components/answer-blank.module.scss
+2
-2
page-footer.tsx
src/pages/game/play/components/page-footer.tsx
+3
-8
index.ts
src/pages/game/play/model/index.ts
+9
-1
No files found.
src/pages/game/play/components/answer-blank.module.scss
View file @
2dfaaf17
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
color
:
#465164
;
color
:
#465164
;
text-align
:
center
;
text-align
:
center
;
min-width
:
84px
;
min-width
:
84px
;
line-height
:
7
0
px
;
line-height
:
7
2
px
;
height
:
84px
;
height
:
84px
;
font-size
:
50px
;
font-size
:
50px
;
padding
:
0
8px
;
padding
:
0
8px
;
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
&
.is_simple
{
&
.is_simple
{
border-radius
:
32px
;
border-radius
:
32px
;
font-size
:
80px
;
font-size
:
80px
;
line-height
:
1
12
px
;
line-height
:
1
00
px
;
min-width
:
112px
;
min-width
:
112px
;
height
:
112px
;
height
:
112px
;
}
}
...
...
src/pages/game/play/components/page-footer.tsx
View file @
2dfaaf17
import
{
View
,
Image
,
CustomWrapper
}
from
'@tarojs/components'
import
{
View
,
Image
,
CustomWrapper
}
from
'@tarojs/components'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
use
Callback
,
use
Memo
}
from
'react'
import
{
useMemo
}
from
'react'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
styles
from
'./page-footer.module.scss'
import
styles
from
'./page-footer.module.scss'
...
@@ -12,13 +12,8 @@ const PageFooter = () => {
...
@@ -12,13 +12,8 @@ const PageFooter = () => {
const
isLastQuestion
=
useMemo
(()
=>
{
const
isLastQuestion
=
useMemo
(()
=>
{
return
questionList
.
length
===
currentQuestionIndex
+
1
return
questionList
.
length
===
currentQuestionIndex
+
1
},
[
questionList
,
currentQuestionIndex
])
},
[
questionList
,
currentQuestionIndex
])
const
updateCurrentIndex
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
updateCurrentIndex
)
const
clearUserAnswer
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
clearUserAnswer
)
const
clearUserAnswer
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
clearUserAnswer
)
const
handleGoNext
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
handleGoNext
)
const
handleGoNext
=
useCallback
(()
=>
{
if
(
!
canGoNext
)
return
updateCurrentIndex
(
currentQuestionIndex
+
1
)
},
[
canGoNext
,
updateCurrentIndex
,
currentQuestionIndex
])
return
(
return
(
<
CustomWrapper
>
<
CustomWrapper
>
...
@@ -35,7 +30,7 @@ const PageFooter = () => {
...
@@ -35,7 +30,7 @@ const PageFooter = () => {
<
View
<
View
className=
{
classNames
(
styles
.
btn_right
,
!
canGoNext
&&
styles
.
disabled
)
}
className=
{
classNames
(
styles
.
btn_right
,
!
canGoNext
&&
styles
.
disabled
)
}
hoverClass=
{
canGoNext
?
styles
.
is_active
:
null
}
hoverClass=
{
canGoNext
?
styles
.
is_active
:
null
}
onClick=
{
handleGoNext
}
onClick=
{
()
=>
handleGoNext
()
}
>
{
isLastQuestion
?
'提交'
:
'下一题'
}
</
View
>
>
{
isLastQuestion
?
'提交'
:
'下一题'
}
</
View
>
</
View
>
</
View
>
</
View
>
</
View
>
...
...
src/pages/game/play/model/index.ts
View file @
2dfaaf17
...
@@ -115,8 +115,16 @@ const gameModel: GameModel = {
...
@@ -115,8 +115,16 @@ const gameModel: GameModel = {
state
.
questionList
=
questionList
state
.
questionList
=
questionList
}),
}),
handleGoNext
:
thunk
(
async
()
=>
{
handleGoNext
:
thunk
(
async
(
actions
,
_
,
helpers
)
=>
{
const
{
canGoNext
,
currentQuestionIndex
,
questionList
}
=
helpers
.
getState
()
if
(
!
canGoNext
)
return
const
len
=
questionList
.
length
if
(
len
===
currentQuestionIndex
+
1
)
{
console
.
log
(
'submit'
)
return
}
actions
.
updateCurrentIndex
(
currentQuestionIndex
+
1
)
}),
}),
getQuestionList
:
thunk
(
async
(
actions
,
round
,
helpers
)
=>
{
getQuestionList
:
thunk
(
async
(
actions
,
round
,
helpers
)
=>
{
...
...
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