Commit 1a33390c by FE

cancel request course detail api before get into course detail

parent 566a885d
...@@ -110,10 +110,10 @@ class Index extends Component { ...@@ -110,10 +110,10 @@ class Index extends Component {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`); history.push(`/detail?id=${id}`);
return false; return false;
})); // }));
} }
render() { render() {
......
...@@ -272,10 +272,10 @@ class BargainMiddlePage extends Component { ...@@ -272,10 +272,10 @@ class BargainMiddlePage extends Component {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`); history.push(`/detail?id=${id}`);
return false; return false;
})); // }));
} }
render() { render() {
......
...@@ -107,9 +107,9 @@ class Classify extends Component { ...@@ -107,9 +107,9 @@ class Classify extends Component {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
})); // }));
} }
render() { render() {
......
...@@ -54,10 +54,10 @@ class Classify extends Component { ...@@ -54,10 +54,10 @@ class Classify extends Component {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`); history.push(`/detail?id=${id}`);
return false; return false;
})); // }));
} }
render() { render() {
......
...@@ -149,10 +149,10 @@ class UseCoupon extends PureComponent { ...@@ -149,10 +149,10 @@ class UseCoupon extends PureComponent {
if (coupon['ctype'] === 1) { if (coupon['ctype'] === 1) {
history.push(`/classify`) history.push(`/classify`)
} else { } else {
dispatch(getCourses(coupon['limit_course'], () => { // dispatch(getCourses(coupon['limit_course'], () => {
history.push(`/detail?id=${coupon['limit_course']}`); history.push(`/detail?id=${coupon['limit_course']}`);
return false; return false;
})); // }));
} }
} else { } else {
......
...@@ -6,7 +6,6 @@ import { getCourses } from "@/components/detail/actions" ...@@ -6,7 +6,6 @@ import { getCourses } from "@/components/detail/actions"
import { connect } from "react-redux" import { connect } from "react-redux"
import './index.scss' import './index.scss'
import Overlay from '../overlay' import Overlay from '../overlay'
import axios from "axios";
class BtnStatus extends Component { class BtnStatus extends Component {
......
...@@ -35,7 +35,7 @@ class ToGroup extends Component { ...@@ -35,7 +35,7 @@ class ToGroup extends Component {
title: `【仅剩${number}个名额】我${pdd_price}元拼了《${data.course_title}》`, title: `【仅剩${number}个名额】我${pdd_price}元拼了《${data.course_title}》`,
desc: data.course_title, // 分享描述 desc: data.course_title, // 分享描述
// 直接进入课程详情页,isIn: 1 // 直接进入课程详情页,isIn: 1
link: location.origin + `/detail?id=${data.course_id}&isIn=1`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 link: location.origin + `/detail?id=${data.course_id}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: data.image_name, // 分享图标 imgUrl: data.image_name, // 分享图标
}; };
http.post(`${API['base-api']}/m/sale/signature`).then(res => { http.post(`${API['base-api']}/m/sale/signature`).then(res => {
...@@ -124,10 +124,10 @@ class ToGroup extends Component { ...@@ -124,10 +124,10 @@ class ToGroup extends Component {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`, {href: '/classify'}); history.push(`/detail?id=${id}`, {href: '/classify'});
return false; return false;
})); // }));
} }
render() { render() {
......
...@@ -17,6 +17,8 @@ import {compose, bindActionCreators} from "redux"; ...@@ -17,6 +17,8 @@ import {compose, bindActionCreators} from "redux";
class Detail extends Component { class Detail extends Component {
courseId
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
...@@ -35,10 +37,8 @@ class Detail extends Component { ...@@ -35,10 +37,8 @@ class Detail extends Component {
} }
componentDidMount() { componentDidMount() {
// 直接进入课程详情页,isIn: 1
if(getParam('isIn')) {
this.props.getCourses(); this.props.getCourses();
} this.courseId = getParam('id')
const { courseInfo } = this.props; const { courseInfo } = this.props;
if(courseInfo.course_info.is_bargain) { if(courseInfo.course_info.is_bargain) {
this.getBargainInfo(); this.getBargainInfo();
...@@ -107,7 +107,7 @@ class Detail extends Component { ...@@ -107,7 +107,7 @@ class Detail extends Component {
link: location.origin + `/detail??id=${course_id}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 link: location.origin + `/detail??id=${course_id}`, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: image_name, // 分享图标 imgUrl: image_name, // 分享图标
}; };
console.log(shareData);
http.post(`${API['base-api']}/m/sale/signature`).then(res => { http.post(`${API['base-api']}/m/sale/signature`).then(res => {
const {nonce_str, signature, timestamp} = res.data; const {nonce_str, signature, timestamp} = res.data;
wx.config({ wx.config({
...@@ -279,7 +279,7 @@ class Detail extends Component { ...@@ -279,7 +279,7 @@ class Detail extends Component {
{/*分享赚钱*/} {/*分享赚钱*/}
{ {
courseInfo.is_dist && this.courseId === courseInfo.course_id && courseInfo.is_dist &&
<ShareRank courseInfo={courseInfo}/> <ShareRank courseInfo={courseInfo}/>
} }
......
...@@ -30,10 +30,10 @@ class My extends PureComponent { ...@@ -30,10 +30,10 @@ class My extends PureComponent {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`); history.push(`/detail?id=${id}`);
return false; return false;
})); // }));
} }
render() { render() {
......
...@@ -75,10 +75,10 @@ class MyOrders extends Component { ...@@ -75,10 +75,10 @@ class MyOrders extends Component {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`); history.push(`/detail?id=${id}`);
return false; return false;
})); // }));
} }
......
...@@ -374,9 +374,9 @@ class Order extends Component { ...@@ -374,9 +374,9 @@ class Order extends Component {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
})); // }));
} }
render() { render() {
......
...@@ -80,9 +80,9 @@ class Preferential extends Component { ...@@ -80,9 +80,9 @@ class Preferential extends Component {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
})); // }));
} }
render() { render() {
......
...@@ -37,9 +37,9 @@ class Purchased extends Component { ...@@ -37,9 +37,9 @@ class Purchased extends Component {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
})); // }));
} }
......
...@@ -188,9 +188,9 @@ class _Scholarship extends Component { ...@@ -188,9 +188,9 @@ class _Scholarship extends Component {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
})); // }));
} }
render() { render() {
......
...@@ -35,9 +35,9 @@ class Recommendation extends Component { ...@@ -35,9 +35,9 @@ class Recommendation extends Component {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
})); // }));
} }
render() { render() {
......
...@@ -57,9 +57,9 @@ class SearchResult extends PureComponent { ...@@ -57,9 +57,9 @@ class SearchResult extends PureComponent {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
})); // }));
} }
render() { render() {
......
...@@ -168,9 +168,9 @@ class Cart extends Component { ...@@ -168,9 +168,9 @@ class Cart extends Component {
toCourseDetail = (id) => { toCourseDetail = (id) => {
console.log(id); console.log(id);
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
})); // }));
} }
......
...@@ -46,9 +46,9 @@ class Recommendation extends PureComponent { ...@@ -46,9 +46,9 @@ class Recommendation extends PureComponent {
toCourseDetail = (id) => { toCourseDetail = (id) => {
const { dispatch, history } = this.props; const { dispatch, history } = this.props;
dispatch(getCourses(id, () => { // dispatch(getCourses(id, () => {
history.push(`/detail?id=${id}`) history.push(`/detail?id=${id}`)
})); // }));
} }
render() { render() {
......
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