Commit 7e1b81e3073e10ae2b2425a6f0061a2a07855c5d

Authored by vking
1 parent c1638503

测速上报

@@ -70,6 +70,8 @@ Page({ @@ -70,6 +70,8 @@ Page({
70 hasGetLocation:false,//定位信息 70 hasGetLocation:false,//定位信息
71 hasAppHide:false,//app切至后台 71 hasAppHide:false,//app切至后台
72 onLoad: async function (options) { 72 onLoad: async function (options) {
  73 + this.reportTime=new Date()
  74 +
73 this.hasOnLoad=true; 75 this.hasOnLoad=true;
74 // this.qqmapsdk=new QQMapWX({ 76 // this.qqmapsdk=new QQMapWX({
75 // key: 'SDEBZ-I74W4-QLGUX-XXYXU-HIR23-3QFBJ' 77 // key: 'SDEBZ-I74W4-QLGUX-XXYXU-HIR23-3QFBJ'
@@ -130,6 +132,9 @@ Page({ @@ -130,6 +132,9 @@ Page({
130 }, 132 },
131 mapDataLast:null,//最后一次成功视角,防止地图视角丢失 133 mapDataLast:null,//最后一次成功视角,防止地图视角丢失
132 onReady: function () { 134 onReady: function () {
  135 + if (wx.canIUse('reportPerformance')) {
  136 + wx.reportPerformance(2002, new Date()-this.reportTime)
  137 + }
133 this.mapCtx = wx.createMapContext('map') 138 this.mapCtx = wx.createMapContext('map')
134 // this.mapCtx.moveToLocation({ 139 // this.mapCtx.moveToLocation({
135 // success:(res)=>{ 140 // success:(res)=>{
@@ -147,7 +147,8 @@ function rpc(host = '', act, data = {}, fouce = false, header = {}, silence = tr @@ -147,7 +147,8 @@ function rpc(host = '', act, data = {}, fouce = false, header = {}, silence = tr
147 'content-type': 'application/x-www-form-urlencoded' 147 'content-type': 'application/x-www-form-urlencoded'
148 }, 148 },
149 success: function (res) { 149 success: function (res) {
150 - console.log('request.api[' + (new Date() - stime) + 'ms]==>', host + cache_key + '\nrequest.success', res.data); 150 + let hs=(new Date() - stime)
  151 + console.log('request.api[' + hs + 'ms]==>', host + cache_key + '\nrequest.success', res.data);
151 // return; 152 // return;
152 //bot.msg({url: host + cache_key, res: res.data}) 153 //bot.msg({url: host + cache_key, res: res.data})
153 if (res.data) { 154 if (res.data) {
@@ -193,6 +194,10 @@ function rpc(host = '', act, data = {}, fouce = false, header = {}, silence = tr @@ -193,6 +194,10 @@ function rpc(host = '', act, data = {}, fouce = false, header = {}, silence = tr
193 } 194 }
194 }, 195 },
195 complete: function () { 196 complete: function () {
  197 + let hs=(new Date() - stime)
  198 + if (wx.canIUse('reportPerformance')) {
  199 + wx.reportPerformance(1001, hs)
  200 + }
196 wx.hideLoading(); 201 wx.hideLoading();
197 } 202 }
198 }) 203 })