react-app-shell
Version:
react打包脚本和example, 这里的版本请忽略
79 lines (68 loc) • 1.97 kB
JavaScript
import React, {PureComponent} from 'react';
import {WechatConfig, SetParamToCookie, ShareMask} from '../../components';
import {shareConfig} from '../../config';
import {tools, monitor} from '../../utils';
import styles from './seckill.less';
let seckill_share = shareConfig.seckill;
const isWeixin = tools.isWeiXin();
/**
* 秒杀活动=>成功页面
*/
class SeckillSucceed extends PureComponent {
constructor(props) {
super(props);
this.state = {
shareVisible: false,
};
}
componentDidMount() {
this.monitorUtil('进入了领取成功页面');
}
// 神策指定位置埋点
monitorUtil = (message) => {
monitor.log('', message);
};
/**
* 显示shareModal
*/
handelShowShare = () => {
monitor.log('', '点击了领取成功页面的分享');
this.setState({
shareVisible: true
});
}
/**
* 关闭Modal
*/
handelHideModal = () => {
this.setState({
shareVisible: false
});
};
renderShareButton = () => {
if (!isWeixin) return null;
return <div>
<div
className={styles['button-share']}
onClick={this.handelShowShare}>
<i/>分享给好友
</div>
<WechatConfig showShare={true} shareOptions={seckill_share}/>
</div>;
}
render() {
const {shareVisible} = this.state;
return (
<div className={styles['seckill-suceed-wrapper']}>
<div className={styles['content']}>
</div>
<footer className={styles['footer']}>
{this.renderShareButton()}
</footer>
<SetParamToCookie paramKey="rf"/>
{shareVisible && <ShareMask onCancel={this.handelHideModal}/>}
</div>
);
}
}
export default SeckillSucceed;