Commit 43fcf314 by wangshuo

邀请好友注册

parent 427b0590
...@@ -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,19 +34,16 @@ class Invite extends Component { ...@@ -33,19 +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();
} }
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',
});
} }
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();
} }
} }
...@@ -76,8 +74,33 @@ class Invite extends Component { ...@@ -76,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) {
...@@ -95,10 +118,6 @@ class Invite extends Component { ...@@ -95,10 +118,6 @@ 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 => {
let {code, data, msg} = res.data;
if(code === 200) {
let inviteCode = data.blessing_invite_code;
if(is_weixin()) { if(is_weixin()) {
wxShare({ wxShare({
title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!', title: 'AI充电节,积福气享1折秒课,超10万元奖品来就送!!',
...@@ -111,17 +130,11 @@ class Invite extends Component { ...@@ -111,17 +130,11 @@ class Invite extends Component {
isWeiXin: true, isWeiXin: true,
}); });
}else{ }else{
history.push(`/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`) history.push(`/invite?shareuid=${jsCookie.get('uid')}&new=1&inviteCode=${inviteCode}`);
this.setState({ this.setState({
showTip: true, showTip: true,
}); });
} }
}else if(code === 4030 || code === 4040) {
history.push('/passport');
}else{
Toast.info(msg, 2);
}
});
} }
} }
} }
......
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