Commit b4b8d2dd by xuzhenghua

参团

parent fb270b80
...@@ -11,8 +11,8 @@ class Activity extends Component { ...@@ -11,8 +11,8 @@ class Activity extends Component {
} }
componentWillMount() { componentWillMount() {
jsCookie.set('blessing_invite_uid', getParam('shareuid')); jsCookie.set('blessing_invite_uid', getParam('shareuid'), {domain: '.julyedu.com'});
jsCookie.set('blessing_invite_code', getParam('inviteCode')); jsCookie.set('blessing_invite_code', getParam('inviteCode'), {domain: '.julyedu.com'});
} }
getGift = () => { getGift = () => {
......
...@@ -15,6 +15,7 @@ class Invite extends Component { ...@@ -15,6 +15,7 @@ class Invite extends Component {
hotValue: 0, hotValue: 0,
hot_schedule: '', hot_schedule: '',
userList: [], userList: [],
inviteCode: '',
} }
} }
...@@ -33,13 +34,16 @@ class Invite extends Component { ...@@ -33,13 +34,16 @@ class Invite extends Component {
if(!this.props.user.hasError) { if(!this.props.user.hasError) {
this.getUserList(); this.getUserList();
this.getHotValue(); this.getHotValue();
this.getInviteCode();
} }
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
console.log('componentWillReceiveProps');
if(!nextProps.user.hasError) { if(!nextProps.user.hasError) {
this.getUserList(); this.getUserList();
this.getHotValue(); this.getHotValue();
this.getInviteCode();
} }
} }
...@@ -70,8 +74,33 @@ class Invite extends Component { ...@@ -70,8 +74,33 @@ class Invite extends Component {
}); });
} }
getInviteCode = () => {
http.get(`${API.home}/sys/user/invite/link`).then(res => {
let {code, data, msg} = res.data;
if(code === 200) {
let inviteCode = data.blessing_invite_code;
if(is_weixin()) {
wxShare({
title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!',
desc: '把这门超5万人报名的【Python基础入门 升级版】课程送给你,附200元红包,请笑纳!--七月在线',
link: encodeURI(location.origin + `/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`),
imgUrl: 'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/index-share-img.png',
});
}
this.setState(()=>({
inviteCode: inviteCode
}))
}else if(code === 4030 || code === 4040) {
history.push('/passport');
}else{
Toast.info(msg, 2);
}
});
}
inviteFriends = () => { inviteFriends = () => {
const { user, history } = this.props; const { user, history } = this.props;
const {inviteCode} = this.state;
// 未登录先去登录 // 未登录先去登录
if (getParam('version')) { if (getParam('version')) {
if(user.hasError) { if(user.hasError) {
...@@ -89,33 +118,23 @@ class Invite extends Component { ...@@ -89,33 +118,23 @@ class Invite extends Component {
if(user.hasError) { if(user.hasError) {
history.push('/passport'); history.push('/passport');
}else { }else {
http.get(`${API.home}/sys/user/invite/link`).then(res => { if(is_weixin()) {
let {code, data, msg} = res.data; wxShare({
if(code === 200) { title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!',
let inviteCode = data.blessing_invite_code; desc: '把这门超5万人报名的【Python基础入门 升级版】课程送给你,附200元红包,请笑纳!--七月在线',
if(is_weixin()) { link: encodeURI(location.origin + `/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`),
wxShare({ imgUrl: 'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/index-share-img.png',
title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!', });
desc: '把这门超5万人报名的【Python基础入门 升级版】课程送给你,附200元红包,请笑纳!--七月在线', this.setState({
link: encodeURI(location.origin + `/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`), showTip: true,
imgUrl: 'https://julyedu-cdn.oss-cn-beijing.aliyuncs.com/active19_1111/m/index-share-img.png', isWeiXin: true,
}); });
this.setState({ }else{
showTip: true, history.push(`/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`);
isWeiXin: true, this.setState({
}); showTip: true,
}else{ });
history.push(`/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`) }
this.setState({
showTip: true,
});
}
}else if(code === 4030 || code === 4040) {
history.push('/passport');
}else{
Toast.info(msg, 2);
}
});
} }
} }
} }
...@@ -147,11 +166,9 @@ class Invite extends Component { ...@@ -147,11 +166,9 @@ class Invite extends Component {
<p>当前中奖热力值:</p> <p>当前中奖热力值:</p>
<p className="hot__value">{hotValue}</p> <p className="hot__value">{hotValue}</p>
<div className="hot__progress"> <div className="hot__progress">
<span>0</span>
<div className="progress__bar"> <div className="progress__bar">
<div className="progress__point" style={{'width': hot_schedule}}></div> <div className="progress__point" style={{'width': hot_schedule}}></div>
</div> </div>
<span>3600</span>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -77,6 +77,8 @@ class AddressPopup extends Component { ...@@ -77,6 +77,8 @@ class AddressPopup extends Component {
return errors; return errors;
}} }}
validateOnBlur={false}
validateOnChange={false}
onSubmit={(values) => { onSubmit={(values) => {
this.handleToSubmit(values); this.handleToSubmit(values);
}} }}
...@@ -136,7 +138,7 @@ class AddressPopup extends Component { ...@@ -136,7 +138,7 @@ class AddressPopup extends Component {
/> />
<button <button
className="address-form__submit" className="address-form__submit"
data-status={isEmpty(errors)? 'do' : ''} data-status="do"
type="submit" type="submit"
>提交</button> >提交</button>
</Form> </Form>
......
...@@ -55,7 +55,8 @@ class CollectBlessing extends Component { ...@@ -55,7 +55,8 @@ class CollectBlessing extends Component {
}; };
} }
qqToShare = () => { qqToShare = (e) => {
e.preventDefault();
const { uid, history } = this.props; const { uid, history } = this.props;
if(getParam('version')) { if(getParam('version')) {
if(!uid) { if(!uid) {
...@@ -287,7 +288,7 @@ class CollectBlessing extends Component { ...@@ -287,7 +288,7 @@ class CollectBlessing extends Component {
<a <a
className="collect-blessing__share-button" className="collect-blessing__share-button"
data-type="qq" data-type="qq"
onClick={this.qqToShare} onClick={(e) => this.qqToShare(e)}
></a> ></a>
<a <a
className="collect-blessing__share-button" className="collect-blessing__share-button"
......
...@@ -21,6 +21,7 @@ class ToGroup extends Component { ...@@ -21,6 +21,7 @@ class ToGroup extends Component {
number: 0, // 差几人成团 number: 0, // 差几人成团
isBuy: false, isBuy: false,
modal: false, modal: false,
pddOrderId:''
} }
} }
...@@ -57,6 +58,7 @@ class ToGroup extends Component { ...@@ -57,6 +58,7 @@ class ToGroup extends Component {
person_num: res.data.data.person_num, person_num: res.data.data.person_num,
course_list: res.data.data.course_list, course_list: res.data.data.course_list,
number: res.data.data.number, number: res.data.data.number,
pddOrderId: res.data.data.pdd_order_id,
countdown: '', countdown: '',
isBuy: res.data.data.is_buy isBuy: res.data.data.is_buy
}); });
...@@ -101,7 +103,8 @@ class ToGroup extends Component { ...@@ -101,7 +103,8 @@ class ToGroup extends Component {
history.push( history.push(
`/order?id=${data.course_id}`, `/order?id=${data.course_id}`,
{ {
group: 1 group: 1,
pdd_order_id:this.state.pddOrderId
} }
) )
} else { } else {
......
...@@ -135,7 +135,11 @@ class Order extends Component { ...@@ -135,7 +135,11 @@ class Order extends Component {
Toast.info('请完善报名信息!'); Toast.info('请完善报名信息!');
} }
const { location: { state ={} } } = this.props; const { location: { state ={} } } = this.props;
if(state.group === 1) { if(state.group === 1) {
console.log(state)
let params = state.pdd_order_id? { let params = state.pdd_order_id? {
course_id: getParam("id"), course_id: getParam("id"),
ischeck: this.state.useBalance, ischeck: this.state.useBalance,
...@@ -153,7 +157,10 @@ class Order extends Component { ...@@ -153,7 +157,10 @@ class Order extends Component {
} }
this.props.history.push(`/payorder?oid=${res.data.data.oid}`, {group: 1}); this.props.history.push(`/payorder?oid=${res.data.data.oid}`, {group: 1});
}else { }else if(Number(res.data.errno) === 0){
Toast.info(res.data.data.msg, 2);
return;
} else {
Toast.info(res.data.msg, 2); Toast.info(res.data.msg, 2);
return; return;
} }
......
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