Commit 3b38178b by zhanghaozhe

周年庆

parent d48ceb19
...@@ -10,6 +10,7 @@ class Index extends Component { ...@@ -10,6 +10,7 @@ class Index extends Component {
swiper = null swiper = null
componentDidMount() { componentDidMount() {
if (this.props.bannerList.length > 1) {
this.swiper = new Swiper('.swiper-container', { this.swiper = new Swiper('.swiper-container', {
direction: 'horizontal', direction: 'horizontal',
loop: true, loop: true,
...@@ -17,9 +18,10 @@ class Index extends Component { ...@@ -17,9 +18,10 @@ class Index extends Component {
centeredSlides: true, centeredSlides: true,
slidesPerView: 'auto', slidesPerView: 'auto',
loopedSlides: 3, loopedSlides: 3,
autoplay: true autoplay: true,
}) })
} }
}
componentWillUnmount() { componentWillUnmount() {
this.swiper.destroy() this.swiper.destroy()
...@@ -32,7 +34,8 @@ class Index extends Component { ...@@ -32,7 +34,8 @@ class Index extends Component {
<div className={'index-banner-swiper'}> <div className={'index-banner-swiper'}>
<div className={'swiper-container'} ref={el => this.container = el}> <div className={'swiper-container'} ref={el => this.container = el}>
<ul className="swiper-wrapper"> <ul className="swiper-wrapper">
{bannerList && bannerList.length > 0 && bannerList.map((item, index) => { {
bannerList && bannerList.length > 0 && bannerList.map((item, index) => {
return ( return (
<li className={'swiper-slide'} key={index}> <li className={'swiper-slide'} key={index}>
{ {
...@@ -43,7 +46,7 @@ class Index extends Component { ...@@ -43,7 +46,7 @@ class Index extends Component {
<Link <Link
to={{ to={{
pathname: '/detail', pathname: '/detail',
search: `?id=${item.jump_url}` search: `?id=${item.jump_url}`,
}} }}
key={index} key={index}
> >
......
import React, {Component} from 'react' import React, { Component } from 'react'
import {CallApp} from '../../common' import { CallApp } from '../../common'
import './index.scss' import './index.scss'
import {WithTab} from '@/HOCs' import { WithTab } from '@/HOCs'
// import Swiper from 'react-mobile-swiper' // import Swiper from 'react-mobile-swiper'
// import createStyle from './createStyle' // import createStyle from './createStyle'
import HomeCourseList from './course-list' import HomeCourseList from './course-list'
import {http, isValidUrl} from '@/utils' import { http, isValidUrl } from '@/utils'
import LiveRoom from './liveRoom' import LiveRoom from './liveRoom'
import {Link} from "react-router-dom" import { Link } from "react-router-dom"
import {Toast} from 'antd-mobile' import { Toast } from 'antd-mobile'
import {connect} from "react-redux" import { connect } from "react-redux"
import TopSwiper from './TopSwiper' import TopSwiper from './TopSwiper'
// import ExpandActiveToast from './expandActiveToast' // import ExpandActiveToast from './expandActiveToast'
import AllCourseNavigation from "./all-course" import AllCourseNavigation from "./all-course"
import {UserGift} from "@common" import { UserGift } from "@common"
// const animateTypes = Swiper.animateTypes // const animateTypes = Swiper.animateTypes
...@@ -65,22 +65,24 @@ class Index extends Component { ...@@ -65,22 +65,24 @@ class Index extends Component {
this.getIndexData() this.getIndexData()
this.userStatus() this.userStatus()
} }
componentWillMount(){
componentWillMount() {
this.showUserGiftFun() this.showUserGiftFun()
} }
userStatus =()=>{
userStatus = () => {
http.get(`${API['base-api']}/sys/user/new_user_status`).then((res) => { http.get(`${API['base-api']}/sys/user/new_user_status`).then((res) => {
const {errno, data} = res.data const {errno, data} = res.data
if (errno === 0) { if (errno === 0) {
if (data.status == 1) { if (data.status == 1) {
// 新用户登录之后判断是否是新用户 // 新用户登录之后判断是否是新用户
this.setState({ this.setState({
isShowUserGift: false isShowUserGift: false,
}) })
Toast.info('新人大礼包已领取成功!', 2) Toast.info('新人大礼包已领取成功!', 2)
} else { } else {
this.setState({ this.setState({
isShowUserGift: false isShowUserGift: false,
}) })
} }
} }
...@@ -92,23 +94,23 @@ class Index extends Component { ...@@ -92,23 +94,23 @@ class Index extends Component {
let now_time = (new Date()).valueOf() let now_time = (new Date()).valueOf()
if (!newer_last_time || now_time - newer_last_time > 86400000) { if (!newer_last_time || now_time - newer_last_time > 86400000) {
this.setState({ this.setState({
isShowUserGift: true isShowUserGift: true,
}) })
} else { } else {
this.setState({ this.setState({
isShowUserGift: false isShowUserGift: false,
}) })
} }
} }
close = () => { close = () => {
this.setState({ this.setState({
isShowUserGift: false isShowUserGift: false,
}) })
let now_time = (new Date()).valueOf() // 获取当前时间 let now_time = (new Date()).valueOf() // 获取当前时间
localStorage.setItem('newer_last_time', now_time) // 存储关闭时间 localStorage.setItem('newer_last_time', now_time) // 存储关闭时间
} }
get_newerModal = ()=>{ get_newerModal = () => {
this.close() this.close()
this.props.history.push('/passport/login') this.props.history.push('/passport/login')
} }
...@@ -120,7 +122,7 @@ class Index extends Component { ...@@ -120,7 +122,7 @@ class Index extends Component {
const {data} = res.data || {} const {data} = res.data || {}
const modules = Array.isArray(data.modules) ? data.modules : [] const modules = Array.isArray(data.modules) ? data.modules : []
this.setState({ this.setState({
banner: data.banner, banner: data.banner.slice(0, 1),
lives: data.lives, lives: data.lives,
modules, modules,
}) })
......
...@@ -1002,7 +1002,7 @@ class Anniversary2020 extends Component { ...@@ -1002,7 +1002,7 @@ class Anniversary2020 extends Component {
</table> </table>
} }
{ {
!!_rankList.length && !isShowAllRankList && <div className="btn"> !!_rankList.length && _rankList.length === 10 && !isShowAllRankList && <div className="btn">
<button onClick={() => { <button onClick={() => {
this.setState({ this.setState({
isShowAllRankList: true, isShowAllRankList: true,
......
...@@ -123,11 +123,16 @@ ...@@ -123,11 +123,16 @@
ul { ul {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-wrap: wrap;
} }
li { li {
width: 160px; width: 160px;
height: 115px; height: 115px;
&:nth-child(odd){
margin-bottom: 20px;
}
} }
img { 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