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
e88426fd
Commit
e88426fd
authored
Apr 19, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add guide component
parent
0ff79b1d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
7 deletions
+108
-7
project.config.json
project.config.json
+1
-1
index.module.scss
src/components/UserGuideView/index.module.scss
+21
-0
index.tsx
src/components/UserGuideView/index.tsx
+73
-0
index.ts
src/components/index.ts
+2
-1
small-part.tsx
src/pages/main/components/scene/small-part.tsx
+2
-2
stage.tsx
src/pages/main/components/scene/stage.tsx
+9
-3
No files found.
project.config.json
View file @
e88426fd
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"miniprogramRoot"
:
"dist/"
,
"miniprogramRoot"
:
"dist/"
,
"projectname"
:
"GeekLearnMathWeapp"
,
"projectname"
:
"GeekLearnMathWeapp"
,
"description"
:
""
,
"description"
:
""
,
"appid"
:
"wx
8f25def587982a19
"
,
"appid"
:
"wx
693fe3460124d84b
"
,
"setting"
:
{
"setting"
:
{
"urlCheck"
:
false
,
"urlCheck"
:
false
,
"es6"
:
false
,
"es6"
:
false
,
...
...
src/components/UserGuideView/index.module.scss
0 → 100644
View file @
e88426fd
.contentWrap
{
border-radius
:
16px
;
position
:
absolute
;
z-index
:
9999998
;
opacity
:
1
;
box-shadow
:
rgb
(
33
33
33
/
50%
)
0px
0px
0px
5000
PX
;
}
.content
{
width
:
100%
;
height
:
100%
;
}
.mask
{
position
:
fixed
;
left
:
0
;
right
:
0
;
top
:
0
;
bottom
:
0
;
z-index
:
9999997
;
}
src/components/UserGuideView/index.tsx
0 → 100644
View file @
e88426fd
import
{
View
,
type
ViewProps
,
RootPortal
}
from
'@tarojs/components'
import
{
type
PropsWithChildren
,
useState
,
useMemo
,
useRef
,
useEffect
,
type
ReactNode
}
from
'react'
import
{
createSelectorQuery
,
usePageScroll
}
from
'@tarojs/taro'
import
styles
from
'./index.module.scss'
type
UserGuideProps
=
{
onFinish
?:
()
=>
void
;
isActive
?:
boolean
;
onClickConent
?:
()
=>
void
;
verticalPadding
?:
number
;
horizonPadding
?:
number
;
guideContent
?:
ReactNode
;
}
const
UserGuideView
=
(
props
:
PropsWithChildren
<
UserGuideProps
&
ViewProps
>
)
=>
{
const
{
isActive
,
children
,
guideContent
,
verticalPadding
=
0
,
horizonPadding
=
0
,
onClickConent
,
...
rest
}
=
props
const
[
rect
,
setRect
]
=
useState
({
width
:
80
,
height
:
80
,
top
:
0
,
left
:
0
})
const
[
_isActive
,
setIsActive
]
=
useState
(
false
)
const
scrollRef
=
useRef
(
0
)
usePageScroll
(({
scrollTop
})
=>
{
scrollRef
.
current
=
scrollTop
})
useEffect
(()
=>
{
if
(
isActive
)
{
console
.
log
(
domRef
.
current
)
setTimeout
(()
=>
{
createSelectorQuery
()
.
select
(
`#
${
domRef
.
current
.
uid
}
`
)
.
boundingClientRect
().
exec
(([
_rect
])
=>
{
console
.
log
(
_rect
)
setRect
({
...
_rect
,
top
:
_rect
.
top
+
scrollRef
.
current
})
setIsActive
(
true
)
})
},
1000
)
}
else
{
setIsActive
(
false
)
}
},
[
isActive
])
const
domRef
=
useRef
<
any
>
()
const
style
=
useMemo
(()
=>
{
return
{
width
:
`
${
rect
.
width
+
horizonPadding
*
2
}
px`
,
height
:
`
${
rect
.
height
+
verticalPadding
*
2
}
px`
,
top
:
`
${
rect
.
top
-
verticalPadding
}
px`
,
left
:
`
${
rect
.
left
-
horizonPadding
}
px`
,
}
},
[
rect
,
horizonPadding
,
verticalPadding
])
return
(
<>
<
View
{
...
rest
}
ref=
{
domRef
}
>
{
children
}
</
View
>
{
_isActive
&&
(
<
RootPortal
>
<
View
className=
{
styles
.
contentWrap
}
catchMove
style=
{
style
}
>
<
View
className=
{
styles
.
content
}
onClick=
{
onClickConent
}
>
</
View
>
{
guideContent
}
</
View
>
<
View
className=
{
styles
.
mask
}
catchMove
></
View
>
</
RootPortal
>
)
}
</>
)
}
export
default
UserGuideView
src/components/index.ts
View file @
e88426fd
export
{
default
as
EyeProtectionView
}
from
'./EyeProtectionView/index'
export
{
default
as
EyeProtectionView
}
from
'./EyeProtectionView'
export
{
default
as
UserGuideView
}
from
'./UserGuideView'
src/pages/main/components/scene/small-part.tsx
View file @
e88426fd
import
LazeImage
from
'../lazy-image'
import
LazeImage
from
'../lazy-image'
import
{
type
SmallPart
,
}
from
'./constants'
import
{
type
SmallPart
,
}
from
'./constants'
import
Round
Comp
from
'./stage'
import
Stage
Comp
from
'./stage'
import
styles
from
'./small-part.module.scss'
import
styles
from
'./small-part.module.scss'
...
@@ -26,7 +26,7 @@ const SceneSmallPart = (props: SceneSmallPartProps) => {
...
@@ -26,7 +26,7 @@ const SceneSmallPart = (props: SceneSmallPartProps) => {
<
LazeImage
source=
{
part
.
bg
}
>
<
LazeImage
source=
{
part
.
bg
}
>
{
part
.
stages
.
map
((
item
,
index
)
=>
{
{
part
.
stages
.
map
((
item
,
index
)
=>
{
return
(
return
(
<
Round
Comp
stage=
{
item
}
key=
{
item
.
id
}
className=
{
getClassName
(
index
,
part
.
type
)
}
/>
<
Stage
Comp
stage=
{
item
}
key=
{
item
.
id
}
className=
{
getClassName
(
index
,
part
.
type
)
}
/>
)
)
})
}
})
}
</
LazeImage
>
</
LazeImage
>
...
...
src/pages/main/components/scene/stage.tsx
View file @
e88426fd
...
@@ -5,7 +5,7 @@ import { cs } from '@/styles'
...
@@ -5,7 +5,7 @@ import { cs } from '@/styles'
import
{
navigateTo
}
from
'@tarojs/taro'
import
{
navigateTo
}
from
'@tarojs/taro'
import
type
{
ImageSource
}
from
'@/types'
import
type
{
ImageSource
}
from
'@/types'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
useStoreActions
,
useStoreState
}
from
'@/store/hooks'
import
{
UserGuideView
}
from
'@/components'
import
{
type
Stage
,
StageType
,
StageStatus
,
StageLevel
,
CurrentRoundId
}
from
'./constants'
import
{
type
Stage
,
StageType
,
StageStatus
,
StageLevel
,
CurrentRoundId
}
from
'./constants'
import
StageTag
from
'./stage-tag'
import
StageTag
from
'./stage-tag'
...
@@ -155,15 +155,21 @@ const StageComp = (props: StageProps) => {
...
@@ -155,15 +155,21 @@ const StageComp = (props: StageProps) => {
}
}
return
(
return
(
<
View
<
UserGuide
View
className=
{
classNames
(
props
.
className
,
cs
.
bounce_btn
)
}
className=
{
classNames
(
props
.
className
,
cs
.
bounce_btn
)
}
hoverClass=
{
cs
.
bounce_btn_hover
}
hoverClass=
{
cs
.
bounce_btn_hover
}
id=
{
stage
.
status
===
StageStatus
.
CURRENT
?
CurrentRoundId
:
undefined
}
id=
{
stage
.
status
===
StageStatus
.
CURRENT
?
CurrentRoundId
:
undefined
}
onClick=
{
handleClick
}
onClick=
{
handleClick
}
isActive=
{
stage
.
status
===
StageStatus
.
CURRENT
}
verticalPadding=
{
15
}
horizonPadding=
{
15
}
guideContent=
{
(
<
View
style=
{
{
color
:
'#ffffff'
}
}
>
123123123234234234sdfsdf sdfsdfsdf sdf sdf sdf sdf sdfsd fsd
</
View
>
)
}
>
>
{
renderRound
(
isReady
)
}
{
renderRound
(
isReady
)
}
<
View
className=
{
styles
.
roundName
}
>
{
stage
.
name
}
</
View
>
<
View
className=
{
styles
.
roundName
}
>
{
stage
.
name
}
</
View
>
</
View
>
</
UserGuide
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