Commit c4b14292 by 程默

fix 12

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