Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
ufo-app-web
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
6 years ago
Commit
2d70786d36b3c6d8588b0fa5b4689de8e9e9d0c2
1 parent
919a8929
report
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
70 additions
and
13 deletions
apps/app.js
apps/common/report-app.js
apps/common/yoho.js
apps/pages/single/invite/detail/components/invite-code.vue
apps/pages/single/mine/bank-card/card-add.vue
apps/pages/single/mine/bank-card/card-list.vue
doraemon/middleware/set-yoho-data.js
doraemon/middleware/ssr.js
apps/app.js
View file @
2d70786
...
...
@@ -31,16 +31,35 @@ export function createApp(context) {
return
false
;
},
methods
:
{
getAnalyticAppData
()
{
return
new
Promise
(
resolve
=>
{
if
(
this
.
_updated
)
{
return
resolve
();
}
this
.
$yoho
.
getAnalyticAppData
(
''
,
data
=>
{
this
.
_updated
=
true
;
reportApp
.
updateDeviceInfo
(
data
);
resolve
();
});
setTimeout
(
function
()
{
resolve
();
},
500
);
});
},
async
reportApp
(
type
,
pn
,
params
=
{},
pt
)
{
let
user
=
await
this
.
$sdk
.
getUser
();
if
(
!
params
.
ei
)
{
params
.
ei
=
get
(
this
.
$router
,
'history.current.name'
,
''
);
await
this
.
getAnalyticAppData
();
if
(
!
params
.
mst
)
{
params
.
mst
=
get
(
this
.
$router
,
'history.current.name'
,
''
);
}
reportApp
.
report
(
type
,
pt
||
'BUSINESS'
,
pn
,
params
,
get
(
user
,
'uid'
));
},
reportAppStart
()
{
this
.
reportApp
(
'
start
'
,
'BUSINESS_PLAN_A_ENTER'
,
{
locfun
:
'mounted'
});
this
.
reportApp
(
''
,
'BUSINESS_PLAN_A_ENTER'
,
{
locfun
:
'mounted'
});
}
},
render
:
h
=>
h
(
App
)
...
...
apps/common/report-app.js
View file @
2d70786
...
...
@@ -20,6 +20,24 @@ export default class reportApp {
host
:
''
,
locfun
:
''
};
this
.
device
=
{
ak
:
`
yohobuy_$
{
params
.
isiOS
?
'ios'
:
'android'
}
$
{
params
.
isApp
?
''
:
'_h5'
}
`
,
udid
:
params
.
udid
||
''
,
ch
:
''
,
os
:
params
.
isiOS
?
'IOS'
:
'Android'
,
osv
:
params
.
osVersion
,
dm
:
''
,
};
}
updateDeviceInfo
(
info
=
{})
{
info
.
ch
&&
(
this
.
device
.
ch
=
info
.
ch
);
info
.
dm
&&
(
this
.
device
.
dm
=
info
.
dm
);
info
.
udid
&&
(
this
.
device
.
udid
=
info
.
udid
);
info
.
av
&&
(
this
.
events
.
av
=
info
.
av
);
info
.
ab
&&
(
this
.
events
.
ab
=
info
.
ab
);
info
.
sid
&&
(
this
.
events
.
sid
=
info
.
sid
);
}
report
(
type
,
pt
,
pn
,
params
=
{},
uid
=
0
)
{
if
(
!
this
.
isProd
)
{
...
...
@@ -40,8 +58,8 @@ export default class reportApp {
url
:
''
,
method
:
'POST'
,
data
:
{
type
,
device
:
{},
type
:
''
,
device
:
this
.
device
,
events
:
[
Object
.
assign
({
uid
:
uid
,
...
...
apps/common/yoho.js
View file @
2d70786
...
...
@@ -574,6 +574,18 @@ const yoho = {
// tip(tipInfo);
}
},
getAnalyticAppData
(
args
,
success
,
fail
)
{
if
(
this
.
isYohoBuy
&&
window
.
yohoInterface
)
{
window
.
yohoInterface
.
triggerEvent
(
success
||
nullFun
,
fail
||
nullFun
,
{
method
:
'get.analyticAppData'
,
arguments
:
args
});
}
else
{
// tip(tipInfo);
}
}
};
...
...
apps/pages/single/invite/detail/components/invite-code.vue
View file @
2d70786
...
...
@@ -96,7 +96,7 @@ export default {
this.$yoho.goPage('go.ufo', { pagename: 'MerchantEntry' });
}
this.$root.reportApp('
hb
', 'BUSINESS_PLAN_A_EVENT', {
this.$root.reportApp('', 'BUSINESS_PLAN_A_EVENT', {
locfun: 'click:storeNow'
});
}
...
...
apps/pages/single/mine/bank-card/card-add.vue
View file @
2d70786
...
...
@@ -87,9 +87,6 @@ export default {
this.fetchBankList();
}
this.$root.reportAppStart();
this.$root.reportApp('hb', 'BUSINESS_PLAN_A_EVEVT', {
locfun: 'click:bindBankCard'
});
},
computed: {
...mapState(['banks', 'bankCardList']),
...
...
@@ -182,7 +179,7 @@ export default {
}
},
bindBankCardInfo(info) {
this.$root.reportApp('
hb
', 'BUSINESS_PLAN_A_EVENT', {
this.$root.reportApp('', 'BUSINESS_PLAN_A_EVENT', {
locfun: 'click:bindBankCard'
});
...
...
apps/pages/single/mine/bank-card/card-list.vue
View file @
2d70786
...
...
@@ -12,6 +12,7 @@ export default {
name: 'cardList',
mounted() {
this.$refs.cards.init();
this.$root.reportAppStart();
},
components: {
...
...
doraemon/middleware/set-yoho-data.js
View file @
2d70786
...
...
@@ -56,6 +56,14 @@ module.exports = (req, res, next) => {
// client ip
req
.
yoho
.
clientIp
=
_getClientIp
(
req
);
if
(
req
.
yoho
.
isApp
)
{
req
.
yoho
.
udid
=
_
.
get
(
req
,
'query.udid'
,
''
);
}
if
(
!
req
.
yoho
.
udid
)
{
req
.
yoho
.
udid
=
_
.
get
(
req
,
'cookies.udid'
,
''
);
}
Object
.
assign
(
res
.
locals
,
req
.
yoho
);
next
();
...
...
doraemon/middleware/ssr.js
View file @
2d70786
...
...
@@ -12,7 +12,7 @@ const {createBundleRenderer} = require('vue-server-renderer');
const
logger
=
global
.
yoho
.
logger
;
const
config
=
global
.
yoho
.
config
;
const
isProd
=
process
.
env
.
NODE_ENV
===
'production'
;
const
isProd
=
true
||
process
.
env
.
NODE_ENV
===
'production'
;
const
isDev
=
process
.
env
.
NODE_ENV
===
'development'
||
!
process
.
env
.
NODE_ENV
;
let
renderer
;
...
...
@@ -40,14 +40,16 @@ const getContext = (req) => {
title
:
''
,
user
:
req
.
user
,
env
:
{
udid
:
req
.
yoho
.
udid
,
isApp
:
req
.
yoho
.
isApp
,
isiOS
:
req
.
yoho
.
isiOS
,
isAndroid
:
req
.
yoho
.
isAndroid
,
isYohoApp
:
req
.
yoho
.
isYohoApp
,
clientIp
:
req
.
yoho
.
clientIp
,
version
:
pkg
.
version
,
version
:
req
.
query
.
app_version
||
pkg
.
version
,
osVersion
:
req
.
query
.
os_version
||
''
,
buildId
:
req
.
app
.
locals
.
buildId
,
visitId
:
md5
(
`
$
{
req
.
query
.
udid
}
_$
{
new
Date
().
getTime
()}
`
)
visitId
:
md5
(
`
$
{
req
.
yoho
.
udid
}
_$
{
new
Date
().
getTime
()}
`
)
},
ua
:
req
.
get
(
'user-agent'
),
hostname
:
os
.
hostname
(),
...
...
Please
register
or
login
to post a comment