From 44a941c72abc2b97ca34c831e780112c5cd4b657 Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Tue, 4 Jun 2019 20:26:33 +0800 Subject: [PATCH] fixed send user stats issue --- frontend/src/main.js | 16 +++++++++------- frontend/src/views/spider/SpiderList.vue | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/frontend/src/main.js b/frontend/src/main.js index a3008fae..f71efae5 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -33,13 +33,15 @@ Vue.use(ElementUI, { locale }) Vue.config.productionTip = false // 百度统计 -window._hmt = window._hmt || []; -(function () { - let hm = document.createElement('script') - hm.src = 'https://hm.baidu.com/hm.js?c35e3a563a06caee2524902c81975add' - let s = document.getElementsByTagName('script')[0] - s.parentNode.insertBefore(hm, s) -})() +if (localStorage.getItem('useStats') !== '0') { + window._hmt = window._hmt || []; + (function () { + let hm = document.createElement('script') + hm.src = 'https://hm.baidu.com/hm.js?c35e3a563a06caee2524902c81975add' + let s = document.getElementsByTagName('script')[0] + s.parentNode.insertBefore(hm, s) + })() +} // inject request api Vue.prototype.$request = request diff --git a/frontend/src/views/spider/SpiderList.vue b/frontend/src/views/spider/SpiderList.vue index afc4d365..4b9fa610 100644 --- a/frontend/src/views/spider/SpiderList.vue +++ b/frontend/src/views/spider/SpiderList.vue @@ -401,7 +401,7 @@ export default { }) }, onView (row) { - this.$router.push('/spiders/' + row._id) + this.$router.push('/spiders/' + row._id) this.$st.sendEv('爬虫', '查看') }, onPageChange () {