Commit 9aa5cf89 by zhanghaozhe

限时免费

parent 2fb04c06
...@@ -203,17 +203,14 @@ class Classify extends Component { ...@@ -203,17 +203,14 @@ class Classify extends Component {
<p className='contact text-overflow-2'>{item.desc}</p> <p className='contact text-overflow-2'>{item.desc}</p>
<div className='des'> <div className='des'>
{ {
!item.is_buy ?
item.is_restricted ? item.is_restricted ?
<div className="limit-free"> <LimitFree course={item}/>
<span>限时免费</span> : item.is_buy
<span>¥{item.price0}</span> ? <span className="isbuy">已购买</span>
</div>
: <p className="course-price"> : <p className="course-price">
<span className="new">¥{item.price1}</span> <span className="new">¥{item.price1}</span>
<span className="old">¥{item.price0}</span> <span className="old">¥{item.price0}</span>
</p> </p>
: <span className="isbuy">已购买</span>
} }
</div> </div>
</div> </div>
...@@ -286,4 +283,37 @@ function ClassCourse(props) { ...@@ -286,4 +283,37 @@ function ClassCourse(props) {
) )
} }
function LimitFreeStatus({course}) {
/*
* limit-free-status: 0-未领取 1-已领取 2-已过期
*
* */
switch (course.limit_free_status) {
case 0:
return <div className="limit-free">
<span>限时免费</span>
<span>¥{course.price0}</span>
</div>
case 1:
return <div>已领取</div>
case 2:
return <p className="course-price">
<span className="new">¥{course.price1}</span>
<span className="old">¥{course.price0}</span>
</p>
}
}
function LimitFree({course}) {
if (course.is_buy) {
if (course.limit_free_status === 1) {
return <div className={'isbuy'}>已领取</div>
} else {
return <div className={'isbuy'}>已购买</div>
}
} else {
return <LimitFreeStatus course={course}/>
}
}
export default Classify; export default Classify;
html,body,#root { html, body, #root {
height: 100%; height: 100%;
} }
.class-child { .class-child {
position: relative; position: relative;
height: 100%; height: 100%;
.preferential{ .preferential {
width: 100%; width: 100%;
height: 44px; height: 44px;
position: fixed; position: fixed;
...@@ -20,7 +21,7 @@ html,body,#root { ...@@ -20,7 +21,7 @@ html,body,#root {
// padding: 88px 12px 0; // padding: 88px 12px 0;
position: relative; position: relative;
.custom-render-bar{ .custom-render-bar {
position: fixed; position: fixed;
top: 43px; top: 43px;
left: 0; left: 0;
...@@ -51,6 +52,7 @@ html,body,#root { ...@@ -51,6 +52,7 @@ html,body,#root {
background-color: rgba(224, 46, 36, 0.6); background-color: rgba(224, 46, 36, 0.6);
} }
.return_cash { .return_cash {
position: absolute; position: absolute;
width: 31px; width: 31px;
...@@ -103,23 +105,19 @@ html,body,#root { ...@@ -103,23 +105,19 @@ html,body,#root {
.isbuy { .isbuy {
display: inline-block; display: inline-block;
width: 61px; color: #09f;
height: 18px; font-size: 15px;
background-color: $bg_active;
border-radius: 9px;
color: $white;
font-size: 12px;
text-align: center; text-align: center;
line-height: 18px;
} }
.limit-free{ .limit-free {
span:first-child{ span:first-child {
color: #FF2121; color: #FF2121;
font-size: 15px; font-size: 15px;
margin-right: 10px; margin-right: 10px;
} }
span:last-child{
span:last-child {
color: #999; color: #999;
font-size: 11px; font-size: 11px;
text-decoration: line-through; text-decoration: line-through;
...@@ -133,6 +131,7 @@ html,body,#root { ...@@ -133,6 +131,7 @@ html,body,#root {
display: flex; display: flex;
margin-top: 10px; margin-top: 10px;
margin-bottom: 50px; margin-bottom: 50px;
ul { ul {
width: 100%; width: 100%;
} }
...@@ -149,6 +148,7 @@ html,body,#root { ...@@ -149,6 +148,7 @@ html,body,#root {
background-color: $bg_fff; background-color: $bg_fff;
color: $color_666; color: $color_666;
} }
.am-tabs-tab-bar-wrap { .am-tabs-tab-bar-wrap {
padding-right: 20px; padding-right: 20px;
} }
...@@ -229,6 +229,7 @@ html,body,#root { ...@@ -229,6 +229,7 @@ html,body,#root {
margin-bottom: -5px; margin-bottom: -5px;
font-size: 12px; font-size: 12px;
} }
.active-label { .active-label {
display: inline-block; display: inline-block;
width: 30.5%; width: 30.5%;
...@@ -247,8 +248,9 @@ html,body,#root { ...@@ -247,8 +248,9 @@ html,body,#root {
} }
} }
} }
.am-tabs-default-bar-top .am-tabs-default-bar-tab::after { .am-tabs-default-bar-top .am-tabs-default-bar-tab::after {
background-color: $bg_fff!important; background-color: $bg_fff !important;
} }
} }
...@@ -188,7 +188,7 @@ class LimitFree extends Component { ...@@ -188,7 +188,7 @@ class LimitFree extends Component {
<span>{d}{h}{m}分后过期</span> <span>{d}{h}{m}分后过期</span>
</div> </div>
bottom = <div className={'bottom'}> bottom = <div className={'bottom'}>
<span>已领取</span> <span className={'purchased'}>已领取</span>
<StudyButton id={item.course_id}/> <StudyButton id={item.course_id}/>
</div> </div>
break break
...@@ -204,12 +204,12 @@ class LimitFree extends Component { ...@@ -204,12 +204,12 @@ class LimitFree extends Component {
</div> </div>
break break
case 3: case 3:
des = <div className={'purchased'}> des = <div className={'learner'}>
<i className='iconfont iconRectangleCopy4'/> <i className='iconfont iconRectangleCopy4'/>
<span>{item.play_times}人学习</span> <span>{item.play_times}人学习</span>
</div> </div>
bottom = <div className="bottom"> bottom = <div className="bottom">
<span>已购买</span> <span className={'purchased'}>已购买</span>
<StudyButton id={item.course_id}/> <StudyButton id={item.course_id}/>
</div> </div>
} }
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
display: none; display: none;
} }
& li:nth-last-child(1){ & li:nth-last-child(1) {
margin-right: 0; margin-right: 0;
} }
} }
...@@ -123,12 +123,27 @@ ...@@ -123,12 +123,27 @@
} }
.info { .info {
width: 50%;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
align-items: flex-start; justify-content: space-between;
flex-direction: column;
flex: auto;
font-size: 12px; font-size: 12px;
color: #999; color: #999;
.title {
width: 100%;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
font-family: "NotoSansHans-Medium", "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
}
.learner, .remain-time, {
margin-top: -30px;
}
.red { .red {
color: #FF2121; color: #FF2121;
font-size: 15px; font-size: 15px;
...@@ -169,6 +184,10 @@ ...@@ -169,6 +184,10 @@
span { span {
font-size: 12px; font-size: 12px;
} }
.purchased {
color: #09f;
}
} }
} }
......
...@@ -106,7 +106,8 @@ class Video extends Component { ...@@ -106,7 +106,8 @@ class Video extends Component {
limitFreeNoPromptChecked: false,//是否勾选"不再显示此弹框"选项 limitFreeNoPromptChecked: false,//是否勾选"不再显示此弹框"选项
showLimitFreePopup: false, showLimitFreePopup: false,
limitFreePopup: {}, limitFreePopup: {},
isShowNeverShowPopupOption: false //限时免费课程 播放结束后是否显示"不再显示此弹框"选项 isShowNeverShowPopupOption: false, //限时免费课程 播放结束后是否显示"不再显示此弹框"选项
limitFreePopupVideos: JSON.parse(localStorage.getItem('limit-free-popup-videos'))
} }
...@@ -744,8 +745,10 @@ class Video extends Component { ...@@ -744,8 +745,10 @@ class Video extends Component {
const {code, msg, data} = res.data const {code, msg, data} = res.data
if (code === 200) { if (code === 200) {
const {courseId, limitFreePopupVideos} = this.state
this.setState({ this.setState({
limitFreePopup: data limitFreePopup: data,
isShowNeverShowPopupOption: limitFreePopupVideos ? limitFreePopupVideos.includes(courseId) : false
}) })
} else { } else {
...@@ -954,6 +957,10 @@ class Video extends Component { ...@@ -954,6 +957,10 @@ class Video extends Component {
showLimitFreePopup: false, showLimitFreePopup: false,
isShowNeverShowPopupOption: true isShowNeverShowPopupOption: true
}) })
const {courseId, limitFreePopupVideos} = this.state
localStorage.setItem('limit-free-popup-videos', JSON.stringify(
limitFreePopupVideos ? [...limitFreePopupVideos, courseId] : [courseId]
))
this.checkNeverShowLimitFreePopup() this.checkNeverShowLimitFreePopup()
}}/> }}/>
</div> </div>
......
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