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
da8c92e0
Commit
da8c92e0
authored
Apr 03, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update
parent
e68d6cde
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
17 deletions
+23
-17
count-up.tsx
src/pages/game/play/components/count-up.tsx
+1
-2
index.ts
src/pages/game/play/model/index.ts
+22
-15
No files found.
src/pages/game/play/components/count-up.tsx
View file @
da8c92e0
...
@@ -45,9 +45,8 @@ const CountUp = (props: CountUpProps) => {
...
@@ -45,9 +45,8 @@ const CountUp = (props: CountUpProps) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
isSubmit
&&
countUp
.
current
?.
sid
)
{
if
(
isSubmit
&&
countUp
.
current
?.
sid
)
{
console
.
log
(
countUp
.
current
)
console
.
log
(
countUp
.
current
)
const
comp
=
getCurrentInstance
()?.
page
?.
selectComponent
?.(
`#
${
countUp
.
current
?
.
sid
}
`) as any
const
comp
=
getCurrentInstance
()?.
page
?.
selectComponent
?.(
`#
${
countUp
.
current
.
sid
}
`
)
as
any
comp
?.
stop
?.()
comp
?.
stop
?.()
console.log(comp, 11)
}
}
},
[
isSubmit
])
},
[
isSubmit
])
...
...
src/pages/game/play/model/index.ts
View file @
da8c92e0
import
{
action
,
Action
,
computed
,
Computed
,
State
,
Thunk
,
thunk
}
from
'easy-peasy'
import
{
action
,
Action
,
computed
,
Computed
,
Thunk
,
thunk
}
from
'easy-peasy'
import
{
AppStoreModel
}
from
'@/store/store-model'
import
{
AppStoreModel
}
from
'@/store/store-model'
import
{
getQuestionList
,
type
StageDetail
,
getStageDetail
,
completeStage
,
StageType
,
type
CompleteStageOut
,
StageLevel
}
from
'@/api'
import
{
getQuestionList
,
type
StageDetail
,
getStageDetail
,
completeStage
,
StageType
,
type
CompleteStageOut
,
StageLevel
}
from
'@/api'
import
{
showLoading
,
hideLoading
,
showModal
,
redirectTo
,
vibrateShort
}
from
'@tarojs/taro'
import
{
showLoading
,
hideLoading
,
showModal
,
redirectTo
,
vibrateShort
}
from
'@tarojs/taro'
...
@@ -17,24 +17,29 @@ interface CompleteStageDetail extends CompleteStageOut {
...
@@ -17,24 +17,29 @@ interface CompleteStageDetail extends CompleteStageOut {
levelTime
:
number
;
levelTime
:
number
;
}
}
export
interface
GameModel
{
interface
GameModelState
{
/** 题目列表 */
/** 题目列表 */
questionList
:
QuestionType
[];
questionList
:
QuestionType
[];
stageDetail
:
StageDetail
|
null
;
stageDetail
:
StageDetail
|
null
;
gameResult
:
CompleteStageDetail
|
null
;
gameResult
:
CompleteStageDetail
|
null
;
gameStartTime
:
number
;
gameStartTime
:
number
;
updateState
:
Action
<
GameModel
,
Partial
<
State
<
GameModel
>>>
;
/** 当前题目 */
currentQuestion
:
Computed
<
GameModel
,
QuestionType
|
undefined
>
;
/** 当前题目下标 */
/** 当前题目下标 */
currentQuestionIndex
:
number
;
currentQuestionIndex
:
number
;
/** 当前输入框下标 */
currentInputIndex
:
number
;
isSubmit
:
boolean
;
modalContinueVisible
:
boolean
;
}
export
interface
GameModel
extends
GameModelState
{
updateState
:
Action
<
GameModel
,
Partial
<
GameModelState
>>
;
/** 当前题目 */
currentQuestion
:
Computed
<
GameModel
,
QuestionType
|
undefined
>
;
/** 题目答案和用户答案 */
/** 题目答案和用户答案 */
questionAnswers
:
Computed
<
GameModel
,
QuestionAnswer
[]
|
undefined
>
;
questionAnswers
:
Computed
<
GameModel
,
QuestionAnswer
[]
|
undefined
>
;
/** 更新当前题目下标 */
/** 更新当前题目下标 */
updateCurrentIndex
:
Action
<
GameModel
,
number
>
;
updateCurrentIndex
:
Action
<
GameModel
,
number
>
;
/** 当前输入框下标 */
currentInputIndex
:
number
;
/** 更新当前输入框下标 */
/** 更新当前输入框下标 */
updateCurrentInputIndex
:
Action
<
GameModel
,
number
>
;
updateCurrentInputIndex
:
Action
<
GameModel
,
number
>
;
/** 更新用户输入 */
/** 更新用户输入 */
...
@@ -51,9 +56,6 @@ export interface GameModel {
...
@@ -51,9 +56,6 @@ export interface GameModel {
getStageDetail
:
Thunk
<
GameModel
,
number
,
void
,
AppStoreModel
>
;
getStageDetail
:
Thunk
<
GameModel
,
number
,
void
,
AppStoreModel
>
;
handleGoNext
:
Thunk
<
GameModel
,
void
,
void
,
AppStoreModel
>
;
handleGoNext
:
Thunk
<
GameModel
,
void
,
void
,
AppStoreModel
>
;
isSubmit
:
boolean
;
modalContinueVisible
:
boolean
;
submit
:
Thunk
<
GameModel
,
void
,
void
,
AppStoreModel
>
;
submit
:
Thunk
<
GameModel
,
void
,
void
,
AppStoreModel
>
;
}
}
...
@@ -214,6 +216,10 @@ const gameModel: GameModel = {
...
@@ -214,6 +216,10 @@ const gameModel: GameModel = {
const
{
data
:
questionList
}
=
await
getQuestionList
(
round
)
const
{
data
:
questionList
}
=
await
getQuestionList
(
round
)
actions
.
updateState
({
actions
.
updateState
({
questionList
:
questionList
.
map
(
convertQuestion
),
questionList
:
questionList
.
map
(
convertQuestion
),
currentInputIndex
:
0
,
isSubmit
:
false
,
currentQuestionIndex
:
0
,
modalContinueVisible
:
false
,
gameStartTime
:
Date
.
now
(),
gameStartTime
:
Date
.
now
(),
})
})
// hideLoading()
// hideLoading()
...
@@ -225,7 +231,9 @@ const gameModel: GameModel = {
...
@@ -225,7 +231,9 @@ const gameModel: GameModel = {
showCancel
:
false
,
showCancel
:
false
,
})
})
actions
.
updateState
({
actions
.
updateState
({
stageDetail
:
null
questionList
:
[],
currentInputIndex
:
0
,
currentQuestionIndex
:
0
,
})
})
}
}
}),
}),
...
@@ -247,18 +255,17 @@ const gameModel: GameModel = {
...
@@ -247,18 +255,17 @@ const gameModel: GameModel = {
levelTime
:
params
.
levelTime
levelTime
:
params
.
levelTime
}
}
})
})
hideLoading
()
redirectTo
({
redirectTo
({
url
:
'/pages/game/complete/index'
,
url
:
'/pages/game/complete/index'
,
})
})
}
catch
(
err
)
{
}
catch
(
err
)
{
hideLoading
()
showModal
({
showModal
({
title
:
'提示'
,
title
:
'提示'
,
content
:
err
.
message
||
'出错了'
,
content
:
err
.
message
||
'出错了'
,
showCancel
:
false
,
showCancel
:
false
,
})
})
console
.
log
(
err
)
}
finally
{
hideLoading
()
}
}
}),
}),
}
}
...
...
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