670 SOS转到服务端进行
This commit is contained in:
@ -9,11 +9,13 @@ function getdata(data,url,method){
|
|||||||
if(!method){
|
if(!method){
|
||||||
method='POST';
|
method='POST';
|
||||||
}
|
}
|
||||||
request({
|
let cfg={
|
||||||
url: url,
|
url: url,
|
||||||
method: method,
|
method: method,
|
||||||
data:data
|
data:data
|
||||||
}).then((res)=>{
|
};
|
||||||
|
|
||||||
|
request(cfg).then((res)=>{
|
||||||
console.log("res=",res);
|
console.log("res=",res);
|
||||||
resolve(res);
|
resolve(res);
|
||||||
}).catch(ex=>{
|
}).catch(ex=>{
|
||||||
@ -90,11 +92,22 @@ function getDetail(id){
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//发送SOS
|
||||||
|
function sendSos(data){
|
||||||
|
return request({
|
||||||
|
url: '/app/xinghan/device/SOSGradeSettings',
|
||||||
|
method: 'post',
|
||||||
|
data:data
|
||||||
|
})
|
||||||
|
}
|
||||||
export default{
|
export default{
|
||||||
sendUsr:sendUsr,
|
sendUsr:sendUsr,
|
||||||
warnMsg:warnMsg,
|
warnMsg:warnMsg,
|
||||||
sendPic:sendPic,
|
sendPic:sendPic,
|
||||||
getDetail:getDetail
|
getDetail:getDetail,
|
||||||
|
sendSos:sendSos,
|
||||||
|
getdata:getdata
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name" : "星汉物联",
|
"name" : "星汉物联",
|
||||||
"appid" : "__UNI__A21EF43",
|
"appid" : "__UNI__A21EF43",
|
||||||
"description" : "设备管控",
|
"description" : "设备管控",
|
||||||
"versionName" : "1.0.25",
|
"versionName" : "1.0.28",
|
||||||
"versionCode" : "100",
|
"versionCode" : "100",
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
|
|||||||
@ -52,8 +52,8 @@
|
|||||||
<view class="valueItem">
|
<view class="valueItem">
|
||||||
|
|
||||||
<view style="width:80%;float: right;text-align: right;" class="valueFont">
|
<view style="width:80%;float: right;text-align: right;" class="valueFont">
|
||||||
<uni-icons type="location" size="17"
|
<uni-icons type="location" size="17" color="rgba(255, 255, 255, 0.8)"
|
||||||
color="rgba(255, 255, 255, 0.8)" style="vertical-align: bottom;" />
|
style="vertical-align: bottom;" />
|
||||||
{{formData.address}}
|
{{formData.address}}
|
||||||
</view>
|
</view>
|
||||||
<view class="clear"></view>
|
<view class="clear"></view>
|
||||||
@ -449,7 +449,8 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
onLoad: function() {
|
onLoad: function() {
|
||||||
// console.log("670页面加载");
|
|
||||||
|
|
||||||
these = this;
|
these = this;
|
||||||
recei = BleReceive.getBleReceive();
|
recei = BleReceive.getBleReceive();
|
||||||
ble = BleTool.getBleTool();
|
ble = BleTool.getBleTool();
|
||||||
@ -718,8 +719,9 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
sendMQ(message) {
|
sendMQ(json, url) {
|
||||||
message = JSON.stringify(message);
|
|
||||||
|
let message = JSON.stringify(json);
|
||||||
console.log("imei=", this.formData.imei ? this.formData.imei : this.device.deviceImei);
|
console.log("imei=", this.formData.imei ? this.formData.imei : this.device.deviceImei);
|
||||||
const topic = `B/${this.formData.imei?this.formData.imei:this.device.deviceImei}`;
|
const topic = `B/${this.formData.imei?this.formData.imei:this.device.deviceImei}`;
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@ -747,6 +749,8 @@
|
|||||||
reject(error);
|
reject(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
parseDataMQ(json) {
|
parseDataMQ(json) {
|
||||||
let receiveData = {};
|
let receiveData = {};
|
||||||
@ -1137,7 +1141,9 @@
|
|||||||
let requestSend = () => {
|
let requestSend = () => {
|
||||||
this.sendMQ(json).then((res) => {
|
this.sendMQ(json).then((res) => {
|
||||||
console.log("4g发送成功");
|
console.log("4g发送成功");
|
||||||
|
json.deviceId = these.device.id;
|
||||||
|
json.deviceImei = these.device.deviceImei;
|
||||||
|
api.sendSos(json);
|
||||||
|
|
||||||
}).catch((ex) => {
|
}).catch((ex) => {
|
||||||
console.log("ex=", ex);
|
console.log("ex=", ex);
|
||||||
|
|||||||
Reference in New Issue
Block a user