diff --git a/app.js b/app.js index 9770329..152cdc6 100644 --- a/app.js +++ b/app.js @@ -188,6 +188,45 @@ App({ this.recordPatrolPoint(res); }); }, + async recordPatrolPoint(res) { + this.globalData.patrol.lastLocalTime = new Date().getTime(); + if ( + this.globalData.patrol.lastLocalTime - + this.globalData.patrol.lastUploadTime < + this.globalData.patrol.carmDown * 1000 + ) { + return "还不到时候"; + } + this.globalData.patrol.lastUploadTime = new Date().getTime(); + + const { + patrol: { staffPatrolRecId, serialNum }, + } = this.globalData; + + const data= await api.post( + "epmetuser/staffpatrol/uploaddetail", + { + staffPatrolRecId, + serialNum, + latitude: res.latitude, + longitude: res.longitude, + speed: res.speed, + accuracy: res.accuracy, + altitude: res.altitude, + verticalAccuracy: res.verticalAccuracy, + horizontalAccuracy: res.horizontalAccuracy, + }, + { + // isMock: true, + isQuiet: true, + } + ); + + if (data.code === 0) { + this.globalData.patrol.serialNum += 1; + console.log("---------------实时位置监听point: ", this.globalData.patrol); + } + }, async closePatrol(patrolEndTime = "") { const { patrol: { status },