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
b5ddd076
Commit
b5ddd076
authored
Mar 30, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 答题页
parent
dc082867
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
132 additions
and
75 deletions
+132
-75
project.config.json
project.config.json
+0
-0
app.config.ts.tpl
scripts/app.config.ts.tpl
+0
-1
index.js
src/native-components/count-up/index.js
+0
-2
answer-blank.module.scss
src/pages/game/play/components/answer-blank.module.scss
+7
-7
count-up.tsx
src/pages/game/play/components/count-up.tsx
+9
-8
page-footer.tsx
src/pages/game/play/components/page-footer.tsx
+6
-2
question-blank.module.scss
.../game/play/components/question/question-blank.module.scss
+6
-2
question-blank.tsx
src/pages/game/play/components/question/question-blank.tsx
+2
-0
question-selection.module.scss
...e/play/components/question/question-selection.module.scss
+30
-18
question-vertical-division.module.scss
...omponents/question/question-vertical-division.module.scss
+22
-23
rich-text.module.scss
...pages/game/play/components/question/rich-text.module.scss
+1
-1
index.config.ts
src/pages/game/play/index.config.ts
+1
-1
index.ts
src/pages/game/play/model/index.ts
+15
-0
types.ts
src/pages/game/play/types.ts
+17
-0
round-tag.tsx
src/pages/main/components/scene/round-tag.tsx
+6
-2
round.tsx
src/pages/main/components/scene/round.tsx
+7
-1
main.module.scss
src/pages/main/main.module.scss
+0
-4
main.tsx
src/pages/main/main.tsx
+3
-3
No files found.
project.config.json
View file @
b5ddd076
scripts/app.config.ts.tpl
View file @
b5ddd076
...
@@ -49,7 +49,6 @@ export default {
...
@@ -49,7 +49,6 @@ export default {
desc: '你的位置信息将用于小程序位置接口的效果展示',
desc: '你的位置信息将用于小程序位置接口的效果展示',
},
},
},
},
lazyCodeLoading: "requiredComponents",
usingComponents: {
usingComponents: {
"custom-wrapper": "./custom-wrapper"
"custom-wrapper": "./custom-wrapper"
}
}
...
...
src/native-components/count-up/index.js
View file @
b5ddd076
...
@@ -35,7 +35,6 @@ Component({
...
@@ -35,7 +35,6 @@ Component({
},
},
attached
()
{
attached
()
{
console
.
log
(
this
)
this
.
_tick
=
0
this
.
_tick
=
0
this
.
startCount
()
this
.
startCount
()
},
},
...
@@ -50,7 +49,6 @@ Component({
...
@@ -50,7 +49,6 @@ Component({
this
.
stop
()
this
.
stop
()
this
.
_timer
=
setInterval
(()
=>
{
this
.
_timer
=
setInterval
(()
=>
{
this
.
_tick
+=
1
this
.
_tick
+=
1
console
.
log
(
this
.
data
.
maxValue
)
if
(
this
.
_tick
>=
this
.
data
.
maxValue
)
{
if
(
this
.
_tick
>=
this
.
data
.
maxValue
)
{
this
.
stop
()
this
.
stop
()
this
.
triggerEvent
(
'timeup'
)
this
.
triggerEvent
(
'timeup'
)
...
...
src/pages/game/play/components/answer-blank.module.scss
View file @
b5ddd076
...
@@ -2,17 +2,17 @@
...
@@ -2,17 +2,17 @@
display
:
inline-block
;
display
:
inline-block
;
margin
:
0
8px
;
margin
:
0
8px
;
vertical-align
:
middle
;
vertical-align
:
middle
;
min-width
:
56
PX
;
min-width
:
112px
;
height
:
56
PX
;
height
:
112px
;
background
:
#F7F7F7
;
background
:
#F7F7F7
;
border-radius
:
16
PX
;
border-radius
:
32px
;
border
:
3
PX
solid
#E5E5E5
;
border
:
6px
solid
#E5E5E5
;
font-size
:
40
PX
;
font-size
:
80px
;
font-family
:
HelveticaNeue-Medium
,
HelveticaNeue
;
font-family
:
HelveticaNeue-Medium
,
HelveticaNeue
;
font-weight
:
500
;
font-weight
:
500
;
color
:
#465164
;
color
:
#465164
;
line-height
:
56
PX
;
line-height
:
112px
;
text-align
:
center
;
text-align
:
center
;
&
.has_answer
{
&
.has_answer
{
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
}
}
&
.is_compare
{
&
.is_compare
{
border-radius
:
28
PX
;
border-radius
:
56px
;
border-color
:
rgba
(
23
,
134
,
247
,
0
.5
);
border-color
:
rgba
(
23
,
134
,
247
,
0
.5
);
background-color
:
#F1F5FF
;
background-color
:
#F1F5FF
;
}
}
...
...
src/pages/game/play/components/count-up.tsx
View file @
b5ddd076
...
@@ -5,16 +5,17 @@ import { useStoreState } from '@/store/hooks'
...
@@ -5,16 +5,17 @@ import { useStoreState } from '@/store/hooks'
import
styles
from
'./count-up.module.scss'
import
styles
from
'./count-up.module.scss'
const
maxNum
=
10
const
speed
=
4
const
speed
=
3
const
maxDuration
=
maxNum
*
speed
const
id
=
'_process__'
const
id
=
'_process__'
const
CountUp
=
()
=>
{
const
CountUp
=
()
=>
{
const
currentQuestionIndex
=
useStoreState
(
states
=>
states
.
gameModel
.
currentQuestionIndex
)
const
currentQuestionIndex
=
useStoreState
(
states
=>
states
.
gameModel
.
currentQuestionIndex
)
const
questionList
=
useStoreState
(
state
=>
state
.
gameModel
.
questionList
)
const
[
width
,
setWidth
]
=
useState
(
0
)
const
[
width
,
setWidth
]
=
useState
(
0
)
const
questionLength
=
useMemo
(()
=>
{
return
questionList
.
length
},
[
questionList
])
useEffect
(()
=>
{
useEffect
(()
=>
{
const
query
=
createSelectorQuery
()
const
query
=
createSelectorQuery
()
...
@@ -31,15 +32,15 @@ const CountUp = () => {
...
@@ -31,15 +32,15 @@ const CountUp = () => {
const
roleStyle
=
useMemo
(()
=>
{
const
roleStyle
=
useMemo
(()
=>
{
return
{
return
{
transform
:
`translateX(
${
width
}
px)`
,
transform
:
`translateX(
${
width
}
px)`
,
transition
:
`transform
${
maxNum
*
speed
}
s linear`
,
transition
:
`transform
${
questionLength
*
speed
}
s linear`
,
}
}
},
[
width
])
},
[
width
,
questionLength
])
const
processInnerStyle
=
useMemo
(()
=>
{
const
processInnerStyle
=
useMemo
(()
=>
{
return
{
return
{
width
:
`
${
currentQuestionIndex
*
100
/
maxNum
}
%`
width
:
`
${
currentQuestionIndex
*
100
/
questionLength
}
%`
}
}
},
[
currentQuestionIndex
])
},
[
currentQuestionIndex
,
questionLength
])
const
handleTimeUp
=
useCallback
(()
=>
{
const
handleTimeUp
=
useCallback
(()
=>
{
console
.
log
(
'upd1'
)
console
.
log
(
'upd1'
)
...
...
src/pages/game/play/components/page-footer.tsx
View file @
b5ddd076
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
{
useCallback
}
from
'react'
import
{
useCallback
,
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'
...
@@ -8,6 +8,10 @@ import styles from './page-footer.module.scss'
...
@@ -8,6 +8,10 @@ import styles from './page-footer.module.scss'
const
PageFooter
=
()
=>
{
const
PageFooter
=
()
=>
{
const
currentQuestionIndex
=
useStoreState
(
states
=>
states
.
gameModel
.
currentQuestionIndex
)
const
currentQuestionIndex
=
useStoreState
(
states
=>
states
.
gameModel
.
currentQuestionIndex
)
const
canGoNext
=
useStoreState
(
states
=>
states
.
gameModel
.
canGoNext
)
const
canGoNext
=
useStoreState
(
states
=>
states
.
gameModel
.
canGoNext
)
const
questionList
=
useStoreState
(
states
=>
states
.
gameModel
.
questionList
)
const
isLastQuestion
=
useMemo
(()
=>
{
return
questionList
.
length
===
currentQuestionIndex
+
1
},
[
questionList
,
currentQuestionIndex
])
const
updateCurrentIndex
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
updateCurrentIndex
)
const
updateCurrentIndex
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
updateCurrentIndex
)
const
clearUserAnswer
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
clearUserAnswer
)
const
clearUserAnswer
=
useStoreActions
(
actions
=>
actions
.
gameModel
.
clearUserAnswer
)
...
@@ -32,7 +36,7 @@ const PageFooter = () => {
...
@@ -32,7 +36,7 @@ const PageFooter = () => {
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
}
>
下一题
</
View
>
>
{
isLastQuestion
?
'提交'
:
'下一题'
}
</
View
>
</
View
>
</
View
>
</
View
>
</
View
>
</
CustomWrapper
>
</
CustomWrapper
>
...
...
src/pages/game/play/components/question/question-blank.module.scss
View file @
b5ddd076
.content
{
.content
{
font-size
:
40
PX
;
font-weight
:
500
;
font-weight
:
500
;
color
:
#465164
;
color
:
#465164
;
line-height
:
49
PX
;
min-height
:
100%
;
min-height
:
100%
;
font-size
:
32px
;
font-weight
:
500
;
color
:
#465164
;
line-height
:
56px
;
&
.is_sample
{
&
.is_sample
{
font-size
:
80px
;
display
:
flex
;
display
:
flex
;
line-height
:
112px
;
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
justify-content
:
center
;
}
}
...
...
src/pages/game/play/components/question/question-blank.tsx
View file @
b5ddd076
...
@@ -21,8 +21,10 @@ const QuestionBlank = (props: QuestionBlankProps) => {
...
@@ -21,8 +21,10 @@ const QuestionBlank = (props: QuestionBlankProps) => {
return
(
return
(
<
View
className=
{
classNames
(
styles
.
content
,
styles
.
is_sample
)
}
>
<
View
className=
{
classNames
(
styles
.
content
,
styles
.
is_sample
)
}
>
<
View
>
{
tree
.
map
(
item
=>
renderRichText
(
item
))
}
{
tree
.
map
(
item
=>
renderRichText
(
item
))
}
</
View
>
</
View
>
</
View
>
)
)
}
}
...
...
src/pages/game/play/components/question/question-selection.module.scss
View file @
b5ddd076
.content
{
.content
{
font-size
:
16
PX
;
font-size
:
32px
;
font-weight
:
500
;
font-weight
:
500
;
color
:
#465164
;
color
:
#465164
;
line-height
:
28
PX
;
line-height
:
58px
;
&
.is_sample
{
&
.is_sample
{
font-size
:
40
PX
;
font-size
:
80px
;
font-weight
:
500
;
font-weight
:
500
;
line-height
:
49
PX
;
line-height
:
98px
;
padding-top
:
48
PX
;
padding-top
:
96px
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
justify-content
:
center
;
...
@@ -17,11 +17,11 @@
...
@@ -17,11 +17,11 @@
}
}
.option_wrap
{
.option_wrap
{
padding
:
32
PX
16
PX
0
16
PX
;
padding
:
64px
32px
0
32px
;
}
}
.option_item
{
.option_item
{
margin-bottom
:
12
PX
;
margin-bottom
:
24px
;
background
:
#F0F2F9
;
background
:
#F0F2F9
;
border-radius
:
24px
;
border-radius
:
24px
;
display
:
flex
;
display
:
flex
;
...
@@ -39,15 +39,27 @@
...
@@ -39,15 +39,27 @@
}
}
}
}
.is_active
{
.option_index
{
color
:
#FFC056
;
&
:
:
after
{
background
:
#FFC056
;
}
}
.option_content
{
color
:
#FFC056
;
}
}
.option_index
{
.option_index
{
font-size
:
20
PX
;
font-size
:
40px
;
font-weight
:
500
;
font-weight
:
500
;
color
:
#465164
;
color
:
#465164
;
line-height
:
28
PX
;
line-height
:
56px
;
padding
:
5
PX
6
PX
5
PX
14
PX
;
padding
:
10px
12px
10px
28px
;
position
:
relative
;
position
:
relative
;
width
:
32
PX
;
width
:
64px
;
height
:
32
PX
;
height
:
64px
;
text-align
:
center
;
text-align
:
center
;
&
:
:
after
{
&
:
:
after
{
...
@@ -55,18 +67,18 @@
...
@@ -55,18 +67,18 @@
position
:
absolute
;
position
:
absolute
;
right
:
0
;
right
:
0
;
top
:
50%
;
top
:
50%
;
width
:
1
PX
;
width
:
2px
;
height
:
14
PX
;
height
:
28px
;
background
:
rgba
(
70
,
81
,
100
,
0
.3
);
background
:
rgba
(
70
,
81
,
100
,
0
.3
);
border-radius
:
2px
;
border-radius
:
2px
;
margin-top
:
-
7
PX
;
margin-top
:
-
14px
;
}
}
}
}
.option_content
{
.option_content
{
padding
:
8
PX
14
PX
8
PX
12
PX
;
padding
:
16px
28px
16px
24px
;
font-size
:
18
PX
;
font-size
:
36px
;
font-weight
:
500
;
font-weight
:
500
;
color
:
#465164
;
color
:
#465164
;
line-height
:
25
PX
;
line-height
:
50px
;
}
}
src/pages/game/play/components/question/question-vertical-division.module.scss
View file @
b5ddd076
...
@@ -2,67 +2,66 @@
...
@@ -2,67 +2,66 @@
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
align-items
:
center
;
align-items
:
center
;
padding-top
:
32
PX
;
padding-top
:
64px
;
padding-right
:
30
PX
;
padding-right
:
60px
;
}
}
.top
{
.top
{
display
:
flex
;
display
:
flex
;
justify-content
:
flex-end
;
justify-content
:
flex-end
;
padding-right
:
15
PX
;
padding-right
:
30px
;
padding-bottom
:
6
PX
;
padding-bottom
:
12px
;
width
:
228
PX
;
width
:
465px
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
}
}
.center
{
.center
{
font-size
:
40
PX
;
font-size
:
80px
;
font-weight
:
500
;
font-weight
:
500
;
color
:
#465164
;
color
:
#465164
;
line-height
:
49
PX
;
line-height
:
98px
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
}
}
.divisor
{
.divisor
{
width
:
172
PX
;
width
:
344px
;
height
:
72
PX
;
height
:
144px
;
background-image
:
url(../../assets/vertical-division.png)
;
background-image
:
url(../../assets/vertical-division.png)
;
background-size
:
100%
100%
;
background-size
:
100%
100%
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
justify-content
:
space-between
;
justify-content
:
space-between
;
padding
:
0
20
PX
0
30
PX
;
padding
:
0
40px
0
60px
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
}
}
.num_item
{
.num_item
{
width
:
56
PX
;
width
:
112px
;
height
:
56
PX
;
height
:
112px
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
justify-content
:
center
;
}
}
.dividor
{
.dividor
{
width
:
56
PX
;
width
:
112px
;
height
:
56
PX
;
height
:
112px
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
justify-content
:
center
;
}
}
.bottom
{
.bottom
{
width
:
162
PX
;
width
:
324px
;
display
:
flex
;
display
:
flex
;
justify-content
:
flex-end
;
justify-content
:
flex-end
;
margin-left
:
66
PX
;
margin-left
:
132px
;
padding
:
0
20
PX
12
PX
20
PX
;
padding
:
0
30px
24px
40px
;
margin-right
:
-10
PX
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
position
:
relative
;
position
:
relative
;
&
:
:
after
{
&
:
:
after
{
height
:
4
PX
;
height
:
8px
;
background
:
rgba
(
23
,
134
,
247
,
0
.9
);
background
:
rgba
(
23
,
134
,
247
,
0
.9
);
border-radius
:
2
PX
;
border-radius
:
4px
;
content
:
" "
;
content
:
" "
;
position
:
absolute
;
position
:
absolute
;
bottom
:
0
;
bottom
:
0
;
...
@@ -74,8 +73,8 @@
...
@@ -74,8 +73,8 @@
.footer
{
.footer
{
display
:
flex
;
display
:
flex
;
justify-content
:
flex-end
;
justify-content
:
flex-end
;
width
:
228
PX
;
width
:
456px
;
padding-right
:
15
PX
;
padding-right
:
30px
;
padding-top
:
6
PX
;
padding-top
:
12px
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
}
}
src/pages/game/play/components/question/rich-text.module.scss
View file @
b5ddd076
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
}
}
.plain
{
.plain
{
line-height
:
30px
;
vertical-align
:
middle
;
}
}
.table
{
.table
{
...
...
src/pages/game/play/index.config.ts
View file @
b5ddd076
export
default
definePageConfig
({
export
default
definePageConfig
({
navigationBarTitleText
:
'pk-math'
,
navigationBarTitleText
:
'pk-math'
,
navigationStyle
:
'custom'
,
navigationStyle
:
'custom'
,
renderer
:
'skyline'
,
//
renderer: 'skyline',
usingComponents
:
{
usingComponents
:
{
'count-up-time'
:
'../../../native-components/count-up/index'
'count-up-time'
:
'../../../native-components/count-up/index'
}
}
...
...
src/pages/game/play/model/index.ts
View file @
b5ddd076
...
@@ -37,6 +37,13 @@ const str = '<p>随着人们生活质量的提高,净水器已经慢慢走入
...
@@ -37,6 +37,13 @@ const str = '<p>随着人们生活质量的提高,净水器已经慢慢走入
const
gameModel
:
GameModel
=
{
const
gameModel
:
GameModel
=
{
questionList
:
[
questionList
:
[
{
contentText
:
'<p>下面式子最大能填几</p><p>2109>210<AnswerBlank index="0" /></p>'
,
questionType
:
'填空题'
,
answers
:
[
{
sort
:
0
,
contentText
:
'8'
},
]
},
{
{
questionItems
:
[
questionItems
:
[
{
sort
:
0
,
contentText
:
'57'
},
{
sort
:
0
,
contentText
:
'57'
},
...
@@ -146,9 +153,17 @@ const gameModel: GameModel = {
...
@@ -146,9 +153,17 @@ const gameModel: GameModel = {
}),
}),
clearUserAnswer
:
action
((
state
)
=>
{
clearUserAnswer
:
action
((
state
)
=>
{
const
currentQuestion
=
state
.
questionList
[
state
.
currentQuestionIndex
]
if
(
currentQuestion
&&
isSelectionQuestion
(
currentQuestion
))
{
currentQuestion
.
options
.
forEach
(
item
=>
{
item
.
userAnswer
=
false
})
}
else
{
state
.
questionList
[
state
.
currentQuestionIndex
]?.
answers
?.
forEach
(
item
=>
{
state
.
questionList
[
state
.
currentQuestionIndex
]?.
answers
?.
forEach
(
item
=>
{
item
.
userAnswer
=
undefined
item
.
userAnswer
=
undefined
})
})
}
state
.
currentInputIndex
=
0
}),
}),
currentQuestion
:
computed
([
currentQuestion
:
computed
([
...
...
src/pages/game/play/types.ts
View file @
b5ddd076
...
@@ -66,3 +66,20 @@ export type RandomQuestionItem = {
...
@@ -66,3 +66,20 @@ export type RandomQuestionItem = {
contentText
:
'$input'
|
`
${
number
}
`
;
contentText
:
'$input'
|
`
${
number
}
`
;
sort
:
number
;
sort
:
number
;
}
}
/**
*
*
填空: <AnswerBlank index="0" /> <AnswerBlank index="1" />...
比较: <AnswerBlank index="0" compare="1" />
=: <MathSymbol value="=" />
+:<MathSymbol value="+" />
-:<MathSymbol value="-" />
*:<MathSymbol value="*" />
/: <MathSymbol value="/" />
%: <MathSymbol value="%" />
>: <MathSymbol value=">" />
<: <MathSymbol value="<" />
比较里面的=: <MathSymbol value="=2" />
*/
src/pages/main/components/scene/round-tag.tsx
View file @
b5ddd076
import
{
Image
}
from
'@tarojs/components'
import
{
Image
}
from
'@tarojs/components'
import
{
useEffect
,
useRef
,
useMemo
}
from
'react'
import
{
useEffect
,
useRef
,
useMemo
}
from
'react'
import
assets
from
'@/assets/oss/assets-round'
import
assets
from
'@/assets/oss/assets-round'
import
{
usePageScroll
,
createIntersectionObserver
,
getCurrentInstance
,
getMenuButtonBoundingClientRect
,
IntersectionObserver
}
from
'@tarojs/taro'
import
{
usePageScroll
,
createIntersectionObserver
,
getCurrentInstance
,
getMenuButtonBoundingClientRect
,
IntersectionObserver
,
nextTick
}
from
'@tarojs/taro'
type
RoundTagProps
=
{
type
RoundTagProps
=
{
url
?:
string
;
url
?:
string
;
...
@@ -24,6 +24,7 @@ const RoundTag = (props: RoundTagProps) => {
...
@@ -24,6 +24,7 @@ const RoundTag = (props: RoundTagProps) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
let
observer
:
IntersectionObserver
|
null
=
null
let
observer
:
IntersectionObserver
|
null
=
null
const
fn
=
()
=>
{
if
(
ready
)
{
if
(
ready
)
{
const
navVal
=
nav
.
current
const
navVal
=
nav
.
current
// @ts-ignore
// @ts-ignore
...
@@ -56,7 +57,7 @@ const RoundTag = (props: RoundTagProps) => {
...
@@ -56,7 +57,7 @@ const RoundTag = (props: RoundTagProps) => {
{
opacity
:
1
,
translateY
:
-
20
,
scale
:
[
1.5
,
1.5
],
offset
:
0.5
},
{
opacity
:
1
,
translateY
:
-
20
,
scale
:
[
1.5
,
1.5
],
offset
:
0.5
},
{
opacity
:
1
,
translateY
:
-
20
,
scale
:
[
1.5
,
1.5
],
offset
:
0.75
},
{
opacity
:
1
,
translateY
:
-
20
,
scale
:
[
1.5
,
1.5
],
offset
:
0.75
},
{
opacity
:
1
,
translateY
:
0
,
scale
:
[
1
,
1
]
},
{
opacity
:
1
,
translateY
:
0
,
scale
:
[
1
,
1
]
},
],
6
00
,
animateBg
)
],
10
00
,
animateBg
)
},
500
)
},
500
)
}
}
})
})
...
@@ -77,6 +78,9 @@ const RoundTag = (props: RoundTagProps) => {
...
@@ -77,6 +78,9 @@ const RoundTag = (props: RoundTagProps) => {
})
})
}
}
}
}
}
nextTick
(
fn
)
return
()
=>
{
return
()
=>
{
if
(
observer
)
{
if
(
observer
)
{
...
...
src/pages/main/components/scene/round.tsx
View file @
b5ddd076
...
@@ -2,6 +2,7 @@ import { View, Image } from '@tarojs/components'
...
@@ -2,6 +2,7 @@ import { View, Image } from '@tarojs/components'
import
assets
from
'@/assets/oss/assets-round'
import
assets
from
'@/assets/oss/assets-round'
import
classNames
from
'classnames'
import
classNames
from
'classnames'
import
{
cs
}
from
'@/styles'
import
{
cs
}
from
'@/styles'
import
{
navigateTo
}
from
'@tarojs/taro'
import
{
RoundState
,
type
Round
,
RoundType
,
type
ImageSource
,
RoundScore
,
CurrentRoundId
,
SceneContext
}
from
'./constants'
import
{
RoundState
,
type
Round
,
RoundType
,
type
ImageSource
,
RoundScore
,
CurrentRoundId
,
SceneContext
}
from
'./constants'
import
RoundTag
from
'./round-tag'
import
RoundTag
from
'./round-tag'
...
@@ -141,7 +142,12 @@ const RoundComp = (props: RoundProps) => {
...
@@ -141,7 +142,12 @@ const RoundComp = (props: RoundProps) => {
return
(
return
(
<
SceneContext
.
Consumer
>
<
SceneContext
.
Consumer
>
{
({
ready
})
=>
(
{
({
ready
})
=>
(
<
View
className=
{
classNames
(
props
.
className
,
cs
.
bounce_btn
)
}
hoverClass=
{
cs
.
bounce_btn_hover
}
id=
{
round
.
state
===
RoundState
.
UnLocked
?
CurrentRoundId
:
undefined
}
>
<
View
className=
{
classNames
(
props
.
className
,
cs
.
bounce_btn
)
}
hoverClass=
{
cs
.
bounce_btn_hover
}
id=
{
round
.
state
===
RoundState
.
UnLocked
?
CurrentRoundId
:
undefined
}
onClick=
{
()
=>
navigateTo
({
url
:
'/pages/game/play/index'
})
}
>
{
renderRound
(
ready
)
}
{
renderRound
(
ready
)
}
<
View
className=
{
styles
.
roundName
}
>
{
round
.
name
}
</
View
>
<
View
className=
{
styles
.
roundName
}
>
{
round
.
name
}
</
View
>
</
View
>
</
View
>
...
...
src/pages/main/main.module.scss
View file @
b5ddd076
.viewport
{
min-height
:
100vh
;
}
.body
{
.body
{
position
:
relative
;
position
:
relative
;
...
...
src/pages/main/main.tsx
View file @
b5ddd076
...
@@ -37,19 +37,19 @@ const MainPage = () => {
...
@@ -37,19 +37,19 @@ const MainPage = () => {
},
[
scrollToCurrent
])
},
[
scrollToCurrent
])
return
(
return
(
<
View
className=
{
styles
.
viewport
}
>
<>
<
MainHeader
/>
<
MainHeader
/>
<
View
className=
{
styles
.
body
}
style=
{
{
paddingTop
:
`${nav.height + nav.top + 5}px`
}
}
>
<
View
className=
{
styles
.
body
}
style=
{
{
paddingTop
:
`${nav.height + nav.top + 5}px`
}
}
>
<
MainChapter
/>
<
MainChapter
/>
<
SceneContext
.
Provider
value=
{
{
ready
:
isReady
}
}
>
<
SceneContext
.
Provider
value=
{
{
ready
:
isReady
}
}
>
<
MainScene
/>
<
MainScene
/>
</
SceneContext
.
Provider
>
</
SceneContext
.
Provider
>
{
/* <View className={styles.gap}></View> */
}
<
View
className=
{
styles
.
gap
}
></
View
>
</
View
>
</
View
>
{
isReady
&&
(
{
isReady
&&
(
<
MainShortCut
onClick=
{
()
=>
scrollToCurrent
()
}
/>
<
MainShortCut
onClick=
{
()
=>
scrollToCurrent
()
}
/>
)
}
)
}
</
View
>
</>
)
)
}
}
...
...
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