Commit 852e0334 by wangshuo

领取大礼包

parent d3c7c396
import React, { Component } from 'react' import React, { Component } from 'react'
import {connect} from "react-redux"; import {connect} from "react-redux";
import { http, getParam } from '@/utils'; import { http, getParam } from '@/utils';
import cookie from 'js-cookie'
import './index.scss'; import './index.scss';
import {Toast} from "antd-mobile"; import {Toast} from "antd-mobile";
import jsCookie from 'js-cookie'; import jsCookie from 'js-cookie';
...@@ -8,11 +9,19 @@ import jsCookie from 'js-cookie'; ...@@ -8,11 +9,19 @@ import jsCookie from 'js-cookie';
class Activity extends Component { class Activity extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = {
'butText': '立即领取'
}
} }
componentWillMount() { componentWillMount() {
jsCookie.set('blessing_invite_uid', getParam('shareuid'), {domain: '.julyedu.com', expires: 30}); jsCookie.set('blessing_invite_uid', getParam('shareuid'), {domain: '.julyedu.com', expires: 30});
jsCookie.set('blessing_invite_code', getParam('inviteCode'), {domain: '.julyedu.com', expires: 30}); jsCookie.set('blessing_invite_code', getParam('inviteCode'), {domain: '.julyedu.com', expires: 30});
if(cookie.get('uid')) {
this.setState(()=>({
butText: '已领取'
}));
}
} }
getGift = () => { getGift = () => {
...@@ -20,15 +29,17 @@ class Activity extends Component { ...@@ -20,15 +29,17 @@ class Activity extends Component {
this.props.history.push('/passport'); this.props.history.push('/passport');
} else { } else {
Toast.info('领取成功,你可前往七月在线官网/APP进行查看', 2); Toast.info('领取成功,你可前往七月在线官网/APP进行查看', 2);
localStorage.setItem('lingqu', 1);
} }
} }
render() { render() {
const {butText} = this.state;
return ( return (
<div className="activity__con"> <div className="activity__con">
<div className='banner__con'></div> <div className='banner__con'></div>
<div className='content__con'> <div className='content__con'>
<div className="button__get" onClick={this.getGift}>立即领取</div> <div className="button__get" onClick={this.getGift}>{butText}</div>
</div> </div>
</div> </div>
) )
......
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