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
e16ddc04
Commit
e16ddc04
authored
Apr 05, 2023
by
m
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://118.24.71.244/hewenhao/GeekLearnMathWeapp
parents
eb2bfb58
df1661fb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
16 deletions
+29
-16
index.module.scss
src/components/Button/index.module.scss
+4
-5
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
+18
-9
No files found.
src/components/Button/index.module.scss
View file @
e16ddc04
...
@@ -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
;
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
// width: 100%;
// width: 100%;
background-size
:
100%
100%
;
background-size
:
100%
100%
;
color
:
#FFFFFF
;
color
:
#FFFFFF
;
&
.default
{
&
.default
{
flex
:
1
;
flex
:
1
;
border
:
4rpx
solid
rgba
(
70
,
81
,
100
,
0
.3
);
border
:
4rpx
solid
rgba
(
70
,
81
,
100
,
0
.3
);
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
border-radius
:
36px
;
border-radius
:
36px
;
background-color
:
#1786F7
;
background-color
:
#1786F7
;
}
}
&
.disabled
{
&
.disabled
{
background-image
:
none
;
background-image
:
none
;
background-color
:
#E2E6ED
;
background-color
:
#E2E6ED
;
...
@@ -61,4 +61,4 @@
...
@@ -61,4 +61,4 @@
.spin
{
.spin
{
margin-right
:
12
PX
;
margin-right
:
12
PX
;
}
}
}
}
\ No newline at end of file
src/pages/game/play/index.tsx
View file @
e16ddc04
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 @
e16ddc04
...
@@ -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 @
e16ddc04
...
@@ -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'
...
@@ -104,14 +103,18 @@ const Prepare = () => {
...
@@ -104,14 +103,18 @@ const Prepare = () => {
}
}
}
}
const isLast = useMemo(() => {
return stageList.length - 1 === stageList.findIndex(c => c.id === stageDetail?.id)
}, [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])
}, [stageList, stageDetail?.id
, updateState
])
const renderFisrtActions = () => (
const renderFisrtActions = () => (
<View className={styles.challenge}>
<View className={styles.challenge}>
...
@@ -128,16 +131,22 @@ const Prepare = () => {
...
@@ -128,16 +131,22 @@ 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 && <Button onClick={onNext} size="large" image={styles.short_image} hoverImage={styles.short_hover_image}>
{hasNextBtn && (
下一关
<Button onClick={onNext} size="large" image={styles.short_image} hoverImage={styles.short_hover_image}>
</Button>}
下一关
</Button>
)}
<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