Commit e241ec82 by zhanghaozhe

Merge branch 'red-envelope-statistics' into pre

# Conflicts:
#	src/components/detail/redPacket/index.js
parents 5bfb7ea2 c86d3c6b
...@@ -40,7 +40,7 @@ class RedPacket extends PureComponent { ...@@ -40,7 +40,7 @@ class RedPacket extends PureComponent {
endTime: 10, // 手机绑定时限 endTime: 10, // 手机绑定时限
countdownTimer: null, countdownTimer: null,
countdown: '00分00秒', // 绑定时间 countdown: '00分00秒', // 绑定时间
accountInfo: {}, accountInfo: {},
bindInfo: {}, bindInfo: {},
country: { country: {
num: '86' num: '86'
...@@ -55,13 +55,14 @@ class RedPacket extends PureComponent { ...@@ -55,13 +55,14 @@ class RedPacket extends PureComponent {
// 分享链接进入 // 分享链接进入
this.judgePopupType(); this.judgePopupType();
window.addEventListener('beforeunload', this.removeStatisticsCookie) window.addEventListener('beforeunload', this.removeStatisticsCookie)
// 微信进入 // 微信进入
const isWechat = getParam('wechat'); const isWechat = getParam('wechat');
const { userInfo } = this.props; const { userInfo } = this.props;
if(!userInfo || !userInfo.uid){ if(!userInfo || !userInfo.uid) {
this.setRelativeCookie() this.setRelativeCookie()
} }
if(isWechat === '1' && !browser.isWeixin) { if(isWechat === '1' && !browser.isWeixin) {
...@@ -102,6 +103,7 @@ class RedPacket extends PureComponent { ...@@ -102,6 +103,7 @@ class RedPacket extends PureComponent {
window.localStorage.removeItem('redpacket-click'); window.localStorage.removeItem('redpacket-click');
} }
}else { }else {
this.setRelativeCookie()
this.setState({ this.setState({
type: 1 type: 1
}); });
...@@ -121,7 +123,6 @@ class RedPacket extends PureComponent { ...@@ -121,7 +123,6 @@ class RedPacket extends PureComponent {
// 获取分享信息 // 获取分享信息
fetchShareInfo = () => { fetchShareInfo = () => {
const share_code = getParam('share_code'); const share_code = getParam('share_code');
http.get(`${API.home}/sys/redPacket/shareUrl/${getParam('id')}`).then(res => { http.get(`${API.home}/sys/redPacket/shareUrl/${getParam('id')}`).then(res => {
const { code, data } = res.data; const { code, data } = res.data;
...@@ -162,7 +163,7 @@ class RedPacket extends PureComponent { ...@@ -162,7 +163,7 @@ class RedPacket extends PureComponent {
}); });
}else { }else {
// is_receive 是否领取过 0-否 1-是 // is_receive 是否领取过 0-否 1-是
if(data.is_receive) { if(data.is_receive) {
this.judgeReceiveStatus(data); this.judgeReceiveStatus(data);
}else { }else {
...@@ -205,7 +206,7 @@ class RedPacket extends PureComponent { ...@@ -205,7 +206,7 @@ class RedPacket extends PureComponent {
const { code, data } = res.data; const { code, data } = res.data;
if(code === 200) { if(code === 200) {
// is_receive 是否领取过 0-否 1-是 // is_receive 是否领取过 0-否 1-是
if(data.is_receive) { if(data.is_receive) {
this.judgeReceiveStatus(data, 8); this.judgeReceiveStatus(data, 8);
}else { }else {
...@@ -562,7 +563,7 @@ class RedPacket extends PureComponent { ...@@ -562,7 +563,7 @@ class RedPacket extends PureComponent {
const { accountInfo: { tel, code}, country: {num = '0086'} } = this.state; const { accountInfo: { tel, code}, country: {num = '0086'} } = this.state;
// is_valid 是否验证 1:验证(默认),0不验证 // is_valid 是否验证 1:验证(默认),0不验证
http.post( http.post(
`${API['passport-api']}/m/personal/bindPhone`, `${API['passport-api']}/m/personal/bindPhone`,
{ {
area_code: num.padStart(4, '0'), area_code: num.padStart(4, '0'),
phone_num: tel, phone_num: tel,
...@@ -596,23 +597,23 @@ class RedPacket extends PureComponent { ...@@ -596,23 +597,23 @@ class RedPacket extends PureComponent {
setRelativeCookie = () => { setRelativeCookie = () => {
const config = {path: '/', domain: '.julyedu.com'} const config = {path: '/', domain: '.julyedu.com'}
const {shareInfo} = this.state const {shareInfo} = this.state
cookie.set('share_code', shareInfo && shareInfo.share_code ? shareInfo.share_code : 'share_code:share_code', config) cookie.set('share_code', shareInfo && shareInfo.share_code ? shareInfo.share_code : 'share_code', config)
} }
render() { render() {
// console.log(this.props); // console.log(this.props);
const { history, userInfo } = this.props; const { history, userInfo } = this.props;
const { const {
type, type,
isCopy, isCopy,
validate, validate,
isTimer, isTimer,
seconds, seconds,
shareInfo: { shareInfo: {
command = '', command = '',
share_code = '' share_code = ''
}, },
money, money,
doneInfo, doneInfo,
countdown, countdown,
endTime, endTime,
...@@ -637,7 +638,7 @@ class RedPacket extends PureComponent { ...@@ -637,7 +638,7 @@ class RedPacket extends PureComponent {
{/* wechat */} {/* wechat */}
{ {
type == 2 && type == 2 &&
<div className="pupup-wechat"> <div className="pupup-wechat">
<h4 className="popup-wechat__title">当前环境不支持领红包活动</h4> <h4 className="popup-wechat__title">当前环境不支持领红包活动</h4>
<p className="popup-wechat__desc">请点击右上角“ ··· ”,选择在浏览器中打开 然后参与活动!</p> <p className="popup-wechat__desc">请点击右上角“ ··· ”,选择在浏览器中打开 然后参与活动!</p>
...@@ -658,7 +659,7 @@ class RedPacket extends PureComponent { ...@@ -658,7 +659,7 @@ class RedPacket extends PureComponent {
{!isCopy {!isCopy
? userInfo && userInfo.uid ? userInfo && userInfo.uid
? ( ? (
<CopyToClipboard <CopyToClipboard
text={command} text={command}
onCopy={() => this.setState({ onCopy={() => this.setState({
isCopy: true isCopy: true
...@@ -668,8 +669,8 @@ class RedPacket extends PureComponent { ...@@ -668,8 +669,8 @@ class RedPacket extends PureComponent {
</CopyToClipboard> </CopyToClipboard>
) )
: ( : (
<button <button
className="popup-password__button--copy" className="popup-password__button--copy"
onClick={() => { onClick={() => {
window.localStorage.setItem('redpacket-click', 'copy'); window.localStorage.setItem('redpacket-click', 'copy');
history.push('/passport/login'); history.push('/passport/login');
...@@ -684,8 +685,8 @@ class RedPacket extends PureComponent { ...@@ -684,8 +685,8 @@ class RedPacket extends PureComponent {
自己也可以领取哦~ 自己也可以领取哦~
</p> </p>
</div> </div>
<i <i
className="popup-password__button--close iconfont iconiconfront-2" className="popup-password__button--close iconfont iconiconfront-2"
onClick={() => { onClick={() => {
if(getParam('wechat') === '1') { if(getParam('wechat') === '1') {
if(userInfo && userInfo.uid) { if(userInfo && userInfo.uid) {
...@@ -708,14 +709,14 @@ class RedPacket extends PureComponent { ...@@ -708,14 +709,14 @@ class RedPacket extends PureComponent {
</div> </div>
} }
{/* red-packet--close */} {/* red-packet--close */}
{ {
type === 3 && type === 3 &&
<Packet <Packet
type={3} type={3}
packetInfo={{ packetInfo={{
title: '七月在线给你发了个红包~' title: '七月在线给你发了个红包~'
}} }}
handleToClose={() => this.handleToClose(false)} handleToClose={() => this.handleToClose(false)}
handleToOpen={this.handleToOpen} handleToOpen={this.handleToOpen}
...@@ -725,7 +726,7 @@ class RedPacket extends PureComponent { ...@@ -725,7 +726,7 @@ class RedPacket extends PureComponent {
{/* red-packet--open */} {/* red-packet--open */}
{ {
type === 4 && type === 4 &&
<Packet <Packet
type={4} type={4}
packetInfo={{ packetInfo={{
money, money,
...@@ -746,7 +747,7 @@ class RedPacket extends PureComponent { ...@@ -746,7 +747,7 @@ class RedPacket extends PureComponent {
{/* red-packet--money success */} {/* red-packet--money success */}
{ {
type === 5 && type === 5 &&
<Packet <Packet
type={5} type={5}
packetInfo={{ packetInfo={{
money, money,
...@@ -769,7 +770,7 @@ class RedPacket extends PureComponent { ...@@ -769,7 +770,7 @@ class RedPacket extends PureComponent {
{/* red-packet--fragment success */} {/* red-packet--fragment success */}
{ {
type === 6 && type === 6 &&
<Packet <Packet
type={6} type={6}
packetInfo={{ packetInfo={{
money, money,
...@@ -792,7 +793,7 @@ class RedPacket extends PureComponent { ...@@ -792,7 +793,7 @@ class RedPacket extends PureComponent {
{/* red-packet--late 来完了 */} {/* red-packet--late 来完了 */}
{ {
type === 7 && type === 7 &&
<Packet <Packet
type={7} type={7}
packetInfo={{ packetInfo={{
btn: { btn: {
...@@ -820,7 +821,7 @@ class RedPacket extends PureComponent { ...@@ -820,7 +821,7 @@ class RedPacket extends PureComponent {
}} }}
validate={({tel, code}) => { validate={({tel, code}) => {
const errors = {}; const errors = {};
// if (!validateTel(tel)) { // if (!validateTel(tel)) {
if(!/^\d+$/.test(tel)) { if(!/^\d+$/.test(tel)) {
errors.tel = '请填写正确格式的手机号'; errors.tel = '请填写正确格式的手机号';
...@@ -828,7 +829,7 @@ class RedPacket extends PureComponent { ...@@ -828,7 +829,7 @@ class RedPacket extends PureComponent {
if (!/[0-9]{6}/.test(code)) { if (!/[0-9]{6}/.test(code)) {
errors.code = '请输入验证码'; errors.code = '请输入验证码';
} }
return errors; return errors;
}} }}
onSubmit={(values, { setStatus, setSubmitting }) => { onSubmit={(values, { setStatus, setSubmitting }) => {
...@@ -843,8 +844,8 @@ class RedPacket extends PureComponent { ...@@ -843,8 +844,8 @@ class RedPacket extends PureComponent {
<Form className="popup-form__content"> <Form className="popup-form__content">
<h4 className="popup-form__title">绑定手机号</h4> <h4 className="popup-form__title">绑定手机号</h4>
<div className="popup-form__item"> <div className="popup-form__item">
<a <a
className="popup-form__button--num" className="popup-form__button--num"
href={`/country?id=${getParam('id')}&share_code=${share_code}`}> href={`/country?id=${getParam('id')}&share_code=${share_code}`}>
+{country.num} +{country.num}
<i className="iconfont iconiconfront-69"></i> <i className="iconfont iconiconfront-69"></i>
...@@ -853,9 +854,9 @@ class RedPacket extends PureComponent { ...@@ -853,9 +854,9 @@ class RedPacket extends PureComponent {
name="tel" name="tel"
render={({field}) => { render={({field}) => {
return ( return (
<input <input
{...field} {...field}
className="popup-form__ipt" className="popup-form__ipt"
data-bdrs="0 6px 6px 0" data-bdrs="0 6px 6px 0"
data-type="tel" data-type="tel"
type="text" type="text"
...@@ -865,7 +866,7 @@ class RedPacket extends PureComponent { ...@@ -865,7 +866,7 @@ class RedPacket extends PureComponent {
}} }}
/> />
</div> </div>
<Captcha <Captcha
mrBtm={15} mrBtm={15}
getInstance={this.getCaptchaInstance} getInstance={this.getCaptchaInstance}
onVerify={this.onVerify} onVerify={this.onVerify}
...@@ -879,8 +880,8 @@ class RedPacket extends PureComponent { ...@@ -879,8 +880,8 @@ class RedPacket extends PureComponent {
绑定超时,红包已失效! 绑定超时,红包已失效!
</p> </p>
</div> </div>
<button <button
className="popup-packet__button--bundle" className="popup-packet__button--bundle"
data-status="do" data-status="do"
type="button" type="button"
onClick={() => { onClick={() => {
...@@ -895,7 +896,7 @@ class RedPacket extends PureComponent { ...@@ -895,7 +896,7 @@ class RedPacket extends PureComponent {
name="code" name="code"
render={({field}) => { render={({field}) => {
return ( return (
<input <input
{...field} {...field}
className="popup-form__ipt popup-form__ipt--left" className="popup-form__ipt popup-form__ipt--left"
type="text" type="text"
...@@ -904,7 +905,7 @@ class RedPacket extends PureComponent { ...@@ -904,7 +905,7 @@ class RedPacket extends PureComponent {
); );
}} }}
/> />
<button <button
className="popup-form__button--code" className="popup-form__button--code"
data-status={(validate && !isTimer)? 'do': ''} data-status={(validate && !isTimer)? 'do': ''}
type="button" type="button"
...@@ -915,8 +916,8 @@ class RedPacket extends PureComponent { ...@@ -915,8 +916,8 @@ class RedPacket extends PureComponent {
} }
</button> </button>
</div> </div>
<button <button
className="popup-packet__button--bundle" className="popup-packet__button--bundle"
data-status={(tel && code && isEmpty(errors))? 'do': 'done'} data-status={(tel && code && isEmpty(errors))? 'do': 'done'}
type="submit" type="submit"
> >
...@@ -928,8 +929,8 @@ class RedPacket extends PureComponent { ...@@ -928,8 +929,8 @@ class RedPacket extends PureComponent {
</Form> </Form>
)} )}
/> />
<i <i
className="popup-password__button--close iconfont iconiconfront-2" className="popup-password__button--close iconfont iconiconfront-2"
onClick={() => this.handleToClose(false)} onClick={() => this.handleToClose(false)}
/> />
</div> </div>
...@@ -948,8 +949,8 @@ class RedPacket extends PureComponent { ...@@ -948,8 +949,8 @@ class RedPacket extends PureComponent {
{doneInfo.txt} {doneInfo.txt}
</h4> </h4>
<p className="popup-done__desc">{doneInfo.desc}</p> <p className="popup-done__desc">{doneInfo.desc}</p>
<button <button
className="popup-packet__button--bundle" className="popup-packet__button--bundle"
data-status="do" data-status="do"
type="submit" type="submit"
onClick={() => { onClick={() => {
...@@ -957,8 +958,8 @@ class RedPacket extends PureComponent { ...@@ -957,8 +958,8 @@ class RedPacket extends PureComponent {
}} }}
>获取更多奖励</button> >获取更多奖励</button>
</div> </div>
<i <i
className="popup-password__button--close iconfont iconiconfront-2" className="popup-password__button--close iconfont iconiconfront-2"
onClick={() => { onClick={() => {
const isShare = getParam('share_code')? true : false; const isShare = getParam('share_code')? true : false;
this.handleToClose(false, isShare); this.handleToClose(false, isShare);
...@@ -969,7 +970,7 @@ class RedPacket extends PureComponent { ...@@ -969,7 +970,7 @@ class RedPacket extends PureComponent {
{/* 手机号绑定提示 */} {/* 手机号绑定提示 */}
{ {
type === 10 && type === 10 &&
<div className="popup-bind"> <div className="popup-bind">
<div className="popup-bind__content"> <div className="popup-bind__content">
<h4 className="popup-bind__title">绑定确认</h4> <h4 className="popup-bind__title">绑定确认</h4>
...@@ -978,7 +979,7 @@ class RedPacket extends PureComponent { ...@@ -978,7 +979,7 @@ class RedPacket extends PureComponent {
{ {
bindInfo['email'] && bindInfo['email'] &&
<li className="popup-bind__account"> <li className="popup-bind__account">
{/* 邮箱 */} {/* 邮箱 */}
<i className="iconfont iconduanxin"></i> <i className="iconfont iconduanxin"></i>
<p className="popup-bind__account--name">{bindInfo['email']}</p> <p className="popup-bind__account--name">{bindInfo['email']}</p>
...@@ -1013,16 +1014,16 @@ class RedPacket extends PureComponent { ...@@ -1013,16 +1014,16 @@ class RedPacket extends PureComponent {
} }
</ul> </ul>
<div className="popup-bind__button"> <div className="popup-bind__button">
<button <button
className="popup-bind__button--cancle" className="popup-bind__button--cancle"
onClick={() => this.handleToClose(false)}>取消</button> onClick={() => this.handleToClose(false)}>取消</button>
<button <button
className="popup-bind__button--confirm" className="popup-bind__button--confirm"
onClick={() => this.toContinueBind(0)}>继续绑定</button> onClick={() => this.toContinueBind(0)}>继续绑定</button>
</div> </div>
</div> </div>
<i <i
className="popup-password__button--close iconfont iconiconfront-2" className="popup-password__button--close iconfont iconiconfront-2"
onClick={() => this.handleToClose(false)} onClick={() => this.handleToClose(false)}
/> />
</div> </div>
...@@ -1084,7 +1085,7 @@ const Packet = ({type, packetInfo, handleToClose, handleToOpen }) => { ...@@ -1084,7 +1085,7 @@ const Packet = ({type, packetInfo, handleToClose, handleToOpen }) => {
}) })
} }
</p> </p>
<button <button
className="popup-packet__button--bundle" className="popup-packet__button--bundle"
onClick={btn.onClick} onClick={btn.onClick}
> >
...@@ -1100,7 +1101,7 @@ const Packet = ({type, packetInfo, handleToClose, handleToOpen }) => { ...@@ -1100,7 +1101,7 @@ const Packet = ({type, packetInfo, handleToClose, handleToOpen }) => {
红包仅能当日领取,下次<br /> 红包仅能当日领取,下次<br />
早点来哦~ 早点来哦~
</p> </p>
<button <button
className="popup-packet__button--bundle" className="popup-packet__button--bundle"
onClick={btn.onClick} onClick={btn.onClick}
> >
...@@ -1109,8 +1110,8 @@ const Packet = ({type, packetInfo, handleToClose, handleToOpen }) => { ...@@ -1109,8 +1110,8 @@ const Packet = ({type, packetInfo, handleToClose, handleToOpen }) => {
</> </>
} }
</div> </div>
<i <i
className="popup-password__button--close iconfont iconiconfront-2" className="popup-password__button--close iconfont iconiconfront-2"
onClick={handleToClose} onClick={handleToClose}
/> />
</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