提交 6a708192 编写于 作者: M mehaotian

fix(stat): 修复统计在上报失败后,请求报错的 Bug

上级 ef75c1ec
...@@ -652,12 +652,9 @@ class Util { ...@@ -652,12 +652,9 @@ class Util {
// } // }
}, },
fail: (e) => { fail: (e) => {
// if (process.env.NODE_ENV === 'development') {
// console.log('stat request fail', e);
// }
if (++this._retry < 3) { if (++this._retry < 3) {
setTimeout(() => { setTimeout(() => {
this.request(data); this._sendRequest(optionsData);
}, 1000); }, 1000);
} }
} }
...@@ -867,10 +864,10 @@ const lifecycle = { ...@@ -867,10 +864,10 @@ const lifecycle = {
}; };
function main() { function main() {
const Vue = require('vue');
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
uni.report = function(type, options) {}; uni.report = function(type, options) {};
}else{ }else{
const Vue = require('vue');
(Vue.default || Vue).mixin(lifecycle); (Vue.default || Vue).mixin(lifecycle);
uni.report = function(type, options) { uni.report = function(type, options) {
stat.sendEvent(type, options); stat.sendEvent(type, options);
......
...@@ -40,10 +40,10 @@ const lifecycle = { ...@@ -40,10 +40,10 @@ const lifecycle = {
} }
function main() { function main() {
const Vue = require('vue');
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
uni.report = function(type, options) {}; uni.report = function(type, options) {};
}else{ }else{
const Vue = require('vue');
(Vue.default || Vue).mixin(lifecycle); (Vue.default || Vue).mixin(lifecycle);
uni.report = function(type, options) { uni.report = function(type, options) {
stat.sendEvent(type, options); stat.sendEvent(type, options);
......
...@@ -387,12 +387,9 @@ class Util { ...@@ -387,12 +387,9 @@ class Util {
// } // }
}, },
fail: (e) => { fail: (e) => {
// if (process.env.NODE_ENV === 'development') {
// console.log('stat request fail', e);
// }
if (++this._retry < 3) { if (++this._retry < 3) {
setTimeout(() => { setTimeout(() => {
this.request(data); this._sendRequest(optionsData);
}, 1000); }, 1000);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册