Commit ebedbcdd by xuzhenghua

精品课程模块儿区分app

parent 6b1d735a
import React, { Component } from 'react';
import classnames from 'classnames';
import { Link } from "react-router-dom";
import { http } from '@/utils';
import { http , getParam, SendMessageToApp} from '@/utils';
import { Toast } from "antd-mobile";
import ListFrame from './../listFrame/index';
import CourseItem from './../courseItem/index';
......@@ -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() {
const { isFormal } = this.props;
const { basic, advanced, higher, expand, group, training } = this.state;
......@@ -272,7 +294,7 @@ class CourseList extends Component {
group.course.map(item => (
<CourseItem image={item.image_name} key={item.course_id}>
<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>
</CourseItem>
))
......@@ -323,21 +345,22 @@ class CourseList extends Component {
}
{
(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">
<em>¥{item.coupon}</em>
<i>代金券</i>
</span>
<span className="coupon-course__button-label">开始使用</span>
</Link>
</a>
}
{
item.course_status === 3 &&
<Link
to={`/detail?id=${item.course_id}`}
<a onClick={() => this.toCourse(item.course_id)}
className="course-button"
data-type="study"
>开始学习</Link>
>开始学习</a>
}
</div>
</CourseItem>
......@@ -392,21 +415,20 @@ class CourseList extends Component {
}
{
(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">
<em>¥{item.coupon}</em>
<i>代金券</i>
</span>
<span className="coupon-course__button-label">开始使用</span>
</Link>
</a>
}
{
item.course_status === 3 &&
<Link
to={`/detail?id=${item.course_id}`}
<a onClick={() => this.toCourse(item.course_id)}
className="course-button"
data-type="study"
>开始学习</Link>
>开始学习</a>
}
</div>
}
......@@ -415,11 +437,11 @@ class CourseList extends Component {
<div className="cent-course__footer">
{
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 &&
<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>
}
......@@ -473,21 +495,20 @@ class CourseList extends Component {
}
{
(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">
<em>¥{item.coupon}</em>
<i>代金券</i>
</span>
<span className="coupon-course__button-label">开始使用</span>
</Link>
</a>
}
{
item.course_status === 3 &&
<Link
to={`/detail?id=${item.course_id}`}
<a onClick={() => this.toCourse(item.course_id)}
className="course-button"
data-type="study"
>开始学习</Link>
>开始学习</a>
}
</div>
}
......@@ -496,11 +517,11 @@ class CourseList extends Component {
<div className="cent-course__footer">
{
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 &&
<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>
}
......@@ -554,21 +575,20 @@ class CourseList extends Component {
}
{
(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">
<em>¥{item.coupon}</em>
<i>代金券</i>
</span>
<span className="coupon-course__button-label">开始使用</span>
</Link>
</a>
}
{
item.course_status === 3 &&
<Link
to={`/detail?id=${item.course_id}`}
<a onClick={() => this.toCourse(item.course_id)}
className="course-button"
data-type="study"
>开始学习</Link>
>开始学习</a>
}
</div>
}
......@@ -577,11 +597,11 @@ class CourseList extends Component {
<div className="cent-course__footer">
{
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 &&
<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>
}
......@@ -636,21 +656,20 @@ class CourseList extends Component {
}
{
(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">
<em>¥{item.coupon}</em>
<i>代金券</i>
</span>
<span className="coupon-course__button-label">开始使用</span>
</Link>
</a>
}
{
item.course_status === 3 &&
<Link
to={`/detail?id=${item.course_id}`}
<a onClick={() => this.toCourse(item.course_id)}
className="course-button"
data-type="study"
>开始学习</Link>
>开始学习</a>
}
</div>
}
......@@ -659,11 +678,11 @@ class CourseList extends Component {
<div className="cent-course__footer">
{
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 &&
<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>
}
......
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