Commit 98f84208 by zhanghaozhe

限时免费

parent 4ec71ac5
...@@ -8,9 +8,10 @@ import VList from '@/common/v-list-base' ...@@ -8,9 +8,10 @@ import VList from '@/common/v-list-base'
class LimitFree extends Component { class LimitFree extends Component {
nav
state = { state = {
tabs: new Array(5).fill('a').map((item, i) => ({ tabs: new Array(10).fill('a').map((item, i) => ({
title: String.fromCharCode(97 + i) title: `${i + 1}th Tab`
})), })),
courses: [ courses: [
{ {
...@@ -37,29 +38,51 @@ class LimitFree extends Component { ...@@ -37,29 +38,51 @@ class LimitFree extends Component {
price: 99, price: 99,
price1: 199, price1: 199,
}, },
] ],
navItemStyle: {}
} }
componentDidMount() { componentDidMount() {
this.initializeNav()
} }
handleClick = id => { handleClick = id => {
} }
initializeNav = () => {
const {tabs} = this.state
const navItemNum = 5
const navItemLen = tabs.length
console.log(getComputedStyle(this.nav).paddingLeft)
if(navItemLen <= navItemNum){
return
}
}
render() { render() {
const {tabs, courses} = this.state const {tabs, courses, navItemStyle} = this.state
return ( return (
<div className='limit-free'> <div className='limit-free'>
<HeaderBar arrow={true} title={'限时免费'}></HeaderBar> <HeaderBar arrow={true} title={'限时免费'}></HeaderBar>
<div className="banner"> <div className="banner">
<img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/time_limited_free/M/banner.png" alt=""/> <img src="https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/time_limited_free/M/banner.png" alt=""/>
</div> </div>
<nav> <nav ref={el => this.nav = el}>
<div className="prev-cover"></div>
<ul> <ul>
<li></li> {
tabs && !!tabs.length && tabs.map((item, index) => {
return (
<li key={index} className={index === 0 ? 'active' : ''} style={navItemStyle}>
{item.title}
</li>
)
})
}
</ul> </ul>
<div className="next-cover"></div>
</nav> </nav>
<WhiteSpace/> <WhiteSpace/>
<div className="course-list"> <div className="course-list">
...@@ -107,6 +130,7 @@ class LimitFree extends Component { ...@@ -107,6 +130,7 @@ class LimitFree extends Component {
<VList img={item.img} <VList img={item.img}
handleClick={this.handleClick} handleClick={this.handleClick}
info={info} info={info}
key={index}
/> />
) )
}) })
......
...@@ -2,11 +2,59 @@ ...@@ -2,11 +2,59 @@
background: #F9F9FB; background: #F9F9FB;
.banner { .banner {
font-size: 0;
img { img {
width: 100%; width: 100%;
} }
} }
nav {
position: relative;
display: flex;
align-items: center;
height: 39px;
padding: 0 18px;
background: #fff;
.prev-cover, .next-cover {
position: absolute;
top: 0;
width: 44px;
height: 39px;
}
.prev-cover {
left: 0;
background: linear-gradient(90deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
}
.next-cover {
right: 0;
background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
}
ul {
width: 100%;
height: 100%;
display: flex;
align-items: center;
}
li {
margin-right: 23px;
text-align: center;
height: 100%;
line-height: 39px;
&.active {
color: #09f;
border-bottom: 1px solid #09f;
}
}
}
.course-list { .course-list {
border-top: 1px solid transparent; border-top: 1px solid transparent;
padding: 0 12px; padding: 0 12px;
...@@ -14,7 +62,7 @@ ...@@ -14,7 +62,7 @@
} }
.courses li:nth-last-child(1){ .courses li:nth-last-child(1) {
margin-bottom: 0; margin-bottom: 0;
} }
...@@ -46,8 +94,6 @@ ...@@ -46,8 +94,6 @@
} }
.info { .info {
//position: relative;
//width: 100%;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-items: flex-start; align-items: flex-start;
...@@ -79,10 +125,6 @@ ...@@ -79,10 +125,6 @@
} }
.bottom { .bottom {
//position: absolute;
//left: 0;
//bottom: 0;
//width: 100%;
align-self: flex-end; align-self: flex-end;
} }
} }
......
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