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
703118b9
Commit
703118b9
authored
Sep 17, 2019
by
xuzhenghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tongji
parent
9e5d2f7f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
8 deletions
+36
-8
public/api.js
+1
-0
src/App.js
+35
-8
No files found.
public/api.js
View file @
703118b9
var
API
=
{
var
API
=
{
'www'
:
'http://www-test.julyedu.com'
,
'home'
:
'http://fast-test.julyedu.com'
,
'home'
:
'http://fast-test.julyedu.com'
,
'search-api'
:
'https://search.julyedu.com'
,
'search-api'
:
'https://search.julyedu.com'
,
'passport-api'
:
'http://passport-test.julyedu.com'
,
'passport-api'
:
'http://passport-test.julyedu.com'
,
...
...
src/App.js
View file @
703118b9
import
React
,
{
Component
}
from
'react'
import
React
,
{
Component
}
from
'react'
import
Routes
from
'./router'
import
Routes
from
'./router'
import
cookie
from
'js-cookie'
import
cookie
from
'js-cookie'
import
{
connect
}
from
"react-redux"
;
import
{
connect
}
from
"react-redux"
;
import
{
setCurrentUser
,
startFetchUser
}
from
"@/store/userAction"
;
import
{
setCurrentUser
,
startFetchUser
}
from
"@/store/userAction"
;
import
{
withRouter
}
from
'react-router-dom'
import
{
withRouter
}
from
'react-router-dom'
import
{
compose
}
from
'redux'
import
{
compose
}
from
'redux'
import
{
getParam
,
http
,
browser
}
from
"@/utils"
;
import
{
getParam
,
http
,
browser
}
from
"@/utils"
;
import
{
Toast
}
from
"antd-mobile"
;
import
{
Toast
}
from
"antd-mobile"
;
import
{
addDays
}
from
'date-fns'
import
{
addDays
}
from
'date-fns'
//拦截ajax请求,返回mock数据
//拦截ajax请求,返回mock数据
...
@@ -88,6 +88,32 @@ class App extends Component {
...
@@ -88,6 +88,32 @@ class App extends Component {
}
}
}
}
utm
=
()
=>
{
// utm统计 m站全站统计广告投放、以及统计详情页浏览
let
utm_source
=
getParam
(
'utm_source'
)
let
utm_medium
=
getParam
(
'utm_medium'
)
let
utm_campaign
=
getParam
(
'utm_campaign'
)
let
utm_content
=
getParam
(
'utm_content'
)
let
utm_term
=
getParam
(
'utm_term'
)
let
courseId
=
location
.
pathname
.
startsWith
(
'/getDetail'
)
||
location
.
pathname
.
startsWith
(
'/detail'
)
?
getParam
(
'id'
)
:
0
if
(
courseId
||
(
utm_term
&&
utm_source
&&
utm_medium
&&
utm_campaign
&&
utm_content
))
{
let
data
=
{
'utm_source'
:
utm_source
,
'utm_medium'
:
utm_medium
,
'utm_campaign'
:
utm_campaign
,
'utm_content'
:
utm_content
,
'utm_term'
:
utm_term
,
}
http
.
post
(
`
${
API
[
'www'
]}
/base/first_utm_record/
${
courseId
}
`
,
data
)
.
then
(
res
=>
{
})
}
}
getUser
=
()
=>
{
getUser
=
()
=>
{
this
.
props
.
startFetchUser
()
this
.
props
.
startFetchUser
()
...
@@ -124,6 +150,7 @@ class App extends Component {
...
@@ -124,6 +150,7 @@ class App extends Component {
}
}
componentDidUpdate
()
{
componentDidUpdate
()
{
this
.
utm
()
const
{
location
}
=
this
.
props
const
{
location
}
=
this
.
props
this
.
previousLocation
=
location
.
pathname
.
startsWith
(
'/passport'
)
?
this
.
previousLocation
=
location
.
pathname
.
startsWith
(
'/passport'
)
?
this
.
previousLocation
.
pathname
===
'/'
?
location
:
this
.
previousLocation
:
location
this
.
previousLocation
.
pathname
===
'/'
?
location
:
this
.
previousLocation
:
location
...
...
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