Commit c4b14292 by 程默

fix 12

parent 27594e00
......@@ -24,6 +24,7 @@
},
"dependencies": {
"flyio": "^0.6.14",
"mayi-analytics": "^1.1.11",
"mpvue": "^2.0.0",
"vuex": "^3.0.1"
},
......
<script>
// let mpAnalytics=require('../node_modules/mayi-analytics/dist/');
let systemInfo;
try {
systemInfo = wx.getSystemInfoSync();
} catch (e) {
// Do something when catch error
}
let mpAnalytics = require("../node_modules/mayi-analytics/dist/mayi.mpAnalytics.js")
.default;
mpAnalytics.init({
url: "https://analytics.mayi888.cn/ma.gif",
app:"mayi-mp-shop",//项目名称
wx
});
export default {
created() {
// NODE_ENV
......@@ -36,54 +37,13 @@ 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",
success: function(res) {
console.log("上报成功", res);
},
fail: function(res) {
console.log("上报失败", res);
onError(data) {
console.log(data, "js异常捕获");
mpAnalytics.recordError({
data,
extendsInfo: {
mixid: this.$store.state.mixid || null
}
});
}
......
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