Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
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
baiguangyao
mr-julyedu
Commits
10a9fc8c
Commit
10a9fc8c
authored
Sep 12, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
index-banner-swiper
parent
48a42e0b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
40 deletions
+55
-40
src/components/Index/TopSwiper/index.js
+40
-19
src/components/Index/TopSwiper/index.scss
+12
-18
src/components/Index/index.js
+3
-3
No files found.
src/components/Index/TopSwiper/index.js
View file @
10a9fc8c
...
...
@@ -2,14 +2,14 @@ import React, { Component } from 'react';
import
Swiper
from
'swiper'
import
'./index.scss'
import
'swiper/dist/css/swiper.min.css'
import
{
Link
}
from
"react-router-dom"
;
class
Index
extends
Component
{
container
=
null
swiper
swiper
=
null
componentDidMount
()
{
const
{
bannerList
}
=
this
.
props
const
_this
=
this
this
.
swiper
=
new
Swiper
(
'.swiper-container'
,
{
direction
:
'horizontal'
,
loop
:
true
,
...
...
@@ -17,28 +17,49 @@ class Index extends Component {
centeredSlides
:
true
,
slidesPerView
:
'auto'
,
loopedSlides
:
2
,
on
:
{
sliderMove
()
{
}
}
autoplay
:
true
})
}
componentWillUnmount
()
{
this
.
swiper
.
destroy
()
}
render
()
{
const
{
bannerList
}
=
this
.
props
return
(
<
div
className
=
{
'swiper-container'
}
ref
=
{
el
=>
this
.
container
=
el
}
>
<
ul
className
=
"swiper-wrapper"
>
{
bannerList
.
length
&&
bannerList
.
map
((
item
,
index
)
=>
{
return
(
<
li
className
=
{
'swiper-slide'
}
key
=
{
index
}
>
<
img
src
=
{
item
.
name
}
alt
=
""
/>
<
/li
>
)
})}
<
/ul
>
<
div
className
=
{
'index-banner-swiper'
}
>
<
div
className
=
{
'swiper-container'
}
ref
=
{
el
=>
this
.
container
=
el
}
>
<
ul
className
=
"swiper-wrapper"
>
{
bannerList
&&
bannerList
.
length
>
0
&&
bannerList
.
map
((
item
,
index
)
=>
{
return
(
<
li
className
=
{
'swiper-slide'
}
key
=
{
index
}
>
{
Number
.
isNaN
(
parseInt
(
item
.
jump_url
))
?
<
a
href
=
{
item
.
jump_url
}
key
=
{
index
}
>
<
img
className
=
"item"
src
=
{
item
.
name
}
alt
=
""
/>
<
/a>
:
<
Link
to
=
{{
pathname
:
'/detail'
,
search
:
`?id=
${
item
.
jump_url
}
`
}}
key
=
{
index
}
>
<
img
className
=
"item"
src
=
{
item
.
name
}
alt
=
""
/>
<
/Link
>
}
<
/li
>
)
})
}
<
/ul
>
<
/div
>
<
/div
>
);
}
...
...
src/components/Index/TopSwiper/index.scss
View file @
10a9fc8c
.swiper
{
&
-container
{
padding
:
0
20px
!
important
;
}
&
-slide
{
transform
:
scale3d
(
1
,
0
.9
,
1
);
img
{
width
:
100%
!
important
;
height
:
100%
!
important
;
.index-banner-swiper
{
.swiper
{
&
-container
{
padding
:
0
20px
!
important
;
}
&
-
activ
e
{
&
-
slid
e
{
width
:
335px
!
important
;
height
:
168px
!
important
;
transform
:
scale3d
(
1
,
1
,
1
);
transform
:
scale3d
(
1
,
0
.9
,
1
);
transition
:
transform
.4s
;
img
{
width
:
100%
!
important
;
height
:
100%
!
important
;
}
}
}
img
{
width
:
100%
;
height
:
100%
;
&
-active
{
transform
:
scale3d
(
1
,
1
,
1
);
}
}
}
}
\ No newline at end of file
src/components/Index/index.js
View file @
10a9fc8c
...
...
@@ -2,8 +2,8 @@ import React, { Component } from 'react'
import
{
Course
,
CallApp
}
from
'../../common'
import
'./index.scss'
import
{
WithTab
}
from
'@/HOCs'
import
Swiper
from
'react-mobile-swiper'
import
createStyle
from
'./createStyle'
//
import Swiper from 'react-mobile-swiper'
//
import createStyle from './createStyle'
import
LazyLoad
from
'react-lazy-load'
import
{
http
}
from
'@/utils'
import
LiveRoom
from
'./liveRoom'
...
...
@@ -13,7 +13,7 @@ import { connect } from "react-redux";
import
TopSwiper
from
'./TopSwiper'
const
animateTypes
=
Swiper
.
animateTypes
//
const animateTypes = Swiper.animateTypes
@
connect
(
state
=>
({
user
:
state
.
user
...
...
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