Commit eb75aa47 by FE

course detail not use redux store about cousre info and bargin middle page style midfy

parent 1a33390c
......@@ -307,10 +307,10 @@
.bargain {
width: 165px;
height: 30px;
background: $bg_FADD29;
background: $bg_077FD0;
border-radius: 2px;
border: none;
color: $color_FF4000;
color: $white;
-webkit-appearance: none;
display: inline-block;
text-align: center;
......
......@@ -434,7 +434,7 @@ class BargainMiddlePage extends Component {
}
</ul>
</div>
<Link to={'/preferential'} className={'preferential'}>查看更多精品课程 >></Link>
<Link to={'/classify'} className={'preferential'}>查看更多精品课程 >></Link>
{/*更多好友砍价*/}
......
......@@ -22,12 +22,13 @@ class Bargain extends Component {
limitPeople: '',
status: '',
bargainCode: '',
time: ''
time: '',
barInfo: {}
}
}
componentDidMount() {
// this.getBargainInfo()
this.getBargainInfo()
}
// 获取助理好友
......@@ -57,9 +58,10 @@ class Bargain extends Component {
http.post(`${API.home}/m/bargain/courseDetail`, data).then((res) => {
if (res.data.code === 200) {
this.setState({
info: res.data.data,
limitPeople: res.data.data.limit_people,
bargainCode: res.data.data.bargain_code
barInfo: res.data.data,
// info: res.data.data,
// limitPeople: res.data.data.limit_people,
// bargainCode: res.data.data.bargain_code
})
if (res.data.data.bargain_status === 0) {
this.getBargainRankList(getParam('id'), 0)
......@@ -119,7 +121,7 @@ class Bargain extends Component {
}
// 继续砍价
continueBargain = () => {
const { barInfo = {} } = this.props;
const { barInfo = {} } = this.state;
const code = barInfo.bargain_code;
this.props.history.push(`/bargain-middle-page?id=${getParam('id')}&bargaincode=${code}&is_originator=1`)
}
......@@ -171,7 +173,7 @@ class Bargain extends Component {
}
render() {
const { list, outList, barInfo } = this.props;
const { list, outList, barInfo } = this.state;
return (
<div className={'bargain-func'}>
{/*bargain_status 砍价状态 0-砍价中,1砍价结束,待支付,2砍价过期(没有砍价记录没有砍价信息),3已购买*/}
......
......@@ -17,7 +17,7 @@ class BtnStatus extends Component {
group_status: 3,
in_cart: false,
countdown: 0,
// barInfo: ''
barInfo: {}
}
}
......@@ -39,6 +39,10 @@ class BtnStatus extends Component {
// }
componentWillReceiveProps(nextProps) {
const { data = {}} = nextProps;
if(data.is_bargain) {
this.getBargainInfo();
}
// if(nextProps.data && nextProps.data.is_bargain) {
// this.getBargainInfo()
// }
......@@ -111,7 +115,8 @@ class BtnStatus extends Component {
};
// 直接购买
tobuy = () => {
const {user, barInfo} = this.props
const {user} = this.props;
const {barInfo} = this.state;
const uid = user && user.data && user.data.uid
if (!uid) {
this.props.history.push('/passport/login')
......@@ -199,7 +204,7 @@ class BtnStatus extends Component {
parent_uid: 0 // 被助力人id 【自己本人操作传0】
}
http.post(`${API.home}/m/bargain/toBargain`, data).then((res) => {
const {data: {data, code, msg}} = res;
const {data, code, msg} = res.data;
if (code === 200) {
history.push(`/bargain-middle-page?id=${course_id}&bargaincode=${data.bargain_code}&is_originator=1`)
} else {
......@@ -230,8 +235,8 @@ class BtnStatus extends Component {
render() {
// data 课程信息;barInfo 砍价信息
const { data: info = {}, barInfo = {}, user = {} } = this.props;
const { countdown } = this.state;
const { data: info = {}, user = {} } = this.props;
const { countdown ,barInfo} = this.state;
const uid = user.data && user.data.uid;
return (
<div>
......
......@@ -36,10 +36,9 @@ class Group extends Component {
}
toPay = (pdd_order_id) => {
const courseInfo = this.props.courseInfo.courseInfo.course_info;
const {courseInfo, history} = this.props;
if (courseInfo.group_status === 3) {
this.props.history.push(`/order?id=${getParam('id')}`, {group: 1})
history.push(`/order?id=${getParam('id')}`, {group: 1});
} else {
this.setState({
isShowMore: false,
......@@ -114,8 +113,9 @@ class Group extends Component {
}
componentDidMount() {
if (this.props.courseInfo && this.props.courseInfo.courseInfo && this.props.courseInfo.courseInfo.course_info && this.props.courseInfo.courseInfo.course_info.pdd_group_info) {
let now_groupon_list = this.props.courseInfo.courseInfo.course_info.pdd_group_info.now_groupon_list;
const { courseInfo={} } = this.props;
if (courseInfo.pdd_group_info) {
let now_groupon_list = courseInfo.pdd_group_info.now_groupon_list;
if (now_groupon_list && now_groupon_list.length > 0) {
setInterval(() => {
now_groupon_list.map(item => {
......@@ -149,12 +149,16 @@ class Group extends Component {
}
render() {
const { courseInfo } = this.props;
const { alreadyIn, countdown, now_groupon_list } = this.state;
let groupInfo = '', groupon_member = '', group_status = -1, groupSuccessMbc = null;
if (this.props.courseInfo && this.props.courseInfo.courseInfo && this.props.courseInfo.courseInfo.course_info) {
groupInfo = this.props.courseInfo.courseInfo.course_info.pdd_group_info;
let groupInfo = '',
groupon_member = '',
group_status = -1,
groupSuccessMbc = null;
if (courseInfo) {
groupInfo = courseInfo.pdd_group_info;
groupon_member = groupInfo.groupon_member;
group_status = this.props.courseInfo.courseInfo.course_info.group_status;
group_status = courseInfo.group_status;
}
if (group_status === 4) {
if (groupon_member.member) {
......@@ -287,7 +291,9 @@ class Group extends Component {
}
}
export default connect(
state => ({ courseInfo: state }),
null
)(Group)
// export default connect(
// state => ({ courseInfo: state }),
// null
// )(Group)
export default Group;
......@@ -45,8 +45,8 @@ class OutLine extends Component {
{title: '大纲'}
];
let introduce = ''
if (this.props.data.course_info) {
introduce = this.props.data.course_info
if (this.props.data) {
introduce = this.props.data
}
return (
<div className='course-detail'>
......
......@@ -18,7 +18,6 @@ class ShareRank extends Component {
}
componentDidMount() {
console.log(this.props);
this.getRankList()
this.getCode()
}
......@@ -87,10 +86,11 @@ class ShareRank extends Component {
}
render() {
let info = ''
if (this.props.courseInfo && this.props.courseInfo.courseInfo && this.props.courseInfo.courseInfo.course_info) {
info = this.props.courseInfo.courseInfo.course_info
}
const { courseInfo: info = '' } = this.props;
// let info = ''
// if (this.props.courseInfo && this.props.courseInfo.courseInfo && this.props.courseInfo.courseInfo.course_info) {
// info = this.props.courseInfo.courseInfo.course_info
// }
return (
<div className='share-ranking'>
<Flex className='share-container' justify='between'>
......@@ -157,7 +157,7 @@ class ShareRank extends Component {
export default compose(
connect(
state => ({
courseInfo: state,
// courseInfo: state,
user: state.user
}),
null
......
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