Commit ebedbcdd by xuzhenghua

精品课程模块儿区分app

parent 6b1d735a
import React, { Component } from 'react'; import React, { Component } from 'react';
import classnames from 'classnames'; import classnames from 'classnames';
import { Link } from "react-router-dom"; import { http , getParam, SendMessageToApp} from '@/utils';
import { http } from '@/utils';
import { Toast } from "antd-mobile"; import { Toast } from "antd-mobile";
import ListFrame from './../listFrame/index'; import ListFrame from './../listFrame/index';
import CourseItem from './../courseItem/index'; import CourseItem from './../courseItem/index';
...@@ -257,6 +256,29 @@ class CourseList extends Component { ...@@ -257,6 +256,29 @@ class CourseList extends Component {
}); });
} }
toQQque=()=>{
if (!getParam('version')) {
location.href='https://q.url.cn/AB8aue?_type=wpa&qidian=true'
} else {
SendMessageToApp("toQQ", 'https://q.url.cn/AB8aue?_type=wpa&qidian=true')
}
}
// 去课程详情页
toCourse = (courseId) => {
const {history} = this.props;
if (!getParam('version')) {
history.push(`/detail?id=${courseId}`)
} else {
let data = {
courseId: courseId,
type: 0 // 正常跳课程详情页type:0,积福气浏览课程详情页-没有浏览过type:1 已浏览过type:2
}
SendMessageToApp("toCourse", data);
}
}
render() { render() {
const { isFormal } = this.props; const { isFormal } = this.props;
const { basic, advanced, higher, expand, group, training } = this.state; const { basic, advanced, higher, expand, group, training } = this.state;
...@@ -272,7 +294,7 @@ class CourseList extends Component { ...@@ -272,7 +294,7 @@ class CourseList extends Component {
group.course.map(item => ( group.course.map(item => (
<CourseItem image={item.image_name} key={item.course_id}> <CourseItem image={item.image_name} key={item.course_id}>
<div className="coupon-course__footer"> <div className="coupon-course__footer">
<a href="https://q.url.cn/AB8aue?_type=wpa&qidian=true" className="course-button">立抢超低团购价</a> <a onClick={() => this.toQQque()} className="course-button">立抢超低团购价</a>
</div> </div>
</CourseItem> </CourseItem>
)) ))
...@@ -299,7 +321,7 @@ class CourseList extends Component { ...@@ -299,7 +321,7 @@ class CourseList extends Component {
<div className="coupon-course__footer"> <div className="coupon-course__footer">
{ {
item.course_status === 1 && item.course_status === 1 &&
<a <a
className={classnames("coupon-course__button", "coupon-course__button--receive")} className={classnames("coupon-course__button", "coupon-course__button--receive")}
onClick={() => this.toReceiveCoupon(item.course_id, 'training')} onClick={() => this.toReceiveCoupon(item.course_id, 'training')}
> >
...@@ -310,7 +332,7 @@ class CourseList extends Component { ...@@ -310,7 +332,7 @@ class CourseList extends Component {
<span className="coupon-course__button-label">立即领券</span> <span className="coupon-course__button-label">立即领券</span>
</a> </a>
} }
{ {
(isFormal === 0 && item.course_status === 2) && (isFormal === 0 && item.course_status === 2) &&
<a className="coupon-course__button"> <a className="coupon-course__button">
...@@ -323,21 +345,22 @@ class CourseList extends Component { ...@@ -323,21 +345,22 @@ class CourseList extends Component {
} }
{ {
(isFormal === 1 && item.course_status === 2) && (isFormal === 1 && item.course_status === 2) &&
<Link to={`/detail?id=${item.course_id}`} className="coupon-course__button"> <a
onClick={() => this.toCourse(item.course_id)}
className="coupon-course__button">
<span className="coupon-course__button-price"> <span className="coupon-course__button-price">
<em>¥{item.coupon}</em> <em>¥{item.coupon}</em>
<i>代金券</i> <i>代金券</i>
</span> </span>
<span className="coupon-course__button-label">开始使用</span> <span className="coupon-course__button-label">开始使用</span>
</Link> </a>
} }
{ {
item.course_status === 3 && item.course_status === 3 &&
<Link <a onClick={() => this.toCourse(item.course_id)}
to={`/detail?id=${item.course_id}`} className="course-button"
className="course-button"
data-type="study" data-type="study"
>开始学习</Link> >开始学习</a>
} }
</div> </div>
</CourseItem> </CourseItem>
...@@ -368,7 +391,7 @@ class CourseList extends Component { ...@@ -368,7 +391,7 @@ class CourseList extends Component {
<div className="coupon-course__footer"> <div className="coupon-course__footer">
{ {
item.course_status === 1 && item.course_status === 1 &&
<a <a
className={classnames("coupon-course__button", "coupon-course__button--receive")} className={classnames("coupon-course__button", "coupon-course__button--receive")}
onClick={() => this.toReceiveCoupon(item.course_id, 'basic')} onClick={() => this.toReceiveCoupon(item.course_id, 'basic')}
> >
...@@ -379,7 +402,7 @@ class CourseList extends Component { ...@@ -379,7 +402,7 @@ class CourseList extends Component {
<span className="coupon-course__button-label">立即领券</span> <span className="coupon-course__button-label">立即领券</span>
</a> </a>
} }
{ {
(isFormal === 0 && item.course_status === 2) && (isFormal === 0 && item.course_status === 2) &&
<a className="coupon-course__button"> <a className="coupon-course__button">
...@@ -392,21 +415,20 @@ class CourseList extends Component { ...@@ -392,21 +415,20 @@ class CourseList extends Component {
} }
{ {
(isFormal === 1 && item.course_status === 2) && (isFormal === 1 && item.course_status === 2) &&
<Link to={`/detail?id=${item.course_id}`} className="coupon-course__button"> <a onClick={() => this.toCourse(item.course_id)} className="coupon-course__button">
<span className="coupon-course__button-price"> <span className="coupon-course__button-price">
<em>¥{item.coupon}</em> <em>¥{item.coupon}</em>
<i>代金券</i> <i>代金券</i>
</span> </span>
<span className="coupon-course__button-label">开始使用</span> <span className="coupon-course__button-label">开始使用</span>
</Link> </a>
} }
{ {
item.course_status === 3 && item.course_status === 3 &&
<Link <a onClick={() => this.toCourse(item.course_id)}
to={`/detail?id=${item.course_id}`} className="course-button"
className="course-button"
data-type="study" data-type="study"
>开始学习</Link> >开始学习</a>
} }
</div> </div>
} }
...@@ -415,11 +437,11 @@ class CourseList extends Component { ...@@ -415,11 +437,11 @@ class CourseList extends Component {
<div className="cent-course__footer"> <div className="cent-course__footer">
{ {
item.course_status === 1 && item.course_status === 1 &&
<Link to={`/detail?id=${item.course_id}`} className="course-button">1分钱开团</Link> <a onClick={() => this.toCourse(item.course_id)} className="course-button">1分钱开团</a>
} }
{ {
item.course_status === 3 && item.course_status === 3 &&
<Link to={`/detail?id=${item.course_id}`} className="course-button" data-type="study">开始学习</Link> <a onClick={() => this.toCourse(item.course_id)} className="course-button" data-type="study">开始学习</a>
} }
</div> </div>
} }
...@@ -450,7 +472,7 @@ class CourseList extends Component { ...@@ -450,7 +472,7 @@ class CourseList extends Component {
<div className="coupon-course__footer"> <div className="coupon-course__footer">
{ {
item.course_status === 1 && item.course_status === 1 &&
<a <a
className={classnames("coupon-course__button", "coupon-course__button--receive")} className={classnames("coupon-course__button", "coupon-course__button--receive")}
onClick={() => this.toReceiveCoupon(item.course_id, 'advanced')} onClick={() => this.toReceiveCoupon(item.course_id, 'advanced')}
> >
...@@ -473,21 +495,20 @@ class CourseList extends Component { ...@@ -473,21 +495,20 @@ class CourseList extends Component {
} }
{ {
(isFormal === 1 && item.course_status === 2) && (isFormal === 1 && item.course_status === 2) &&
<Link to={`/detail?id=${item.course_id}`} className="coupon-course__button"> <a onClick={() => this.toCourse(item.course_id)} className="coupon-course__button">
<span className="coupon-course__button-price"> <span className="coupon-course__button-price">
<em>¥{item.coupon}</em> <em>¥{item.coupon}</em>
<i>代金券</i> <i>代金券</i>
</span> </span>
<span className="coupon-course__button-label">开始使用</span> <span className="coupon-course__button-label">开始使用</span>
</Link> </a>
} }
{ {
item.course_status === 3 && item.course_status === 3 &&
<Link <a onClick={() => this.toCourse(item.course_id)}
to={`/detail?id=${item.course_id}`} className="course-button"
className="course-button"
data-type="study" data-type="study"
>开始学习</Link> >开始学习</a>
} }
</div> </div>
} }
...@@ -496,11 +517,11 @@ class CourseList extends Component { ...@@ -496,11 +517,11 @@ class CourseList extends Component {
<div className="cent-course__footer"> <div className="cent-course__footer">
{ {
item.course_status === 1 && item.course_status === 1 &&
<Link to={`/detail?id=${item.course_id}`} className="course-button">1分钱开团</Link> <a onClick={() => this.toCourse(item.course_id)} className="course-button">1分钱开团</a>
} }
{ {
item.course_status === 3 && item.course_status === 3 &&
<Link to={`/detail?id=${item.course_id}`} className="course-button" data-type="study">开始学习</Link> <a onClick={() => this.toCourse(item.course_id)} className="course-button" data-type="study">开始学习</a>
} }
</div> </div>
} }
...@@ -531,7 +552,7 @@ class CourseList extends Component { ...@@ -531,7 +552,7 @@ class CourseList extends Component {
<div className="coupon-course__footer"> <div className="coupon-course__footer">
{ {
item.course_status === 1 && item.course_status === 1 &&
<a <a
className={classnames("coupon-course__button", "coupon-course__button--receive")} className={classnames("coupon-course__button", "coupon-course__button--receive")}
onClick={() => this.toReceiveCoupon(item.course_id, 'higher')} onClick={() => this.toReceiveCoupon(item.course_id, 'higher')}
> >
...@@ -554,21 +575,20 @@ class CourseList extends Component { ...@@ -554,21 +575,20 @@ class CourseList extends Component {
} }
{ {
(isFormal === 1 && item.course_status === 2) && (isFormal === 1 && item.course_status === 2) &&
<Link to={`/detail?id=${item.course_id}`} className="coupon-course__button"> <a onClick={() => this.toCourse(item.course_id)} className="coupon-course__button">
<span className="coupon-course__button-price"> <span className="coupon-course__button-price">
<em>¥{item.coupon}</em> <em>¥{item.coupon}</em>
<i>代金券</i> <i>代金券</i>
</span> </span>
<span className="coupon-course__button-label">开始使用</span> <span className="coupon-course__button-label">开始使用</span>
</Link> </a>
} }
{ {
item.course_status === 3 && item.course_status === 3 &&
<Link <a onClick={() => this.toCourse(item.course_id)}
to={`/detail?id=${item.course_id}`} className="course-button"
className="course-button"
data-type="study" data-type="study"
>开始学习</Link> >开始学习</a>
} }
</div> </div>
} }
...@@ -577,11 +597,11 @@ class CourseList extends Component { ...@@ -577,11 +597,11 @@ class CourseList extends Component {
<div className="cent-course__footer"> <div className="cent-course__footer">
{ {
item.course_status === 1 && item.course_status === 1 &&
<Link to={`/detail?id=${item.course_id}`} className="course-button">1分钱开团</Link> <a onClick={() => this.toCourse(item.course_id)} className="course-button">1分钱开团</a>
} }
{ {
item.course_status === 3 && item.course_status === 3 &&
<Link to={`/detail?id=${item.course_id}`} className="course-button" data-type="study">开始学习</Link> <a onClick={() => this.toCourse(item.course_id)} className="course-button" data-type="study">开始学习</a>
} }
</div> </div>
} }
...@@ -612,7 +632,7 @@ class CourseList extends Component { ...@@ -612,7 +632,7 @@ class CourseList extends Component {
<div className="coupon-course__footer"> <div className="coupon-course__footer">
{ {
item.course_status === 1 && item.course_status === 1 &&
<a <a
className={classnames("coupon-course__button", "coupon-course__button--receive")} className={classnames("coupon-course__button", "coupon-course__button--receive")}
onClick={() => this.toReceiveCoupon(item.course_id, 'expand')} onClick={() => this.toReceiveCoupon(item.course_id, 'expand')}
> >
...@@ -623,7 +643,7 @@ class CourseList extends Component { ...@@ -623,7 +643,7 @@ class CourseList extends Component {
<span className="coupon-course__button-label">立即领券</span> <span className="coupon-course__button-label">立即领券</span>
</a> </a>
} }
{ {
(isFormal === 0 && item.course_status === 2) && (isFormal === 0 && item.course_status === 2) &&
<a className="coupon-course__button"> <a className="coupon-course__button">
...@@ -636,21 +656,20 @@ class CourseList extends Component { ...@@ -636,21 +656,20 @@ class CourseList extends Component {
} }
{ {
(isFormal === 1 && item.course_status === 2) && (isFormal === 1 && item.course_status === 2) &&
<Link to={`/detail?id=${item.course_id}`} className="coupon-course__button"> <a onClick={() => this.toCourse(item.course_id)} className="coupon-course__button">
<span className="coupon-course__button-price"> <span className="coupon-course__button-price">
<em>¥{item.coupon}</em> <em>¥{item.coupon}</em>
<i>代金券</i> <i>代金券</i>
</span> </span>
<span className="coupon-course__button-label">开始使用</span> <span className="coupon-course__button-label">开始使用</span>
</Link> </a>
} }
{ {
item.course_status === 3 && item.course_status === 3 &&
<Link <a onClick={() => this.toCourse(item.course_id)}
to={`/detail?id=${item.course_id}`} className="course-button"
className="course-button"
data-type="study" data-type="study"
>开始学习</Link> >开始学习</a>
} }
</div> </div>
} }
...@@ -659,11 +678,11 @@ class CourseList extends Component { ...@@ -659,11 +678,11 @@ class CourseList extends Component {
<div className="cent-course__footer"> <div className="cent-course__footer">
{ {
item.course_status === 1 && item.course_status === 1 &&
<Link to={`/detail?id=${item.course_id}`} className="course-button">1分钱开团</Link> <a onClick={() => this.toCourse(item.course_id)} className="course-button">1分钱开团</a>
} }
{ {
item.course_status === 3 && item.course_status === 3 &&
<Link to={`/detail?id=${item.course_id}`} className="course-button" data-type="study">开始学习</Link> <a onClick={() => this.toCourse(item.course_id)} className="course-button" data-type="study">开始学习</a>
} }
</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