Commit 42528609 by wangshuo

Merge branch 'master' of gitlab.julyedu.com:baiguangyao/mr-julyedu

parents 3d54b358 ed40ea49
import React from 'react';
import React from 'react'
import './course.scss'
import {Link} from "react-router-dom";
import {Link} from "react-router-dom"
const Course = (props) => {
return (
<li className='course-item'>
<li className={`course-item ${props.className}`}>
{props.top}
<Link to={`/detail?id=${props.id}`}>
<img src={props.img} alt=""/>
<p className="course-title text-overflow-2">{props.title}</p>
<p className="course-title">{props.title}</p>
</Link>
{props.bottom}
</li>
......
......@@ -28,19 +28,16 @@ class UseCoupon extends PureComponent {
location.state && location.state.from ? history.replace(location.state.from) : history.goBack()
}
const {state} = this.props.location
if (state && state.from) {
switch (state.from) {
case '/my' :
this.getMyCoupons();
this.setState({
showUseButton: true
})
break;
default:
this.getAllCoupons();
if (state.from === '/my') {
this.getMyCoupons();
this.setState({
showUseButton: true
})
} else {
this.getAllCoupons();
}
} else {
this.getAllCoupons()
}
}
......
......@@ -29,7 +29,7 @@ class AccountLogin extends PureComponent {
render={({field}) => (
<Input
{...field}
type={'number'}
type={'text'}
placeholder={'手机/邮箱/昵称'}
wrapperClass={'tel-input'}
icon={
......
......@@ -41,7 +41,6 @@ class ForgotPassword extends Component {
values,
errors
} = this.props
console.log(this.props)
return (
<div className={'forgot-password'}>
<HeaderBar title='忘记密码'/>
......
......@@ -27,6 +27,10 @@
.course-title {
margin-top: 0;
line-height: 34px;
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.bottom {
......@@ -34,4 +38,45 @@
justify-content: space-between;
}
}
.live {
.bottom {
display: flex;
justify-content: flex-start;
color: $active;
}
}
.animation-box {
width: 14px;
height: 12px;
display: flex;
justify-content: space-between;
margin-right: 5px;
.column {
width: 2px;
height: 12px;
transform-origin: bottom center;
animation: scaleY 1.1s ease-out infinite;
background-color: $bg_active;
@for $i from 1 to 4 {
&-#{$i} {
animation-delay: $i * 0.2s;
}
}
}
}
}
@keyframes scaleY {
from {
transform: scaleY(0);
}
50% {
transform: scaleY(1);
}
to {
transform: scaleY(0);
}
}
\ No newline at end of file
import React, { PureComponent } from 'react'
import { Course, Tag } from '../../../common'
import { http, api } from '@/utils'
import { Toast } from "antd-mobile";
import classnames from 'classnames'
import './free-courses.scss'
......@@ -24,11 +26,12 @@ class FreeCourse extends PureComponent {
this.getFreeCourses()
.then(res => {
if (res.data.code == 200) {
const data = res.data
this.setState({
courses: res.data.data,
courses: data.data,
})
} else {
console.log(res.data.msg)
Toast.info(data.msg)
}
})
this.getFreeLive()
......@@ -37,6 +40,8 @@ class FreeCourse extends PureComponent {
this.setState({
live: res.data.data
})
} else {
Toast.info(res.data.msg)
}
})
}
......@@ -55,35 +60,42 @@ class FreeCourse extends PureComponent {
{
this.state.courses.map((item, index) => (
<Course
data={{
src: item.logo,
title: item.video_course_name
}}
img={item.logo}
title={item['video_course_name']}
bottom={
<Bottom audience={item.lessons} className={'tag-category'} text={item.category}/>
<Bottom audience={item['play_times']} className={'tag-category'} text={item.category}/>
}
id={item['v_course_id']}
key={index}
>
</Course>
))
}
{/*{
this.state.live.map((item,index) => (
<Course
data={{
src: item.live_img,
title: item.live_title
}}
top={
<Tag className={'tag-starting top'}>即将开始</Tag>
}
bottom={
<Bottom audience={item.lessons} className={'tag-category'} text={item.category}/>
}
key={item.live_id}
/>
))
}*/}
}
{
this.state.live.map((item, index) => {
const Bottom = (
<div className="bottom">
<div className="animation-box">
{new Array(4).fill('a').map((item, index) => {
return <i key={index} className={classnames('column', `column-${index + 1}`)}/>
})}
</div>
<div className="time">{`直播:${item['live_start_time']}`}</div>
</div>
)
return (
<Course
img={item['live_img']}
title={item['live_title']}
top={
<Tag className={'tag-starting top'}>即将开始</Tag>
}
bottom={Bottom}
key={item['live_id']}
className={'live'}
/>
)
})
}
</ul>
)
}
......
......@@ -71,8 +71,8 @@ class MyCourses extends PureComponent {
list;
handleClick = () => {
console.log(1);
handleClick = id => {
this.props.history.push(`/detail?id=${id}`)
}
addCourseClick = () => {
console.log(2);
......@@ -83,7 +83,7 @@ class MyCourses extends PureComponent {
this.props.fetchCoursesListIfNeeded();
}
componentWillUnmount(){
componentWillUnmount() {
this.props.switchTab(true);
}
......@@ -98,6 +98,9 @@ class MyCourses extends PureComponent {
if (list && list.length !== 0) {
return (
<>
<div className="my-course-uid">
{`加群请备注您的学号:${this.props.user.data.uid}`}
</div>
<InfiniteScroll
pageStart={0}
hasMore={true}
......@@ -111,7 +114,7 @@ class MyCourses extends PureComponent {
const Info = (
<div className="info">
<p className='title'>{item.course_title}</p>
<p className='contact'>QQ群:{item.course_qq || 449141326}</p>
<p className='contact'>QQ群:{item.course_qq}</p>
<Bottom item={item}/>
</div>
)
......@@ -120,7 +123,9 @@ class MyCourses extends PureComponent {
handleClick={this.handleClick}
{...item}
key={index}
info={Info}/>
info={Info}
id={item['course_id']}
/>
)
})
}
......@@ -148,13 +153,12 @@ class MyCourses extends PureComponent {
}
}
const mapStateToProps = state => ({
courseList: state.myCourses.courseList
})
const mapDispatchToProps = {
fetchCoursesListIfNeeded,
switchTab
}
export default connect(mapStateToProps, mapDispatchToProps)(MyCourses)
\ No newline at end of file
export default connect(
state => ({
courseList: state.myCourses.courseList,
user: state.user
}),
{
fetchCoursesListIfNeeded,
switchTab
})(MyCourses)
\ No newline at end of file
......@@ -29,7 +29,8 @@
margin-right: 10px;
}
}
.start-learn{
.start-learn {
display: block;
box-sizing: border-box;
align-self: flex-end;
......@@ -63,6 +64,16 @@
}
}
.my-course-uid {
width: 375px;
height: 30px;
background: $bg_FFF4CE;
line-height: 30px;
text-align: center;
font-size: 12px;
color: $color_333;
}
.empty {
height: 100%;
display: flex;
......
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