Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
web2022
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Website
web2022
Commits
2133a8a8
Commit
2133a8a8
authored
Aug 03, 2022
by
mxm-web-develop
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'main' of gitlab.33.cn:Website/web2022
parents
be20a535
e1219160
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
8 deletions
+14
-8
index.tsx
src/components/Navbar/index.tsx
+1
-1
ScrollView.tsx
src/components/ScrollView.tsx
+11
-5
AppProvider.tsx
src/store/AppProvider.tsx
+2
-2
No files found.
src/components/Navbar/index.tsx
View file @
2133a8a8
...
@@ -68,7 +68,7 @@ const HoverLink = () =>{
...
@@ -68,7 +68,7 @@ const HoverLink = () =>{
export
default
function
Navbar
(
props
:
IAppProps
)
{
export
default
function
Navbar
(
props
:
IAppProps
)
{
const
{
pathname
}
=
useLocation
()
const
{
pathname
}
=
useLocation
()
const
{
data
}
=
React
.
useContext
(
AppContext
)
const
{
data
}
=
React
.
useContext
(
AppContext
)
// console.log('nav',data)
return
(
return
(
<
nav
className=
'flex min-w-[1440px] justify-between absolute px-[120px] w-full top-0 z-[99999] py-6 text-sm text-[#061E3B] font-normal '
>
<
nav
className=
'flex min-w-[1440px] justify-between absolute px-[120px] w-full top-0 z-[99999] py-6 text-sm text-[#061E3B] font-normal '
>
<
div
className=
'left '
>
<
div
className=
'left '
>
...
...
src/components/ScrollView.tsx
View file @
2133a8a8
...
@@ -76,16 +76,19 @@ const Dots = (props:DotsType)=>{
...
@@ -76,16 +76,19 @@ const Dots = (props:DotsType)=>{
export
const
ScrollView
=
(
props
:
ScrollViewType
)
=>
{
export
const
ScrollView
=
(
props
:
ScrollViewType
)
=>
{
BScroll
.
use
(
MouseWheel
);
BScroll
.
use
(
MouseWheel
);
BScroll
.
use
(
ScrollBar
);
BScroll
.
use
(
ScrollBar
);
BScroll
.
use
(
Slide
);
BScroll
.
use
(
NestedScroll
)
BScroll
.
use
(
NestedScroll
)
const
{
children
}
=
props
;
BScroll
.
use
(
Slide
);
// const location = useLocation()
const
wrapRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
wrapRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
location
=
useLocation
()
const
{
data
,
dispatch
}
=
useContext
(
AppContext
)
const
{
children
}
=
props
;
const
[
dots
,
setDots
]
=
useState
(
0
)
const
[
dots
,
setDots
]
=
useState
(
0
)
const
[
scrollObj
,
setScrollObj
]
=
useState
<
BScrollConstructor
<
{}
>>
();
const
[
scrollObj
,
setScrollObj
]
=
useState
<
BScrollConstructor
<
{}
>>
();
const
[
currentPage
,
setCurrentPage
]
=
useState
(
0
)
const
[
currentPage
,
setCurrentPage
]
=
useState
(
0
)
const
{
data
,
dispatch
}
=
useContext
(
AppContext
)
useEffect
(()
=>
{
useEffect
(()
=>
{
const
scrollEl
=
initBScroll
(
wrapRef
.
current
as
HTMLDivElement
)
const
scrollEl
=
initBScroll
(
wrapRef
.
current
as
HTMLDivElement
)
setScrollObj
(
scrollEl
)
setScrollObj
(
scrollEl
)
...
@@ -107,7 +110,10 @@ export const ScrollView = (props: ScrollViewType) => {
...
@@ -107,7 +110,10 @@ export const ScrollView = (props: ScrollViewType) => {
scrollObj
&&
scrollObj
.
on
(
'slidePageChanged'
,
(
page
:
any
)
=>
{
scrollObj
&&
scrollObj
.
on
(
'slidePageChanged'
,
(
page
:
any
)
=>
{
setCurrentPage
((
prevState
:
number
)
=>
{
setCurrentPage
((
prevState
:
number
)
=>
{
if
(
prevState
!==
page
.
pageY
){
if
(
prevState
!==
page
.
pageY
){
setTimeout
(()
=>
{
dispatch
({
type
:
'slideOnChange'
,
payload
:{
pageIndex
:
page
.
pageY
}})
dispatch
({
type
:
'slideOnChange'
,
payload
:{
pageIndex
:
page
.
pageY
}})
},
0
)
return
page
.
pageY
return
page
.
pageY
}
}
return
prevState
return
prevState
...
...
src/store/AppProvider.tsx
View file @
2133a8a8
...
@@ -32,10 +32,10 @@ const AppReducer = (state:typeof data,action:Actions)=>{
...
@@ -32,10 +32,10 @@ const AppReducer = (state:typeof data,action:Actions)=>{
state
.
currentPage
=
payload
.
currentPage
state
.
currentPage
=
payload
.
currentPage
break
;
break
;
}
}
console
.
log
(
state
);
//
console.log(state);
return
state
return
{...
state
}
}
}
export
const
AppProvider
=
(
props
:
any
)
=>
{
export
const
AppProvider
=
(
props
:
any
)
=>
{
...
...
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