Commit 27594e00 by 程默

fix 错误上报信息

parent 37b3e1ab
<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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment