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
919a8929f3d2a737f284ad51802353313c46f329
1 parent
d1f5063d
report
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
99 additions
and
32 deletions
apps/app.js
apps/common/report-app.js
apps/pages/single/invite/detail/components/invite-code.vue
apps/pages/single/invite/invite.vue
apps/pages/single/mine/bank-card/card-add.vue
apps/pages/single/mine/bank-card/card-list.vue
create-app.js
doraemon/middleware/ssr.js
apps/app.js
View file @
919a892
import
Vue
from
'vue'
;
import
{
get
}
from
'lodash'
;
import
App
from
'./app.vue'
;
import
{
createRouter
}
from
'./router'
;
import
{
createStore
}
from
'./store'
;
...
...
@@ -8,6 +9,7 @@ import titleMixin from './mixins/title';
import
pluginCore
from
'./plugins/core'
;
import
lazyload
from
'vue-lazyload'
;
import
reportError
from
'report-error'
;
import
ReportApp
from
'./common/report-app'
;
Vue
.
use
(
lazyload
,
{
preLoad
:
2
...
...
@@ -15,11 +17,12 @@ Vue.use(lazyload, {
Vue
.
use
(
pluginCore
);
Vue
.
mixin
(
titleMixin
);
export
function
createApp
(
context
)
{
const
router
=
createRouter
();
const
store
=
createStore
(
context
);
const
reportApp
=
new
ReportApp
(
store
.
$context
.
env
);
const
app
=
new
Vue
({
router
,
store
,
...
...
@@ -27,6 +30,19 @@ export function createApp(context) {
reportError
(
context
,
'server'
)(
error
);
return
false
;
},
methods
:
{
async
reportApp
(
type
,
pn
,
params
=
{},
pt
)
{
let
user
=
await
this
.
$sdk
.
getUser
();
if
(
!
params
.
ei
)
{
params
.
ei
=
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'
});
}
},
render
:
h
=>
h
(
App
)
});
...
...
apps/common/report-app.js
View file @
919a892
import
axios
from
'axios'
;
export
default
({
type
,
pt
,
pn
,
params
})
=>
{
axios
({
baseURL
:
'https://app.yoho.cn/collect/v3'
,
url
:
''
,
method
:
'POST'
,
data
:
{
type
,
device
:
{},
events
:
[{
ps
:
'0'
,
av
:
APP_VERSION
,
ab
:
APP_BUILD
,
ca
:
'0'
,
net
:
networkType
,
sid
:
sid
,
uid
:
uid
,
ts
:
ts
,
pt
:
'BUSINESS'
,
pn
:
pn
,
param
:
{
}
}]
export
default
class
reportApp
{
constructor
(
params
=
{})
{
this
.
isProd
=
!
params
.
unProd
;
this
.
events
=
{
ps
:
'0'
,
av
:
params
.
version
,
ab
:
params
.
buildId
,
ca
:
'0'
,
net
:
'unknown'
,
sid
:
params
.
visitId
,
};
this
.
params
=
{
mst
:
''
,
st
:
''
,
ec
:
''
,
ei
:
''
,
url
:
''
,
host
:
''
,
locfun
:
''
};
}
report
(
type
,
pt
,
pn
,
params
=
{},
uid
=
0
)
{
if
(
!
this
.
isProd
)
{
return
;
}
})
}
\ No newline at end of file
params
=
Object
.
assign
({},
this
.
params
,
params
);
if
(
window
)
{
Object
.
assign
(
params
,
{
host
:
window
.
location
.
host
,
url
:
window
.
location
.
href
});
}
axios
({
baseURL
:
'https://app.yoho.cn/collect/v3'
,
url
:
''
,
method
:
'POST'
,
data
:
{
type
,
device
:
{},
events
:
[
Object
.
assign
({
uid
:
uid
,
ts
:
new
Date
().
getTime
()
+
'000000'
,
pt
:
pt
,
pn
:
pn
,
param
:
params
},
this
.
events
)
]
}
})
}
}
...
...
apps/pages/single/invite/detail/components/invite-code.vue
View file @
919a892
...
...
@@ -95,6 +95,10 @@ export default {
} else {
this.$yoho.goPage('go.ufo', { pagename: 'MerchantEntry' });
}
this.$root.reportApp('hb', 'BUSINESS_PLAN_A_EVENT', {
locfun: 'click:storeNow'
});
}
}
};
...
...
apps/pages/single/invite/invite.vue
View file @
919a892
...
...
@@ -26,6 +26,9 @@ export default {
await store.dispatch('invite/invite/fetchAll');
}
},
mounted() {
this.$root.reportAppStart();
},
data() {
return {
title: '卖家邀新返利',
...
...
apps/pages/single/mine/bank-card/card-add.vue
View file @
919a892
...
...
@@ -86,6 +86,10 @@ export default {
if (!this.banks.length) {
this.fetchBankList();
}
this.$root.reportAppStart();
this.$root.reportApp('hb', 'BUSINESS_PLAN_A_EVEVT', {
locfun: 'click:bindBankCard'
});
},
computed: {
...mapState(['banks', 'bankCardList']),
...
...
@@ -178,6 +182,10 @@ export default {
}
},
bindBankCardInfo(info) {
this.$root.reportApp('hb', 'BUSINESS_PLAN_A_EVENT', {
locfun: 'click:bindBankCard'
});
let confirm = this.$createDialog({
type: 'confirm',
title: '提示',
...
...
apps/pages/single/mine/bank-card/card-list.vue
View file @
919a892
...
...
@@ -12,6 +12,7 @@ export default {
name: 'cardList',
mounted() {
this.$refs.cards.init();
this.$root.reportAppStart();
},
components: {
LayoutApp,
...
...
create-app.js
View file @
919a892
...
...
@@ -20,6 +20,7 @@ exports.createApp = async(app) => {
app
.
locals
.
devEnv
=
app
.
get
(
'env'
)
===
'development'
;
app
.
locals
.
proEnv
=
app
.
get
(
'env'
)
===
'production'
;
app
.
locals
.
version
=
pkg
.
version
;
app
.
locals
.
buildId
=
'web'
+
new
Date
().
getTime
()
+
'000000'
;
if
(
config
.
zookeeperServer
)
{
const
monitor
=
global
.
yoho
.
monitorSender
;
...
...
doraemon/middleware/ssr.js
View file @
919a892
...
...
@@ -12,6 +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
isDev
=
process
.
env
.
NODE_ENV
===
'development'
||
!
process
.
env
.
NODE_ENV
;
let
renderer
;
...
...
@@ -34,7 +35,7 @@ if (!isDev) {
}
const
getContext
=
(
req
)
=>
{
return
{
let
res
=
{
url
:
req
.
url
,
title
:
''
,
user
:
req
.
user
,
...
...
@@ -44,6 +45,9 @@ const getContext = (req) => {
isAndroid
:
req
.
yoho
.
isAndroid
,
isYohoApp
:
req
.
yoho
.
isYohoApp
,
clientIp
:
req
.
yoho
.
clientIp
,
version
:
pkg
.
version
,
buildId
:
req
.
app
.
locals
.
buildId
,
visitId
:
md5
(
`
$
{
req
.
query
.
udid
}
_$
{
new
Date
().
getTime
()}
`
)
},
ua
:
req
.
get
(
'user-agent'
),
hostname
:
os
.
hostname
(),
...
...
@@ -51,6 +55,12 @@ const getContext = (req) => {
udid
:
_
.
get
(
req
,
'cookies.udid'
,
'yoho'
),
path
:
`
[
$
{
req
.
method
}]
$
{
routeEncode
.
getRouter
(
req
)}
`
,
};
if
(
!
isProd
)
{
res
.
env
.
unProd
=
true
;
}
return
res
;
};
const
handlerError
=
(
err
=
{},
req
,
res
,
next
)
=>
{
...
...
Please
register
or
login
to post a comment