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
6676d379
Commit
6676d379
authored
Mar 30, 2023
by
hewenhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.jiuaoedu.com:hewenhao/GeekLearnMathWeapp
parents
2dfaaf17
a69d0710
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
41 additions
and
28 deletions
+41
-28
index.module.scss
src/components/Tabs/index.module.scss
+14
-10
index.tsx
src/components/Tabs/index.tsx
+22
-13
use-request.ts
src/hooks/use-request.ts
+0
-0
use-toggle.ts
src/hooks/use-toggle.ts
+0
-0
index.tsx
src/pages/prepare/components/overview/index.tsx
+1
-1
launch-quest.tsx
src/pages/prepare/components/overview/launch-quest.tsx
+1
-1
index.tsx
src/pages/prepare/components/rank-list/index.tsx
+1
-1
answer-sheet.tsx
src/pages/study-market/components/answer-sheet.tsx
+1
-1
mystery-box.tsx
src/pages/study-market/components/mystery-box.tsx
+1
-1
No files found.
src/components/Tabs/index.module.scss
View file @
6676d379
...
...
@@ -26,16 +26,20 @@
}
.tabPanes
{
display
:
flex
;
flex-direction
:
column
;
padding
:
12px
16px
;
margin-top
:
16px
;
}
position
:
relative
;
overflow
:
hidden
;
min-height
:
400px
;
/* 根据需要设置最小高度 */
.tabPane
{
display
:
none
;
&
.active
{
display
:
block
;
.tabPane
{
position
:
absolute
;
top
:
0
;
left
:
0
;
width
:
100%
;
transition
:
transform
0
.3s
ease-in-out
;
&
.active
{
display
:
block
;
}
}
}
src/components/Tabs/index.tsx
View file @
6676d379
...
...
@@ -6,25 +6,26 @@ import styles from './index.module.scss'
export
interface
TabItem
{
label
:
string
|
ReactNode
;
children
:
ReactNode
;
disabled
?:
boolean
;
hidden
?:
boolean
;
keepAlive
?:
boolean
;
children
:
ReactNode
;
}
interface
TabsProps
{
items
:
TabItem
[];
initialIndex
?:
number
;
tabBarStyle
?:
CSSProperties
;
tabBarGutter
?:
number
;
tabBarStyle
?:
CSSProperties
;
tabPanesStyle
?:
CSSProperties
;
onChange
?:
(
index
:
number
)
=>
void
;
}
const
Tabs
:
React
.
FC
<
TabsProps
>
=
({
items
,
initialIndex
=
0
,
tabBarStyle
=
{},
tabBarGutter
=
16
,
tabBarStyle
,
tabPanesStyle
,
onChange
,
})
=>
{
const
[
activeIndex
,
setActiveIndex
]
=
useState
(
initialIndex
)
...
...
@@ -36,12 +37,15 @@ const Tabs: React.FC<TabsProps> = ({
}
},
[
items
,
activeIndex
])
const
handleClick
=
useCallback
((
index
:
number
)
=>
{
if
(
!
items
[
index
].
disabled
&&
index
!==
activeIndex
)
{
setActiveIndex
(
index
)
onChange
?.(
index
)
}
},
[
items
,
activeIndex
,
onChange
])
const
handleClick
=
useCallback
(
(
index
:
number
)
=>
{
if
(
!
items
[
index
].
disabled
&&
index
!==
activeIndex
)
{
setActiveIndex
(
index
)
onChange
?.(
index
)
}
},
[
items
,
activeIndex
,
onChange
]
)
const
renderTabs
=
()
=>
{
return
items
.
map
((
tab
,
index
)
=>
{
...
...
@@ -67,7 +71,7 @@ const Tabs: React.FC<TabsProps> = ({
const
renderTabPanes
=
()
=>
{
return
items
.
map
((
tab
,
index
)
=>
{
if
(
tab
.
hidden
&&
!
tab
.
keepAlive
)
return
null
if
(
tab
.
hidden
)
return
null
const
isActive
=
activeIndex
===
index
const
isHidden
=
tab
.
hidden
||
!
isActive
...
...
@@ -76,8 +80,13 @@ const Tabs: React.FC<TabsProps> = ({
[
styles
.
active
]:
isActive
,
})
const
tabPaneStyle
=
{
transform
:
`translateX(
${(
index
-
activeIndex
)
*
100
}
%)`
,
transition
:
'transform 0.3s ease-in-out'
,
}
return
(
<
View
key=
{
index
}
className=
{
cls
}
hidden=
{
isHidden
}
>
<
View
key=
{
index
}
className=
{
cls
}
hidden=
{
isHidden
}
style=
{
tabPaneStyle
}
>
{
tab
.
children
}
</
View
>
)
...
...
@@ -89,7 +98,7 @@ const Tabs: React.FC<TabsProps> = ({
<
View
className=
{
styles
.
tabBar
}
style=
{
tabBarStyle
}
>
{
renderTabs
()
}
</
View
>
<
View
className=
{
styles
.
tabPanes
}
>
<
View
className=
{
styles
.
tabPanes
}
style=
{
tabPanesStyle
}
>
{
renderTabPanes
()
}
</
View
>
</
View
>
...
...
src/hooks/use
R
equest.ts
→
src/hooks/use
-r
equest.ts
View file @
6676d379
File moved
src/hooks/use
T
oggle.ts
→
src/hooks/use
-t
oggle.ts
View file @
6676d379
File moved
src/pages/prepare/components/overview/index.tsx
View file @
6676d379
import
{
memo
}
from
'react'
import
{
View
,
Text
}
from
'@tarojs/components'
import
Taro
from
'@tarojs/taro'
import
useRequest
from
'@/hooks/use
R
equest'
import
useRequest
from
'@/hooks/use
-r
equest'
import
TopLeftInfo
from
'./top-left-info'
import
LaunchQuest
from
'./launch-quest'
...
...
src/pages/prepare/components/overview/launch-quest.tsx
View file @
6676d379
import
React
from
'react'
import
{
View
,
Text
,
Button
}
from
'@tarojs/components'
import
Modal
from
'@/components/Modal'
import
useToggle
from
'@/hooks/use
T
oggle'
import
useToggle
from
'@/hooks/use
-t
oggle'
import
styles
from
'./index.module.scss'
...
...
src/pages/prepare/components/rank-list/index.tsx
View file @
6676d379
...
...
@@ -2,7 +2,7 @@ import { View, Button, Text, ScrollView } from '@tarojs/components'
import
{
memo
}
from
'react'
import
classNames
from
'classnames'
import
{
useStoreState
}
from
'@/store/hooks'
import
useToggle
from
'@/hooks/use
T
oggle'
import
useToggle
from
'@/hooks/use
-t
oggle'
import
UserInfo
from
'./user-info'
import
Timing
from
'./timing'
...
...
src/pages/study-market/components/answer-sheet.tsx
View file @
6676d379
import
{
View
,
Text
,
Button
}
from
'@tarojs/components'
import
Modal
from
'@/components/Modal'
import
useToggle
from
'@/hooks/use
T
oggle'
import
useToggle
from
'@/hooks/use
-t
oggle'
import
CardMain
from
'./card-main'
...
...
src/pages/study-market/components/mystery-box.tsx
View file @
6676d379
import
{
View
,
Text
,
Button
}
from
'@tarojs/components'
import
Modal
from
'@/components/Modal'
import
useToggle
from
'@/hooks/use
T
oggle'
import
useToggle
from
'@/hooks/use
-t
oggle'
import
CardMain
from
'./card-main'
...
...
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