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