Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mr-julyedu
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
baiguangyao
mr-julyedu
Commits
87099ecc
Commit
87099ecc
authored
Sep 19, 2019
by
zhanghaozhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
红包统计
parent
65b20269
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
src/App.js
+2
-0
src/components/detail/redPacket/index.js
+24
-2
No files found.
src/App.js
View file @
87099ecc
...
@@ -165,6 +165,8 @@ class App extends Component {
...
@@ -165,6 +165,8 @@ class App extends Component {
transformUser
=
res
=>
{
transformUser
=
res
=>
{
let
payload
let
payload
if
(
res
.
data
.
code
===
200
)
{
if
(
res
.
data
.
code
===
200
)
{
//移除红包统计cookie
cookie
.
remove
(
'share_code'
,
{
path
:
'/'
,
domain
:
'.julyedu.com'
})
const
{
const
{
msg
,
data
:
{
msg
,
data
:
{
avatar_file
:
avatar
,
avatar_file
:
avatar
,
...
...
src/components/detail/redPacket/index.js
View file @
87099ecc
...
@@ -9,6 +9,7 @@ import { Toast } from 'antd-mobile';
...
@@ -9,6 +9,7 @@ import { Toast } from 'antd-mobile';
import
Captcha
from
'@/common/Captcha'
;
import
Captcha
from
'@/common/Captcha'
;
import
FollowQRcode
from
'./../followQRcode'
;
import
FollowQRcode
from
'./../followQRcode'
;
import
'./index.scss'
;
import
'./index.scss'
;
import
cookie
from
'js-cookie'
class
RedPacket
extends
PureComponent
{
class
RedPacket
extends
PureComponent
{
...
@@ -53,6 +54,8 @@ class RedPacket extends PureComponent {
...
@@ -53,6 +54,8 @@ class RedPacket extends PureComponent {
// 分享链接进入
// 分享链接进入
this
.
judgePopupType
();
this
.
judgePopupType
();
window
.
addEventListener
(
'beforeunload'
,
this
.
removeStatisticsCookie
)
// 微信进入
// 微信进入
const
isWechat
=
getParam
(
'wechat'
);
const
isWechat
=
getParam
(
'wechat'
);
...
@@ -64,7 +67,7 @@ class RedPacket extends PureComponent {
...
@@ -64,7 +67,7 @@ class RedPacket extends PureComponent {
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
;
if
(
code
===
200
)
{
if
(
code
===
200
)
{
// 检查收否领取过
// 检查收否领取过
http
.
post
(
http
.
post
(
`
${
API
.
home
}
/sys/redPacket/split`
,
`
${
API
.
home
}
/sys/redPacket/split`
,
...
@@ -76,7 +79,7 @@ class RedPacket extends PureComponent {
...
@@ -76,7 +79,7 @@ class RedPacket extends PureComponent {
const
{
code
,
data
}
=
res
.
data
;
const
{
code
,
data
}
=
res
.
data
;
if
(
code
===
200
)
{
if
(
code
===
200
)
{
window
.
localStorage
.
removeItem
(
'redpacket-click'
);
window
.
localStorage
.
removeItem
(
'redpacket-click'
);
// 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
{
...
@@ -95,6 +98,7 @@ class RedPacket extends PureComponent {
...
@@ -95,6 +98,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
});
});
...
@@ -103,6 +107,16 @@ class RedPacket extends PureComponent {
...
@@ -103,6 +107,16 @@ class RedPacket extends PureComponent {
this
.
fetchShareInfo
();
this
.
fetchShareInfo
();
}
}
removeStatisticsCookie
=
()
=>
{
cookie
.
remove
(
'share_code'
,
{
path
:
'/'
,
domain
:
'.julyedu.com'
})
}
componentWillUnmount
()
{
window
.
removeEventListener
(
'beforeunload'
,
this
.
removeStatisticsCookie
)
this
.
removeStatisticsCookie
()
}
// 获取分享信息
// 获取分享信息
fetchShareInfo
=
()
=>
{
fetchShareInfo
=
()
=>
{
const
share_code
=
getParam
(
'share_code'
);
const
share_code
=
getParam
(
'share_code'
);
...
@@ -574,6 +588,14 @@ class RedPacket extends PureComponent {
...
@@ -574,6 +588,14 @@ 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
)
}
render
()
{
render
()
{
// console.log(this.props);
// console.log(this.props);
const
{
history
,
userInfo
}
=
this
.
props
;
const
{
history
,
userInfo
}
=
this
.
props
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment