Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
37b3e1ab
Commit
37b3e1ab
authored
Jul 03, 2020
by
程默
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加全局js异常监控上报
parent
163775df
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
28 deletions
+37
-28
src/App.vue
+37
-28
No files found.
src/App.vue
View file @
37b3e1ab
<
script
>
// let mpAnalytics=require('../node_modules/mayi-analytics/dist/');
export
default
{
created
()
{
// NODE_ENV
let
extConfig
=
wx
.
getExtConfigSync
?
wx
.
getExtConfigSync
():
{}
if
(
process
.
env
.
NODE_ENV
==
"development"
)
{
created
()
{
// NODE_ENV
let
extConfig
=
wx
.
getExtConfigSync
?
wx
.
getExtConfigSync
()
:
{};
if
(
process
.
env
.
NODE_ENV
==
"development"
)
{
extConfig
=
{
mixid
:
'antgood'
}
}
this
.
$store
.
commit
(
"setExtConfig"
,
extConfig
.
mixid
);
// if (wx.getExtConfig) {
// wx.getExtConfig({
// success : (res) => {
// if(res.errMsg == 'getExtConfig: ok'){
// this.$store.commit("setExtConfig", res.extConfig.mixid);
// }
// }
// })
// }
// 调用API从本地缓存中获取数据
/*
* 平台 api 差异的处理方式: api 方法统一挂载到 mpvue 名称空间, 平台判断通过 mpvuePlatform 特征字符串
...
...
@@ -27,24 +17,43 @@ export default {
* 支付宝(蚂蚁):mpvue === my, mpvuePlatform === 'my'
*/
let
logs
if
(
mpvuePlatform
===
'my'
)
{
logs
=
mpvue
.
getStorageSync
({
key
:
'logs'
}).
data
||
[]
logs
.
unshift
(
Date
.
now
())
let
logs
;
if
(
mpvuePlatform
===
"my"
)
{
logs
=
mpvue
.
getStorageSync
({
key
:
"logs"
}).
data
||
[];
logs
.
unshift
(
Date
.
now
())
;
mpvue
.
setStorageSync
({
key
:
'logs'
,
key
:
"logs"
,
data
:
logs
})
})
;
}
else
{
logs
=
mpvue
.
getStorageSync
(
'logs'
)
||
[]
logs
.
unshift
(
Date
.
now
())
mpvue
.
setStorageSync
(
'logs'
,
logs
)
logs
=
mpvue
.
getStorageSync
(
"logs"
)
||
[];
logs
.
unshift
(
Date
.
now
())
;
mpvue
.
setStorageSync
(
"logs"
,
logs
);
}
},
log
()
{
console
.
log
(
`log at:
${
Date
.
now
()}
`
)
onError
(
err
)
{
console
.
log
(
err
,
"js异常捕获"
);
wx
.
request
({
url
:
"https://analytics.mayi888.cn/ma.gif"
,
data
:
{
e
:
"mp_error"
,
logInfo
:
{
err
}
}
},
method
:
"GET"
,
success
:
function
(
res
)
{
console
.
log
(
"上报成功"
,
res
);
},
fail
:
function
(
res
)
{
console
.
log
(
"上报失败"
,
res
);
}
});
},
log
()
{
console
.
log
(
`log at:
${
Date
.
now
()}
`
);
}
};
</
script
>
<
style
>
...
...
@@ -66,5 +75,5 @@ export default {
}
@import
url("../static/font/iconfont.css")
;
@import
url(
'../static/css/common.scss'
)
;
@import
url(
"../static/css/common.scss"
)
;
</
style
>
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