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
83123b6f
Commit
83123b6f
authored
Apr 21, 2023
by
666
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 优化代码
parent
9ea07dd7
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
243 additions
and
190 deletions
+243
-190
.oss
assets/tutorial/.oss
+24
-0
arror-bottom-left.png
assets/tutorial/arror-bottom-left.png
+0
-0
arrow-top-left.png
assets/tutorial/arrow-top-left.png
+0
-0
cat-4.png
assets/tutorial/cat-4.png
+0
-0
cat-5.png
assets/tutorial/cat-5.png
+0
-0
assets-tutorial.ts
src/assets/oss/assets-tutorial.ts
+20
-0
main-header.module.scss
src/pages/prepare/components/main-header.module.scss
+1
-1
cat-1.png
src/pages/prepare/guide/assets/cat-1.png
+0
-0
cat-4.png
src/pages/prepare/guide/assets/cat-4.png
+0
-0
cat-5.png
src/pages/prepare/guide/assets/cat-5.png
+0
-0
scene-1.tsx
src/pages/prepare/guide/complete/scene-1.tsx
+11
-32
scene-2.module.scss
src/pages/prepare/guide/complete/scene-2.module.scss
+7
-8
scene-2.tsx
src/pages/prepare/guide/complete/scene-2.tsx
+121
-123
scene-3.module.scss
src/pages/prepare/guide/complete/scene-3.module.scss
+16
-1
scene-3.tsx
src/pages/prepare/guide/complete/scene-3.tsx
+6
-5
scene-1.tsx
src/pages/prepare/guide/first/scene-1.tsx
+14
-13
index.module.scss
src/pages/prepare/index.module.scss
+13
-0
index.tsx
src/pages/prepare/index.tsx
+9
-6
index.ts
src/pages/prepare/model/index.ts
+1
-1
No files found.
assets/tutorial/.oss
View file @
83123b6f
...
...
@@ -94,5 +94,29 @@
"w": 750,
"h": 960,
"ossName": "/pk-math/39zMBKhthpUN8JGaLtJ5e1qmnewc/750x960"
},
"arror-bottom-left.png": {
"u": "https://cdn.jkwljy.com/pk-math/21nmtfooeLeoKtMNsHqa2AMinWSi/128x128",
"w": 128,
"h": 128,
"ossName": "/pk-math/21nmtfooeLeoKtMNsHqa2AMinWSi/128x128"
},
"arrow-top-left.png": {
"u": "https://cdn.jkwljy.com/pk-math/3VAxvzEMBNyVZMuwf8hRTWDvgtnC/128x128",
"w": 128,
"h": 128,
"ossName": "/pk-math/3VAxvzEMBNyVZMuwf8hRTWDvgtnC/128x128"
},
"cat-4.png": {
"u": "https://cdn.jkwljy.com/pk-math/3tYeViwvJo7vFGEUsNhaCSfx8G55/300x300",
"w": 300,
"h": 300,
"ossName": "/pk-math/3tYeViwvJo7vFGEUsNhaCSfx8G55/300x300"
},
"cat-5.png": {
"u": "https://cdn.jkwljy.com/pk-math/2kSynNrNPPyZCzys49Bs9yVkqCr/200x300",
"w": 200,
"h": 300,
"ossName": "/pk-math/2kSynNrNPPyZCzys49Bs9yVkqCr/200x300"
}
}
src/pages/prepare/guide/assets/arrow
.png
→
assets/tutorial/arror-bottom-left
.png
View file @
83123b6f
File moved
src/pages/prepare/guide/assets
/arrow-top-left.png
→
assets/tutorial
/arrow-top-left.png
View file @
83123b6f
File moved
src/pages/prepare/guide/assets/cat-3
.png
→
assets/tutorial/cat-4
.png
View file @
83123b6f
File moved
src/pages/prepare/guide/assets/cat-2
.png
→
assets/tutorial/cat-5
.png
View file @
83123b6f
File moved
src/assets/oss/assets-tutorial.ts
View file @
83123b6f
...
...
@@ -80,5 +80,25 @@ export default {
"u"
:
"https://cdn.jkwljy.com/pk-math/39zMBKhthpUN8JGaLtJ5e1qmnewc/750x960"
,
"w"
:
750
,
"h"
:
960
},
"arror-bottom-left.png"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/21nmtfooeLeoKtMNsHqa2AMinWSi/128x128"
,
"w"
:
128
,
"h"
:
128
},
"arrow-top-left.png"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/3VAxvzEMBNyVZMuwf8hRTWDvgtnC/128x128"
,
"w"
:
128
,
"h"
:
128
},
"cat-4.png"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/3tYeViwvJo7vFGEUsNhaCSfx8G55/300x300"
,
"w"
:
300
,
"h"
:
300
},
"cat-5.png"
:
{
"u"
:
"https://cdn.jkwljy.com/pk-math/2kSynNrNPPyZCzys49Bs9yVkqCr/200x300"
,
"w"
:
200
,
"h"
:
300
}
}
as
const
src/pages/prepare/components/main-header.module.scss
View file @
83123b6f
...
...
@@ -173,7 +173,7 @@
@include
flexLayout
(
column
);
gap
:
12
PX
;
// animation: fadeInLeft 1s ease-in-out forwards;
.againDetail
{
// animation: fadeInScale 1s ease-in backwards;
@include
flexLayout
(
row
,
center
,
space-between
);
...
...
src/pages/prepare/guide/assets/cat-1.png
deleted
100644 → 0
View file @
9ea07dd7
27.9 KB
src/pages/prepare/guide/assets/cat-4.png
deleted
100644 → 0
View file @
9ea07dd7
38.3 KB
src/pages/prepare/guide/assets/cat-5.png
deleted
100644 → 0
View file @
9ea07dd7
29.2 KB
src/pages/prepare/guide/complete/scene-1.tsx
View file @
83123b6f
...
...
@@ -16,35 +16,14 @@ export const Scene = ({ children }: { children: React.ReactNode }) => {
const
stageDetail
=
useStoreState
(
state
=>
state
.
gameModel
.
stageDetail
)
const
showMask
=
useMemo
(()
=>
{
return
!
guideComplete
&&
guideActive
},
[
guideComplete
,
guideActive
])
return
!
guideComplete
&&
guideActive
&&
passStep
===
1
},
[
guideComplete
,
guideActive
,
passStep
])
useEffect
(()
=>
{
if
(
!
guideComplete
)
{
updateState
({
guideActive
:
true
})
}
},
[
guideComplete
])
const
renderMessage
=
(
step
:
number
)
=>
{
switch
(
step
)
{
case
1
:
return
(
<
Text
>
哇,你通关了,表现不错哦;你的熟练度,
<
Text
className=
{
styles
.
strong
}
>
打败了
{
stageDetail
?.
gear
||
0
}
%的同学
</
Text
>
,当然相信你还可以变得更好!
</
Text
>
)
case
2
:
return
(
<
Text
>
想通关,首先要
<
Text
className=
{
styles
.
strong
}
>
考验你的准确性
</
Text
>
,粗心大意可是通不了关的哦。
</
Text
>
)
}
}
},
[
guideComplete
,
updateState
])
return
(
<
UserGuideView
...
...
@@ -53,15 +32,15 @@ export const Scene = ({ children }: { children: React.ReactNode }) => {
isActive=
{
showMask
&&
passStep
<
3
}
guideContent=
{
(
<
View
className=
{
styles
.
guide
}
>
<
Image
className=
{
styles
.
guideCat
}
src=
{
require
(
'../assets/cat-3.png'
)
}
/>
<
Image
className=
{
styles
.
guideCat
}
src=
{
tutorialAssets
[
'cat-4.png'
].
u
}
/>
<
View
className=
{
styles
.
guideMain
}
>
<
View
className=
{
styles
.
inner
}
>
{
renderMessage
(
passStep
)
}
<
View
className=
{
styles
.
continue
}
onClick=
{
()
=>
updateState
({
passStep
:
passStep
+
1
})
}
>
<
Text
>
继续
</
Text
>
<
View
className=
{
styles
.
inner
}
onClick=
{
()
=>
updateState
({
passStep
:
passStep
+
1
})
}
>
<
Text
>
哇,你通关了,表现不错哦;你的熟练度,
<
Text
className=
{
styles
.
strong
}
>
打败了
{
stageDetail
?.
gear
||
0
}
%的同学
</
Text
>
,当然相信你还可以变得更好!
</
Text
>
<
View
className=
{
styles
.
continue
}
>
<
Image
style=
{
{
width
:
14
,
height
:
14
}
}
src=
{
tutorialAssets
[
'continue-arrow.png'
].
u
}
/></
View
>
</
View
>
</
View
>
...
...
src/pages/prepare/guide/complete/scene-2.module.scss
View file @
83123b6f
.wrapperScene2
{
.wrapperScene
{
border-radius
:
20px
;
}
.bordered
{
border-radius
:
32px
;
// padding: 8PX;
border
:
2
PX
dashed
#FFFFFF
;
}
.guide
{
...
...
@@ -43,10 +49,4 @@
gap
:
2
PX
;
}
}
}
.bordered
{
border-radius
:
32px
;
padding
:
8
PX
;
border
:
2
PX
dashed
#FFFFFF
;
}
\ No newline at end of file
src/pages/prepare/guide/complete/scene-2.tsx
View file @
83123b6f
import
{
View
,
Image
,
Text
}
from
'@tarojs/components'
import
{
useCallback
,
useEffect
,
useMemo
}
from
'react'
import
{
pageScrollTo
}
from
'@tarojs/taro'
import
tutorialAssets
from
'@/assets/oss/assets-tutorial'
import
UserGuideView
from
'@/components/UserGuideView'
import
classNames
from
'classnames'
...
...
@@ -8,149 +9,146 @@ import { useStoreState, useStoreActions } from '@/store/hooks'
import
styles
from
'./scene-2.module.scss'
import
wrapStyles
from
'../../components/main-header.module.scss'
const
useStepDetails
=
(
stageDetail
,
targetSteps
)
=>
{
return
useMemo
(()
=>
{
const
details
=
targetSteps
.
map
(
targetStep
=>
{
const
detail
=
stageDetail
?.
nextSteps
?.
find
(
step
=>
step
.
nextStep
===
targetStep
)
const
index
=
stageDetail
?.
nextSteps
?.
findIndex
(
step
=>
step
.
nextStep
===
targetStep
)
return
{
detail
,
index
,
}
})
.
filter
(
item
=>
item
.
detail
!==
undefined
&&
item
.
index
!==
-
1
)
return
details
},
[
stageDetail
?.
nextSteps
,
targetSteps
])
}
const
MessageRenderer
=
({
step
,
level
,
gear
,
upGear
})
=>
{
const
renderMessage
=
useCallback
(()
=>
{
const
detailIndexMap
=
{
level
,
gear
,
upGear
}
const
targetStep
=
Object
.
keys
(
detailIndexMap
).
find
(
key
=>
detailIndexMap
[
key
].
index
+
2
===
step
)
if
(
!
targetStep
)
{
return
null
}
const
{
detail
}
=
detailIndexMap
[
targetStep
]
const
textTemplate
=
{
upGear
:
(
<>
你只要
<
Text
className=
{
styles
.
strong
}
>
再快
{
detail
.
nextStepTime
}
秒
</
Text
>
,就可以领先更多同学,提升你的档位,
<
Text
className=
{
styles
.
strong
}
>
获得【升档】勋章和
{
detail
.
nextStepReward
}
水晶奖励
</
Text
>
,粗心大意可是通不了关的哦。
</>
),
gear
:
(
<>
如果你更加熟练,
<
Text
className=
{
styles
.
strong
}
>
再快
{
detail
.
nextStepTime
}
秒
</
Text
>
,就说明你到这个技能的顶尖水平了,并
<
Text
className=
{
styles
.
strong
}
>
获得象征荣耀的【TOP】(前30%、20%、10%)勋章和水晶奖励
</
Text
>
。
</>
),
level
:
(
<>
只要你
<
Text
className=
{
styles
.
strong
}
>
再提高
{
detail
.
nextStepTime
}
秒
</
Text
>
,
就可以达到
<
Text
className=
{
styles
.
strong
}
>
【
{
detail
.
nextStep
}
级水准】
</
Text
>
,了哦,并
<
Text
className=
{
styles
.
strong
}
>
获得
{
detail
.
nextStepReward
}
水晶奖励
</
Text
>
。
</>
),
}
return
<
Text
>
{
textTemplate
[
targetStep
]
}
</
Text
>
},
[
upGear
,
gear
,
level
,
step
])
return
renderMessage
()
}
export
const
Scene
=
({
children
,
index
}:
{
index
:
number
,
children
:
React
.
ReactNode
})
=>
{
const
passS
tep
=
useStoreState
(
state
=>
state
.
prepareModel
.
passStep
)
const
s
tep
=
useStoreState
(
state
=>
state
.
prepareModel
.
passStep
)
const
guideActive
=
useStoreState
(
state
=>
state
.
prepareModel
.
guideActive
)
const
guideComplete
=
useStoreState
(
state
=>
state
.
prepareModel
.
passGuideComplete
)
const
updateState
=
useStoreActions
(
actions
=>
actions
.
prepareModel
.
updateState
)
const
stageDetail
=
useStoreState
(
state
=>
state
.
gameModel
.
stageDetail
)
const
[
level
,
gear
,
upGear
]
=
useStepDetails
(
stageDetail
,
[
'S'
,
'A'
,
'B'
,
'10'
,
'20'
,
'30'
,
'upGear'
])
const
gear
=
useMemo
(()
=>
{
const
detail
=
stageDetail
?.
nextSteps
?.
find
(
step
=>
[
'10'
,
'20'
,
'30'
].
includes
(
step
.
nextStep
.
toString
()))
const
index1
=
stageDetail
?.
nextSteps
?.
findIndex
(
step
=>
[
'10'
,
'20'
,
'30'
].
includes
(
step
.
nextStep
.
toString
()))
return
{
detail
,
index
:
index1
}
},
[
stageDetail
?.
nextSteps
])
const
level
=
useMemo
(()
=>
{
const
detail
=
stageDetail
?.
nextSteps
?.
find
(
step
=>
[
'S'
,
'A'
,
'B'
].
includes
(
step
.
nextStep
.
toString
()))
const
index1
=
stageDetail
?.
nextSteps
?.
findIndex
(
step
=>
[
'S'
,
'A'
,
'B'
].
includes
(
step
.
nextStep
.
toString
()))
return
{
detail
,
index
:
index1
}
},
[
stageDetail
?.
nextSteps
])
const
upGear
=
useMemo
(()
=>
{
const
detail
=
stageDetail
?.
nextSteps
?.
find
(
step
=>
step
.
nextStep
===
'upGear'
)
const
index1
=
stageDetail
?.
nextSteps
?.
findIndex
(
step
=>
step
.
nextStep
===
'upGear'
)
return
{
detail
,
index
:
index1
}
},
[
stageDetail
?.
nextSteps
])
const
scrollToBottom
=
useCallback
((
scrollTop
?:
number
)
=>
{
pageScrollTo
({
duration
:
600
,
selector
:
'#guideScrollView'
,
scrollTop
:
scrollTop
??
60
,
})
},
[])
const
showMask
=
useMemo
(()
=>
{
// return !guideComplete && guideActive
return
true
},
[
guideComplete
,
guideActive
])
return
!
guideComplete
&&
guideActive
&&
step
===
index
},
[
guideComplete
,
guideActive
,
step
,
index
])
useEffect
(()
=>
{
if
(
guideComplete
!==
undefined
&&
guideComplete
===
fals
e
)
{
if
(
!
guideComplet
e
)
{
updateState
({
guideActive
:
true
})
}
},
[
guideComplete
])
const
renderMessage
=
useCallback
(()
=>
{
if
(
level
&&
level
.
index
!
+
2
===
passStep
)
{
return
(
<
Text
>
只要你
<
Text
className=
{
styles
.
strong
}
>
再提高
{
level
.
detail
?.
nextStepTime
}
秒
</
Text
>
,
就可以达到
<
Text
className=
{
styles
.
strong
}
>
【
{
level
.
detail
?.
nextStep
}
级水准】
</
Text
>
,了哦,并
<
Text
className=
{
styles
.
strong
}
>
获得
{
level
.
detail
?.
nextStepReward
}
水晶奖励
</
Text
>
。
</
Text
>
)
}
if
(
gear
&&
gear
.
index
!
+
2
===
passStep
)
{
return
(
<
Text
>
如果你更加熟练,
<
Text
className=
{
styles
.
strong
}
>
再快
{
gear
.
detail
?.
nextStepTime
}
秒
</
Text
>
,就说明你到这个技能的顶尖水平了,并
<
Text
className=
{
styles
.
strong
}
>
获得象征荣耀的【TOP】(前30%、20%、10%)勋章和水晶奖励
</
Text
>
,
。
</
Text
>
)
}
if
(
upGear
&&
upGear
.
index
!
+
2
===
passStep
)
{
return
(
<
Text
>
你只要
<
Text
className=
{
styles
.
strong
}
>
再快
{
upGear
.
detail
?.
nextStepTime
}
秒
</
Text
>
,就可以领先更多同学,提升你的档位,
<
Text
className=
{
styles
.
strong
}
>
获得【升档】勋章和
{
upGear
.
detail
?.
nextStepReward
}
水晶奖励
</
Text
>
,粗心大意可是通不了关的哦。
</
Text
>
)
}
return
null
},
[
upGear
,
gear
,
passStep
])
},
[
guideComplete
,
updateState
])
const
onClick
=
()
=>
{
if
(
level
.
detail
&&
gear
.
detail
&&
upGear
.
detail
)
{
if
(
passStep
===
4
)
{
updateState
({
passStep
:
10
})
return
}
}
else
if
(
level
.
detail
&&
gear
.
detail
)
{
if
(
passStep
===
3
)
{
updateState
({
passStep
:
10
})
return
}
}
else
if
(
level
.
detail
&&
upGear
.
detail
)
{
if
(
passStep
===
3
)
{
updateState
({
passStep
:
10
})
return
}
}
else
if
(
gear
.
detail
&&
upGear
.
detail
)
{
if
(
passStep
===
3
)
{
updateState
({
passStep
:
10
})
return
}
}
else
if
(
level
.
detail
)
{
if
(
passStep
===
2
)
{
updateState
({
passStep
:
10
})
return
}
}
else
if
(
gear
.
detail
)
{
if
(
passStep
===
2
)
{
updateState
({
passStep
:
10
})
return
}
}
else
if
(
upGear
.
detail
)
{
if
(
passStep
===
2
)
{
updateState
({
passStep
:
10
})
return
}
const
stepDetails
=
[
level
,
gear
,
upGear
]
const
activeSteps
=
stepDetails
.
filter
(
item
=>
item
.
detail
)
const
activeStepIndex
=
activeSteps
.
length
if
(
step
===
activeStepIndex
+
1
)
{
scrollToBottom
(
0
)
setTimeout
(()
=>
{
updateState
({
passStep
:
-
1
})
},
666
)
}
else
{
scrollToBottom
()
updateState
({
passStep
:
step
+
1
})
}
updateState
({
passStep
:
passStep
+
1
})
}
return
(
<
UserGuideView
wrapClass=
{
styles
.
wrapperScene2
}
className=
{
classNames
(
wrapStyles
.
againDetail
,
showMask
&&
passStep
===
index
?
styles
.
bordered
:
null
)
}
isActive=
{
showMask
&&
passStep
===
index
}
guideContent=
{
(
<
View
className=
{
styles
.
guide
}
>
<
Image
className=
{
styles
.
guideCat
}
src=
{
require
(
'../assets/cat-4.png'
)
}
/>
<
View
className=
{
styles
.
guideMain
}
>
<
View
className=
{
styles
.
inner
}
onClick=
{
onClick
}
>
{
renderMessage
()
}
<
View
className=
{
styles
.
continue
}
>
<
Text
>
继续
</
Text
>
<
Image
style=
{
{
width
:
14
,
height
:
14
}
}
src=
{
tutorialAssets
[
'continue-arrow.png'
].
u
}
/></
View
>
<
View
id=
"guideScrollView"
>
<
UserGuideView
horizonPadding=
{
0
}
verticalPadding=
{
0
}
wrapClass=
{
styles
.
wrapperScene
}
className=
{
classNames
(
wrapStyles
.
againDetail
,
showMask
?
styles
.
bordered
:
null
)
}
isActive=
{
showMask
}
guideContent=
{
(
<
View
className=
{
styles
.
guide
}
>
<
Image
className=
{
styles
.
guideCat
}
src=
{
tutorialAssets
[
'cat.png'
].
u
}
/>
<
View
className=
{
styles
.
guideMain
}
>
<
View
className=
{
styles
.
inner
}
onClick=
{
onClick
}
>
<
MessageRenderer
step=
{
step
}
level=
{
level
}
gear=
{
gear
}
upGear=
{
upGear
}
/>
<
View
className=
{
styles
.
continue
}
>
<
Text
>
继续
</
Text
>
<
Image
style=
{
{
width
:
14
,
height
:
14
}
}
src=
{
tutorialAssets
[
'continue-arrow.png'
].
u
}
/></
View
>
</
View
>
</
View
>
</
View
>
</
View
>
)
}
>
{
children
}
</
UserGuide
View
>
)
}
>
{
children
}
</
UserGuideView
>
</
View
>
)
}
...
...
src/pages/prepare/guide/complete/scene-3.module.scss
View file @
83123b6f
...
...
@@ -19,17 +19,32 @@
position
:
relative
;
top
:
-100px
;
left
:
20px
;
@keyframes
arrowAnimation
{
0
%
{
transform
:
translate
(
0
,
0
)
rotate
(
0
);
}
50
%
{
transform
:
translate
(
16px
,
16px
)
rotate
(
0
);
}
100
%
{
transform
:
translate
(
0
,
0
)
rotate
(
0
);
}
}
.tutorialArrow
{
width
:
128px
;
height
:
128px
;
margin-right
:
30px
;
position
:
relative
;
left
:
130px
;
animation
:
arrowAnimation
1
.6s
linear
infinite
;
}
.text
{
width
:
400px
;
line-height
:
1
.6
;
margin
:
40px
0
0
40px
;
}
}
}
...
...
src/pages/prepare/guide/complete/scene-3.tsx
View file @
83123b6f
...
...
@@ -3,19 +3,20 @@ import { useMemo } from 'react'
import
UserGuideView
from
'@/components/UserGuideView'
import
classNames
from
'classnames'
import
{
useStoreState
,
useStoreActions
}
from
'@/store/hooks'
import
tutorialAssets
from
'@/assets/oss/assets-tutorial'
import
styles
from
'./scene-3.module.scss'
import
wrapStyles
from
'../../components/top-bar.module.scss'
export
const
Scene
=
({
children
,
onClickConent
}:
{
onClickConent
:
()
=>
void
,
children
:
React
.
ReactNode
})
=>
{
const
passS
tep
=
useStoreState
(
state
=>
state
.
prepareModel
.
passStep
)
const
s
tep
=
useStoreState
(
state
=>
state
.
prepareModel
.
passStep
)
const
guideActive
=
useStoreState
(
state
=>
state
.
prepareModel
.
guideActive
)
const
guideComplete
=
useStoreState
(
state
=>
state
.
prepareModel
.
passGuideComplete
)
const
completePassGuide
=
useStoreActions
(
actions
=>
actions
.
prepareModel
.
completePassGuide
)
const
showMask
=
useMemo
(()
=>
{
return
!
guideComplete
&&
guideActive
&&
passStep
===
10
},
[
guideComplete
,
guideActive
])
return
!
guideComplete
&&
guideActive
&&
step
===
-
1
},
[
guideComplete
,
guideActive
,
step
])
const
handleCompleteGuide
=
async
()
=>
{
await
completePassGuide
()
...
...
@@ -30,10 +31,10 @@ export const Scene = ({ children, onClickConent }: { onClickConent: () => void,
onClickConent=
{
handleCompleteGuide
}
guideContent=
{
(
<
View
className=
{
styles
.
guide
}
>
<
Image
className=
{
styles
.
guideCat
}
src=
{
require
(
'../assets/cat-5.png'
)
}
/>
<
Image
className=
{
styles
.
guideCat
}
src=
{
tutorialAssets
[
'cat-3.png'
].
u
}
/>
<
View
className=
{
styles
.
guideMain
}
>
<
View
className=
{
styles
.
tutorialFailInner
}
>
<
Image
src=
{
require
(
'../assets/arrow-top-left.png'
)
}
className=
{
styles
.
tutorialArrow
}
/>
<
Image
src=
{
tutorialAssets
[
'arrow-top-left.png'
].
u
}
className=
{
styles
.
tutorialArrow
}
/>
<
View
className=
{
styles
.
text
}
>
对了,水晶有什么用呢?我来介绍一下。
</
View
>
</
View
>
</
View
>
...
...
src/pages/prepare/guide/first/scene-1.tsx
View file @
83123b6f
...
...
@@ -36,32 +36,33 @@ export const Scene = ({ children }: { children: React.ReactNode }) => {
const
updateState
=
useStoreActions
(
actions
=>
actions
.
prepareModel
.
updateState
)
const
showMask
=
useMemo
(()
=>
{
return
!
guideComplete
&&
guideActive
},
[
guideComplete
,
guideActive
])
return
!
guideComplete
&&
guideActive
&&
step
<
3
},
[
guideComplete
,
guideActive
,
step
])
useEffect
(()
=>
{
if
(
guideComplete
!==
undefined
&&
guideComplete
===
fals
e
)
{
if
(
!
guideComplet
e
)
{
updateState
({
guideActive
:
true
})
}
},
[
guideComplete
])
},
[
guideComplete
,
updateState
])
return
(
<
UserGuideView
wrapClass=
{
styles
.
wrapper
}
className=
{
classNames
(
wrapStyles
.
againDetails
,
showMask
?
styles
.
bordered
:
null
)
}
isActive=
{
showMask
&&
step
<
3
}
isActive=
{
showMask
}
guideContent=
{
(
<
View
className=
{
styles
.
top
}
>
<
Image
style=
{
{
width
:
100
,
height
:
110
}
}
src=
{
require
(
'../assets/cat-1.png'
)
}
/>
<
Image
style=
{
{
width
:
100
,
height
:
110
}
}
src=
{
tutorialAssets
[
'cat-2.png'
].
u
}
/>
<
View
className=
{
styles
.
content
}
>
<
View
className=
{
styles
.
inner
}
>
<
View
className=
{
styles
.
inner
}
onClick=
{
()
=>
updateState
({
step
:
step
+
1
})
}
>
{
renderMessage
(
step
)
}
<
View
className=
{
styles
.
continue
}
onClick=
{
()
=>
updateState
({
step
:
step
+
1
})
}
>
<
View
className=
{
styles
.
continue
}
>
<
Text
>
继续
</
Text
>
<
Image
style=
{
{
width
:
14
,
height
:
14
}
}
src=
{
tutorialAssets
[
'continue-arrow.png'
].
u
}
/></
View
>
</
View
>
...
...
src/pages/prepare/index.module.scss
View file @
83123b6f
...
...
@@ -321,11 +321,24 @@
display
:
flex
;
flex-direction
:
column
;
@keyframes
arrowAnimation
{
0
%
{
transform
:
translate
(
0
,
0
)
rotate
(
0
);
}
50
%
{
transform
:
translate
(
-16px
,
16px
)
rotate
(
0
);
}
100
%
{
transform
:
translate
(
0
,
0
)
rotate
(
0
);
}
}
&
_arrow
{
margin-top
:
18px
;
margin-left
:
50px
;
width
:
128px
;
height
:
128px
;
animation
:
arrowAnimation
1
.6s
linear
infinite
;
}
}
...
...
src/pages/prepare/index.tsx
View file @
83123b6f
...
...
@@ -15,6 +15,7 @@ import assetsGroup from '@/assets/oss/assets-group'
import
{
palyAudio
}
from
'@/utils/play-audio'
import
audio
from
'@/assets/oss/assets-audio'
import
{
EyeProtectionView
}
from
'@/components'
import
tutorialAssets
from
'@/assets/oss/assets-tutorial'
import
Tabs
,
{
type
TabItem
}
from
'./components/tabs'
import
TopBar
from
'./components/top-bar'
...
...
@@ -36,6 +37,7 @@ const Prepare = () => {
const
cardNum
=
useStoreState
(
state
=>
state
.
userModel
.
cardNum
)
const
point
=
useStoreState
(
state
=>
state
.
userModel
.
point
)
const
userInfo
=
useStoreState
(
state
=>
state
.
userModel
.
userInfo
)
// const isSubmit = true
const
isSubmit
=
useStoreState
(
state
=>
state
.
gameModel
.
isSubmit
)
const
tribeInfo
=
useStoreState
(
state
=>
state
.
groupModel
.
tribeInfo
)
const
stageList
=
useStoreState
(
state
=>
state
.
mainModel
.
stageList
)
...
...
@@ -109,7 +111,7 @@ const Prepare = () => {
!guideComplete && await completeGuide()
/** 首次闯关失败引导完成 */
!failGuideComplete && await completeFailGuide()
isSubmit &&
!failGuideComplete && await completeFailGuide()
if (cardNum < 1 && !stageDetail?.firstTime) {
setTrue()
...
...
@@ -131,6 +133,7 @@ const Prepare = () => {
const guideActive = useStoreState(state => state.prepareModel.guideActive)
const updateGuideState = useStoreActions(actions => actions.prepareModel.updateState)
/** 显示首次闯关引导开始闯关按钮 */
const showMask = useMemo(() => {
return step === 3 && guideActive && !guideComplete
}, [step, guideActive, guideComplete])
...
...
@@ -140,7 +143,7 @@ const Prepare = () => {
{showMask && <View className={styles.mask}></View>}
{showMask && <View className={styles.tutorial}>
<Text>让我们开始试试吧!</Text>
<Image src={
require('./guide/assets/arrow.png')
} className={styles.tutorial_arrow}></Image>
<Image src={
tutorialAssets['arror-bottom-left.png'].u
} className={styles.tutorial_arrow}></Image>
</View>}
<View className={classNames(styles.challenge, showMask ? styles.maskWrap : null)}>
<Button size="large" onClick={handleClick} image={styles.image} hoverImage={styles.hover_image}>
...
...
@@ -183,20 +186,20 @@ const Prepare = () => {
guideActive: true
})
}
}, [
guideActive, isSubmit, failGuideComplete, stageDetail?.level, stageDetail?.firstTim
e])
}, [
isSubmit, failGuideComplete, stageDetail?.level, stageDetail?.firstTime, updateGuideStat
e])
const showFailMask = useMemo(() => {
return guideActive && !failGuideComplete && isSubmit && !hasNextBtn
}, [guideActive, failGuideComplete, hasNextBtn])
}, [guideActive, failGuideComplete, hasNextBtn
, isSubmit
])
const renderAgainActions = () => (
<View>
{showFailMask && <View className={styles.mask}></View>}
{showFailMask && <View className={classNames(styles.tutorial, styles.tutorialFail)}>
<Image className={styles.failGuideCat} src={
require('./guide/assets/cat-2.png')
} />
<Image className={styles.failGuideCat} src={
tutorialAssets['cat-5.png'].u
} />
<View className={styles.tutorialFailInner}>
<Text>嗯,说明这个技能还需要提高哦。我们再来一次吧!</Text>
<Image src={
require('./guide/assets/arrow.png')
} className={styles.tutorial_arrow}></Image>
<Image src={
tutorialAssets['arror-bottom-left.png'].u
} className={styles.tutorial_arrow}></Image>
</View>
</View>}
...
...
src/pages/prepare/model/index.ts
View file @
83123b6f
...
...
@@ -30,7 +30,7 @@ const prepareModel: PrepareModel = {
guideActive
:
false
,
guideComplete
:
getStorage
(
StorageKeys
.
prepareGuideComplete
),
failGuideComplete
:
getStorage
(
StorageKeys
.
prepareFailGuideComplete
),
passGuideComplete
:
getStorage
(
StorageKeys
.
prepare
Fail
GuideComplete
),
passGuideComplete
:
getStorage
(
StorageKeys
.
prepare
Pass
GuideComplete
),
updateState
:
action
((
state
,
payload
)
=>
{
for
(
const
k
in
payload
)
{
...
...
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