Commit 3b38178b by zhanghaozhe

周年庆

parent d48ceb19
......@@ -6,63 +6,66 @@ import { Link } from "react-router-dom";
class Index extends Component {
container = null
swiper = null
container = null
swiper = null
componentDidMount() {
this.swiper = new Swiper('.swiper-container', {
direction: 'horizontal',
loop: true,
spaceBetween: 12,
centeredSlides: true,
slidesPerView: 'auto',
loopedSlides: 3,
autoplay: true
})
componentDidMount() {
if (this.props.bannerList.length > 1) {
this.swiper = new Swiper('.swiper-container', {
direction: 'horizontal',
loop: true,
spaceBetween: 12,
centeredSlides: true,
slidesPerView: 'auto',
loopedSlides: 3,
autoplay: true,
})
}
}
componentWillUnmount() {
this.swiper.destroy()
}
componentWillUnmount() {
this.swiper.destroy()
}
render() {
const {bannerList} = this.props
return (
<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>
);
}
render() {
const {bannerList} = this.props
return (
<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>
);
}
}
export default Index;
\ No newline at end of file
......@@ -1002,7 +1002,7 @@ class Anniversary2020 extends Component {
</table>
}
{
!!_rankList.length && !isShowAllRankList && <div className="btn">
!!_rankList.length && _rankList.length === 10 && !isShowAllRankList && <div className="btn">
<button onClick={() => {
this.setState({
isShowAllRankList: true,
......
......@@ -123,11 +123,16 @@
ul {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
li {
width: 160px;
height: 115px;
&:nth-child(odd){
margin-bottom: 20px;
}
}
img {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment