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
df1661fb
Commit
df1661fb
authored
Apr 05, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update
parent
05e10b46
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
12 deletions
+18
-12
index.module.scss
src/components/Button/index.module.scss
+1
-1
index.tsx
src/pages/game/play/index.tsx
+7
-1
index.ts
src/pages/game/play/model/index.ts
+0
-1
index.tsx
src/pages/prepare/index.tsx
+10
-9
No files found.
src/components/Button/index.module.scss
View file @
df1661fb
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
border
:
none
;
border
:
none
;
outline
:
none
;
outline
:
none
;
user-select
:
none
;
user-select
:
none
;
transition
:
all
0
.3s
;
//
transition: all 0.3s;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
justify-content
:
center
;
...
...
src/pages/game/play/index.tsx
View file @
df1661fb
import
{
View
,
ScrollView
}
from
'@tarojs/components'
import
{
View
,
ScrollView
}
from
'@tarojs/components'
import
{
useStoreState
}
from
'@/store/hooks'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
preloadImage
}
from
'@/utils/preload-image'
import
{
preloadImage
}
from
'@/utils/preload-image'
import
{
useEffect
}
from
'react'
import
{
useEffect
}
from
'react'
import
{
useDidShow
}
from
'@tarojs/taro'
import
assets
from
'@/assets/oss/assets-complete'
import
assets
from
'@/assets/oss/assets-complete'
import
ModalContinue
from
'./components/modal-continue'
import
ModalContinue
from
'./components/modal-continue'
...
@@ -27,11 +28,16 @@ const preloadCompleteImages = () => {
...
@@ -27,11 +28,16 @@ const preloadCompleteImages = () => {
const
GamePlay
=
()
=>
{
const
GamePlay
=
()
=>
{
const
currentQuestion
=
useStoreState
(
states
=>
states
.
gameModel
.
currentQuestion
)
const
currentQuestion
=
useStoreState
(
states
=>
states
.
gameModel
.
currentQuestion
)
const
stageDetail
=
useStoreState
(
state
=>
state
.
gameModel
.
stageDetail
)
const
stageDetail
=
useStoreState
(
state
=>
state
.
gameModel
.
stageDetail
)
const
updateState
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
updateState
)
useEffect
(()
=>
{
useEffect
(()
=>
{
preloadCompleteImages
()
preloadCompleteImages
()
},
[])
},
[])
useDidShow
(()
=>
{
updateState
({
isSubmit
:
false
})
})
return
(
return
(
<>
<>
<
View
className=
{
styles
.
viewport
}
>
<
View
className=
{
styles
.
viewport
}
>
...
...
src/pages/game/play/model/index.ts
View file @
df1661fb
...
@@ -240,7 +240,6 @@ const gameModel: GameModel = {
...
@@ -240,7 +240,6 @@ const gameModel: GameModel = {
actions
.
updateState
({
actions
.
updateState
({
questionList
:
questionList
.
map
(
convertQuestion
),
questionList
:
questionList
.
map
(
convertQuestion
),
currentInputIndex
:
0
,
currentInputIndex
:
0
,
isSubmit
:
false
,
currentQuestionIndex
:
0
,
currentQuestionIndex
:
0
,
modalContinueVisible
:
false
,
modalContinueVisible
:
false
,
isReborn
:
false
,
isReborn
:
false
,
...
...
src/pages/prepare/index.tsx
View file @
df1661fb
...
@@ -9,7 +9,6 @@ import ShareView from '@/pages/group/components/share-view'
...
@@ -9,7 +9,6 @@ import ShareView from '@/pages/group/components/share-view'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
{
useBoolean
,
useRequest
}
from
'@/hooks'
import
{
useBoolean
,
useRequest
}
from
'@/hooks'
import
{
pointToCard
}
from
'@/api/account'
import
{
pointToCard
}
from
'@/api/account'
import
{
StageStatus
}
from
'@/api/game'
import
assets
from
'@/assets/oss/assets-prepare'
import
assets
from
'@/assets/oss/assets-prepare'
import
assetsGroup
from
'@/assets/oss/assets-group'
import
assetsGroup
from
'@/assets/oss/assets-group'
...
@@ -105,16 +104,14 @@ const Prepare = () => {
...
@@ -105,16 +104,14 @@ const Prepare = () => {
}
}
const isLast = useMemo(() => {
const isLast = useMemo(() => {
const len = stageList.length
return stageList.length - 1 === stageList.findIndex(c => c.id === stageDetail?.id)
const index = stageList.findIndex(c => c.id === stageDetail?.id)
return len - 1 === index
}, [stageList, stageDetail])
}, [stageList, stageDetail])
const onNext = useCallback(() => {
const onNext = useCallback(() => {
const index = stageList.findIndex(item => item.id === stageDetail?.id)
const index = stageList.findIndex(item => item.id === stageDetail?.id)
const id = stageList[index + 1].id
const id = stageList[index + 1]
?
.id
if (id) {
if (id) {
navigate
To({ url: `
/
pages
/
prepare
/
index
?
id
=
$
{
id
}
` })
redirect
To({ url: `
/
pages
/
prepare
/
index
?
id
=
$
{
id
}
` })
updateState({ isSubmit: false })
updateState({ isSubmit: false })
}
}
}, [stageList, stageDetail?.id, updateState])
}, [stageList, stageDetail?.id, updateState])
...
@@ -134,9 +131,13 @@ const Prepare = () => {
...
@@ -134,9 +131,13 @@ const Prepare = () => {
</View>
</View>
)
)
const hasNextBtn = useMemo(() => {
return stageDetail?.level && isSubmit && !isLast
}, [stageDetail, isSubmit, isLast])
const renderAgainActions = () => (
const renderAgainActions = () => (
<View className={styles.challenge}>
<View className={styles.challenge}>
{
stageDetail?.level && isSubmit && !isLast
&& (
{
hasNextBtn
&& (
<Button onClick={onNext} size="large" image={styles.short_image} hoverImage={styles.short_hover_image}>
<Button onClick={onNext} size="large" image={styles.short_image} hoverImage={styles.short_hover_image}>
下一关
下一关
</Button>
</Button>
...
@@ -144,8 +145,8 @@ const Prepare = () => {
...
@@ -144,8 +145,8 @@ const Prepare = () => {
<Button
<Button
size="large"
size="large"
onClick={handleClick}
onClick={handleClick}
image={classNames(!
stageDetail?.level
? styles.image : styles.long_image)}
image={classNames(!
hasNextBtn
? styles.image : styles.long_image)}
hoverImage={classNames(!
stageDetail?.level
? styles.hover_image : styles.long_hover_image)}
hoverImage={classNames(!
hasNextBtn
? styles.hover_image : styles.long_hover_image)}
>
>
<View className={styles.card} style={{ marginRight: 12 }}>
<View className={styles.card} style={{ marginRight: 12 }}>
<Image className={styles.card_icon} src={require('@/pages/main/assets/ph.png')} />
<Image className={styles.card_icon} src={require('@/pages/main/assets/ph.png')} />
...
...
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