Commit 3b38178b by zhanghaozhe

周年庆

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