Commit c6f49544 by FE

other kanjia course to detail in bargian middlle page

parent c4a7ed38
...@@ -10,8 +10,11 @@ import { differenceInSeconds, differenceInMinutes, differenceInHours, difference ...@@ -10,8 +10,11 @@ import { differenceInSeconds, differenceInMinutes, differenceInHours, difference
import Overlay from '../detail/overlay' import Overlay from '../detail/overlay'
import { compose } from "redux" import { compose } from "redux"
import { connect } from "react-redux"; import { connect } from "react-redux";
import {getCourses} from './../detail/actions';
@connect(state => ({
user: state.user
}))
class BargainMiddlePage extends Component { class BargainMiddlePage extends Component {
timer timer
...@@ -267,6 +270,14 @@ class BargainMiddlePage extends Component { ...@@ -267,6 +270,14 @@ class BargainMiddlePage extends Component {
}) })
} }
toCourseDetail = (id) => {
const { dispatch, history } = this.props;
dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`);
return false;
}));
}
render() { render() {
let thirdRow, btn let thirdRow, btn
// is_artifact 0-再邀请多少人可以使用 1-可以使用未领取 2-已领取 3-已使用 // is_artifact 0-再邀请多少人可以使用 1-可以使用未领取 2-已领取 3-已使用
...@@ -410,9 +421,12 @@ class BargainMiddlePage extends Component { ...@@ -410,9 +421,12 @@ class BargainMiddlePage extends Component {
id={item.course_id} id={item.course_id}
img={item.image_name} img={item.image_name}
title={item.course_title} title={item.course_title}
bottom={<CourseBottom toDetail={this.toCourseDetail}
bottom={
<CourseBottom
item={item} item={item}
toCart={this.toCart} toCart={this.toCart}
toDetail={this.toCourseDetail}
/> />
} }
/> />
...@@ -516,7 +530,8 @@ function CourseDes(props) { ...@@ -516,7 +530,8 @@ function CourseDes(props) {
function CourseBottom(props) { function CourseBottom(props) {
let Buttons let Buttons
if (props.item.bargain_status === 2) { if (props.item.bargain_status === 2) {
Buttons = <Link to={`/detail?id=${props.item.course_id}`} className={'bargain'}>我要砍价</Link> // Buttons = <Link to={`/detail?id=${props.item.course_id}`} className={'bargain'}>我要砍价</Link>
Buttons = <a href="javascript:;" onClick={() => props.toDetail(props.item.course_id)} className={'bargain'}>我要砍价</a>
} else if (props.item.bargain_status === 3) { } else if (props.item.bargain_status === 3) {
Buttons = <Link to={`/play?id=${props.item.course_id}`} className={'bargain'}>去学习</Link> Buttons = <Link to={`/play?id=${props.item.course_id}`} className={'bargain'}>去学习</Link>
} else { } else {
...@@ -531,7 +546,7 @@ function CourseBottom(props) { ...@@ -531,7 +546,7 @@ function CourseBottom(props) {
} }
{ {
props.item.bargain_status === 0 && props.item.bargain_status === 0 &&
<Link to={`/detail?id=${props.item.course_id}`} className={'bargain-btn'}>继续砍价</Link> <a href="javascript:;" onClick={() => props.toDetail(props.item.course_id)} className={'bargain-btn'}>我要砍价</a>
} }
...@@ -655,10 +670,4 @@ function BargainSuccess(props) { ...@@ -655,10 +670,4 @@ function BargainSuccess(props) {
} }
export default compose( export default withRouter(BargainMiddlePage);
connect(
state => ({user: state.user}),
null
),
withRouter
)(BargainMiddlePage)
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