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