Commit 3507389f by 程默

添加监控

parent c4b14292
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
"url-loader": "^1.0.1", "url-loader": "^1.0.1",
"vue-style-loader": "^4.1.0", "vue-style-loader": "^4.1.0",
"webpack": "^3.11.0", "webpack": "^3.11.0",
"webpack-bundle-analyzer": "^2.2.1", "webpack-bundle-analyzer": "^2.13.1",
"webpack-dev-middleware-hard-disk": "^1.12.0", "webpack-dev-middleware-hard-disk": "^1.12.0",
"webpack-merge": "^4.1.0", "webpack-merge": "^4.1.0",
"webpack-mpvue-asset-plugin": "^2.0.0", "webpack-mpvue-asset-plugin": "^2.0.0",
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
}, },
"miniprogramRoot": "dist/wx/", "miniprogramRoot": "dist/wx/",
"compileType": "miniprogram", "compileType": "miniprogram",
"appid": "wxae95a07ffdf11548", "appid": "wx8a509d2f2ac15903",
"projectname": "mayi-mp-shop", "projectname": "mayi-mp-shop",
"simulatorType": "wechat", "simulatorType": "wechat",
"simulatorPluginLibVersion": {}, "simulatorPluginLibVersion": {},
......
<script> <script>
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 { export default {
created() { created() {
...@@ -40,7 +33,7 @@ export default { ...@@ -40,7 +33,7 @@ export default {
}, },
onError(data) { onError(data) {
console.log(data, "js异常捕获"); console.log(data, "js异常捕获");
mpAnalytics.recordError({ this.$mpAnalytics.recordError({
data, data,
extendsInfo: { extendsInfo: {
mixid: this.$store.state.mixid || null mixid: this.$store.state.mixid || null
......
...@@ -4,7 +4,17 @@ import Store from './store/index' ...@@ -4,7 +4,17 @@ import Store from './store/index'
Vue.config.productionTip = false Vue.config.productionTip = false
App.mpType = 'app' App.mpType = 'app'
Vue.prototype.$store=Store Vue.prototype.$store = Store
//异常监控(行为收集)
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
});
Vue.prototype.$mpAnalytics = mpAnalytics;
const app = new Vue(App) const app = new Vue(App)
app.$mount() app.$mount()
...@@ -314,10 +314,16 @@ export default { ...@@ -314,10 +314,16 @@ export default {
handleLoad(){ handleLoad(){
console.log('网页加载成功'); console.log('网页加载成功');
}, },
handleError(){ handleError(data){
wx.showLoading({ wx.showLoading({
title: "网页加载失败 请右上角刷新" title: "网页加载失败 请右上角刷新"
}); });
this.$mpAnalytics.recordError({
data,
extendsInfo: {
mixid: this.$store.state.mixid || null
}
});
}, },
checkPageUrl(val) { checkPageUrl(val) {
for (let i = 0; i < this.sharePageList.length; i++) { for (let i = 0; i < this.sharePageList.length; i++) {
......
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