|
@@ -31,18 +31,18 @@
|
|
|
vehicleNumber: "",
|
|
|
driverName: "",
|
|
|
interval: "",
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
}],
|
|
|
//网络货运信息定位
|
|
|
appId: "", //网络货运企业APP的唯一标识
|
|
|
appSecurity: "", //网络货运企业在省平台申请的接入安全码
|
|
|
enterpriseSenderCode: "23106960", //网络货运企业在省平台申请的企业发送代码
|
|
|
environment: "debug", //环境:“debug”接入测试环境,“release”接入正式环境。
|
|
|
-
|
|
|
- }},
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
- ...mapMutations(['login',"firstAuthentication"]),
|
|
|
+ ...mapMutations(['login', "firstAuthentication"]),
|
|
|
// vue的method里编写如下代码
|
|
|
// async requestAndroidPermission(permisionID) {
|
|
|
// var result = await permision.requestAndroidPermission(permisionID)
|
|
@@ -59,58 +59,68 @@
|
|
|
// }
|
|
|
// },
|
|
|
restart() { //开启定位
|
|
|
- var remark = "测试";//备注
|
|
|
- let that = this
|
|
|
- sdkwx.restart(this.shippingNoteInfos[0].vehicleNumber, this.shippingNoteInfos[0].driverName,remark, this.shippingNoteInfos, function(res) {
|
|
|
- if (res.type == "onSuccess") {
|
|
|
- //成功
|
|
|
- console.log("开启定位成功!!!")
|
|
|
- console.log(res)
|
|
|
- var shippingNoteInfos = res.data[0]; //运单信息列表
|
|
|
- console.log(shippingNoteInfos,"sdassss")
|
|
|
- if(shippingNoteInfos){
|
|
|
- let dateTtime = Number(shippingNoteInfos.interval+1000)
|
|
|
- console.log("开始定时",dateTtime)
|
|
|
- that.timer = setInterval(() => {
|
|
|
+ var remark = "测试"; //备注
|
|
|
+ let that = this
|
|
|
+ sdkwx.restart(this.shippingNoteInfos[0].vehicleNumber, this.shippingNoteInfos[0].driverName, remark, this
|
|
|
+ .shippingNoteInfos,
|
|
|
+ function(res) {
|
|
|
+ if (res.type == "onSuccess") {
|
|
|
+ //成功
|
|
|
+ console.log("开启定位成功!!!")
|
|
|
+ console.log(res)
|
|
|
+ var shippingNoteInfos = res.data[0]; //运单信息列表
|
|
|
+ console.log(shippingNoteInfos, "sdassss")
|
|
|
+ if (shippingNoteInfos) {
|
|
|
+ let dateTtime = Number(shippingNoteInfos.interval + 1000)
|
|
|
+ console.log("开始定时", dateTtime)
|
|
|
+ that.timer = setInterval(() => {
|
|
|
+ console.log("定时")
|
|
|
+ that.send()
|
|
|
+ }, dateTtime);
|
|
|
+ }
|
|
|
+ } else if (res.type == "onFailure") {
|
|
|
+ //失败
|
|
|
+ console.log("开启定位失败!!!")
|
|
|
+ console.log(res)
|
|
|
+ var errorCode = res.data.errorCode; //错误码
|
|
|
+ var errorMsg = res.data.errorMsg; //错误描述
|
|
|
+ that.timer = setInterval(() => { //失败也需要定时发送定位
|
|
|
console.log("定时")
|
|
|
that.send()
|
|
|
- }, dateTtime);
|
|
|
+ }, 915204); //15分钟
|
|
|
}
|
|
|
- } else if (res.type == "onFailure") {
|
|
|
- //失败
|
|
|
- console.log("开启定位失败!!!")
|
|
|
- console.log(res)
|
|
|
- var errorCode = res.data.errorCode; //错误码
|
|
|
- var errorMsg = res.data.errorMsg; //错误描述
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
},
|
|
|
- send(){//发送定位
|
|
|
+ send() { //发送定位
|
|
|
var remark = ""
|
|
|
var that = this
|
|
|
- console.log("send参数",this.shippingNoteInfos)
|
|
|
- sdkwx.send(this.shippingNoteInfos[0].vehicleNumber, this.shippingNoteInfos[0].driverName,remark, this.shippingNoteInfos, function(res){
|
|
|
-
|
|
|
- if (res.type == "onSuccess") {
|
|
|
- console.log("App.vue发送定位成功")
|
|
|
- console.log(res);
|
|
|
- var shippingNoteInfos = res.data[0];//运单信息列表
|
|
|
- if(shippingNoteInfos){
|
|
|
- let dateTime = Number(shippingNoteInfos.interval+1000)
|
|
|
- console.log("定时开始",dateTime)
|
|
|
- that.timer = setInterval(() => {
|
|
|
- //TODO
|
|
|
+ console.log("send参数", this.shippingNoteInfos)
|
|
|
+ sdkwx.send(this.shippingNoteInfos[0].vehicleNumber, this.shippingNoteInfos[0].driverName, remark, this
|
|
|
+ .shippingNoteInfos,
|
|
|
+ function(res) {
|
|
|
+ if (res.type == "onSuccess") {
|
|
|
+ console.log("App.vue发送定位成功")
|
|
|
+ console.log(res);
|
|
|
+ var shippingNoteInfos = res.data[0]; //运单信息列表
|
|
|
+ if (shippingNoteInfos) {
|
|
|
+ let dateTime = Number(shippingNoteInfos.interval + 1000)
|
|
|
+ console.log("定时开始", dateTime)
|
|
|
+ that.timer = setInterval(() => {
|
|
|
+ //TODO
|
|
|
+ that.send()
|
|
|
+ }, dateTime);
|
|
|
+ }
|
|
|
+ } else if (res.type == "onFailure") {
|
|
|
+ console.log("App.vue发送定位失败", res)
|
|
|
+ //失败
|
|
|
+ var errorCode = res.data.errorCode; //错误码
|
|
|
+ var errorMsg = res.data.errorMsg; //错误描述
|
|
|
+ that.timer = setInterval(() => { //失败也需要定时上传定位(为了解决频繁调用接口问题)
|
|
|
+ //TODO
|
|
|
that.send()
|
|
|
- },dateTime);
|
|
|
+ }, 915204);
|
|
|
}
|
|
|
- } else if (res.type == "onFailure"){
|
|
|
- console.log("App.vue发送定位失败",res)
|
|
|
- //失败
|
|
|
- var errorCode = res.data.errorCode;//错误码
|
|
|
- var errorMsg = res.data.errorMsg;//错误描述
|
|
|
- }
|
|
|
-
|
|
|
- });
|
|
|
+ });
|
|
|
},
|
|
|
auth() { //授权
|
|
|
let phoneType = uni.getSystemInfoSync().platform //判断手机类型
|
|
@@ -125,7 +135,7 @@
|
|
|
sdkwx.auth(this.appId, this.appSecurity, this.enterpriseSenderCode, this.environment, function(res) {
|
|
|
if (res.type == "onSuccess") {
|
|
|
//成功
|
|
|
- if(res.data.length > 0){
|
|
|
+ if (res.data.length > 0) {
|
|
|
that.restart()
|
|
|
}
|
|
|
console.log("授权成功")
|
|
@@ -202,7 +212,7 @@
|
|
|
okText: '退出程序',
|
|
|
infoAlignment: 'center',
|
|
|
radius: 10,
|
|
|
- // cancelText: '否',
|
|
|
+ // cancelText: '否',
|
|
|
showCancel: false,
|
|
|
okButtonColor: '#2772FB'
|
|
|
};
|
|
@@ -275,26 +285,36 @@
|
|
|
// #ifdef APP-PLUS
|
|
|
var that = this
|
|
|
//判断该用户是否需要开启持续定位
|
|
|
- if(uni.getStorageSync('userInfo')){
|
|
|
- this.$request.baseRequest('get', '/orderInfo/getData', {
|
|
|
- commonId:uni.getStorageSync('userInfo').id,
|
|
|
- }).then(res1 => {
|
|
|
- console.log("/orderInfo/getData",res1.data)
|
|
|
- if(res1.data.length>0){
|
|
|
+ if (uni.getStorageSync('userInfo')) {
|
|
|
+ this.$request.baseRequest('get', '/orderInfo/getData', {
|
|
|
+ commonId: uni.getStorageSync('userInfo').id,
|
|
|
+ }).then(res1 => {
|
|
|
+ console.log("/orderInfo/getData", res1.data)
|
|
|
+ if (res1.data.length > 0) {
|
|
|
this.shippingNoteInfos[0].shippingNoteNumber = res1.data[0].orderNo //运单号
|
|
|
this.shippingNoteInfos[0].serialNumber = "0000" //分单号
|
|
|
- this.shippingNoteInfos[0].startCountrySubdivisionCode = res1.data[0].sendAdCode //起点位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
|
|
|
- this.shippingNoteInfos[0].endCountrySubdivisionCode = res1.data[0].unsendAdCode //到达位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
|
|
|
- this.shippingNoteInfos[0].startLongitude = res1.data[0].sendLongitude //起点位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
- this.shippingNoteInfos[0].startLatitude = res1.data[0].sendLatitude //起点位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
- this.shippingNoteInfos[0].endLongitude = res1.data[0].unsendLongitude //到达位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
- this.shippingNoteInfos[0].endLatitude = res1.data[0].unsendLatitude //到达位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
- this.shippingNoteInfos[0].driverName = res1.data[0].driverName //司机姓名,SDK 回调返回, 调用 start/stop/pause/restart/ 必填,send 时非必填
|
|
|
- this.shippingNoteInfos[0].vehicleNumber = res1.data[0].carNumber //车牌号,SDK 回调返回,调 用 start/stop/pause/restart/必 填,send 时非必填
|
|
|
- this.shippingNoteInfos[0].startLocationText = res1.data[0].sendCity //起点地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
- this.shippingNoteInfos[0].endLocationText = res1.data[0].unloadCity //到达地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
+ this.shippingNoteInfos[0].startCountrySubdivisionCode = res1.data[0]
|
|
|
+ .sendAdCode //起点位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
|
|
|
+ this.shippingNoteInfos[0].endCountrySubdivisionCode = res1.data[0]
|
|
|
+ .unsendAdCode //到达位置行政区划代码,调 用 start/stop/pause/restart 时 必填,调用 send 非必填
|
|
|
+ this.shippingNoteInfos[0].startLongitude = res1.data[0]
|
|
|
+ .sendLongitude //起点位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
+ this.shippingNoteInfos[0].startLatitude = res1.data[0]
|
|
|
+ .sendLatitude //起点位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
+ this.shippingNoteInfos[0].endLongitude = res1.data[0]
|
|
|
+ .unsendLongitude //到达位置经度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
+ this.shippingNoteInfos[0].endLatitude = res1.data[0]
|
|
|
+ .unsendLatitude //到达位置纬度,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
+ this.shippingNoteInfos[0].driverName = res1.data[0]
|
|
|
+ .driverName //司机姓名,SDK 回调返回, 调用 start/stop/pause/restart/ 必填,send 时非必填
|
|
|
+ this.shippingNoteInfos[0].vehicleNumber = res1.data[0]
|
|
|
+ .carNumber //车牌号,SDK 回调返回,调 用 start/stop/pause/restart/必 填,send 时非必填
|
|
|
+ this.shippingNoteInfos[0].startLocationText = res1.data[0]
|
|
|
+ .sendCity //起点地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
+ this.shippingNoteInfos[0].endLocationText = res1.data[0]
|
|
|
+ .unloadCity //到达地址文字描述,调用 start/stop/pause/restart 时必 填,调用 send 非必填
|
|
|
this.shippingNoteInfos[0].interval = "5000"
|
|
|
- console.log("查看参数",this.shippingNoteInfos)
|
|
|
+ console.log("查看参数", this.shippingNoteInfos)
|
|
|
that.auth()
|
|
|
that.$helper.fUN_AmapLocation.start({
|
|
|
// intervalTime: 1000 * 60,
|
|
@@ -330,9 +350,10 @@
|
|
|
// console.log("条数", uni.getStorageSync('mapGJ').length)
|
|
|
if (uni.getStorageSync('mapGJ').length > 100) {
|
|
|
console.log(JSON.stringify(uni.getStorageSync('mapGJ')))
|
|
|
- this.$request.baseRequest('post', '/hyOrderTravelPath/api/addInfo', {
|
|
|
- orderId:"cdae6ec34c2349768c490a9fefa03fb3",
|
|
|
- longitudeLatitude:JSON.stringify(uni.getStorageSync('mapGJ'))
|
|
|
+ this.$request.baseRequest('post', '/hyOrderTravelPath/api/addInfo', {
|
|
|
+ orderId: "cdae6ec34c2349768c490a9fefa03fb3",
|
|
|
+ longitudeLatitude: JSON.stringify(uni.getStorageSync(
|
|
|
+ 'mapGJ'))
|
|
|
}).then(res => {
|
|
|
uni.removeStorageSync('mapGJ');
|
|
|
this.$helper.gjList = []
|
|
@@ -393,7 +414,7 @@
|
|
|
if (type == "android") {
|
|
|
appUpdate()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// plus.push.getClientInfoAsync((info) => {
|
|
|
// var name = 'clientId'
|
|
|
// var value = info.clientid
|