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
27594e00
Commit
27594e00
authored
Jul 03, 2020
by
程默
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 错误上报信息
parent
37b3e1ab
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
4 deletions
+38
-4
src/App.vue
+38
-4
No files found.
src/App.vue
View file @
27594e00
<
script
>
// let mpAnalytics=require('../node_modules/mayi-analytics/dist/');
let
systemInfo
;
try
{
systemInfo
=
wx
.
getSystemInfoSync
();
}
catch
(
e
)
{
// Do something when catch error
}
export
default
{
created
()
{
// NODE_ENV
let
extConfig
=
wx
.
getExtConfigSync
?
wx
.
getExtConfigSync
()
:
{};
if
(
process
.
env
.
NODE_ENV
==
"development"
)
{
extConfig
=
{
mixid
:
'antgood'
}
extConfig
=
{
mixid
:
"antgood"
};
}
this
.
$store
.
commit
(
"setExtConfig"
,
extConfig
.
mixid
);
// 调用API从本地缓存中获取数据
...
...
@@ -30,15 +36,46 @@ export default {
logs
.
unshift
(
Date
.
now
());
mpvue
.
setStorageSync
(
"logs"
,
logs
);
}
//----------
// const originRequest = wx.request;
// Object.defineProperty(wx, "request", {
// configurable: true,
// enumerable: true,
// writable: true,
// value: function() {
// const config = arguments[0] || {};
// const url = config.url;
// if (url.indexOf(process.env.BASE_URL) > -1) {
// // 直接发送请求,不上报
// return originRequest.apply(this, arguments);
// }
// console.log("上报ajax数据啦!");
// // wx.request({
// // url: "https://analytics.mayi888.cn/ma.gif",
// // data: config.data
// // });
// return originRequest.apply(this, arguments);
// }
// });
},
onError
(
err
)
{
console
.
log
(
err
,
"js异常捕获"
);
wx
.
request
({
url
:
"https://analytics.mayi888.cn/ma.gif"
,
data
:
{
v
:
Date
.
now
(),
e
:
"mp_error"
,
category
:
"js_error"
,
logType
:
"Error"
,
extendsInfo
:
{
mixid
:
this
.
$store
.
state
.
mixid
,
openid
:
wx
.
getStorageSync
(
"openid"
)
||
null
},
logInfo
:
{
err
},
deviceInfo
:
{
...
systemInfo
}
},
method
:
"GET"
,
...
...
@@ -49,9 +86,6 @@ export default {
console
.
log
(
"上报失败"
,
res
);
}
});
},
log
()
{
console
.
log
(
`log at:
${
Date
.
now
()}
`
);
}
};
</
script
>
...
...
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