小鹿骑行
This commit is contained in:
parent
0ff5c2f639
commit
31fd6cfb04
|
|
@ -1,9 +1,9 @@
|
||||||
const install = (Vue, vm) => {
|
const install = (Vue, vm) => {
|
||||||
uni.setStorageSync('deptId', 100);
|
uni.setStorageSync('deptId', 100);
|
||||||
Vue.prototype.$u.http.setConfig({
|
Vue.prototype.$u.http.setConfig({
|
||||||
// baseUrl: 'http://192.168.2.14:4101', //键辉本地
|
baseUrl: 'http://192.168.2.14:4101', //键辉本地
|
||||||
// baseUrl: 'http://192.168.0.102:4101', //景森本地
|
// baseUrl: 'http://192.168.0.102:4101', //景森本地
|
||||||
baseUrl: 'https://ele.ccttiot.com/prod-api', //线上
|
// baseUrl: 'https://ele.ccttiot.com/prod-api', //线上
|
||||||
loadingText: '努力加载中~',
|
loadingText: '努力加载中~',
|
||||||
loadingTime: 10000,
|
loadingTime: 10000,
|
||||||
// 设置自定义头部content-type
|
// 设置自定义头部content-type
|
||||||
|
|
|
||||||
|
|
@ -89,11 +89,12 @@
|
||||||
{{qbobj.device.statusCount[6] == null ? '0' : qbobj.device.statusCount[6]}}
|
{{qbobj.device.statusCount[6] == null ? '0' : qbobj.device.statusCount[6]}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="cont" @click="changeidx('9')">
|
|
||||||
<view class="text" :class="statusidx==9?'act1':''">
|
<view class="cont" @click="changeidx('20')">
|
||||||
|
<view class="text" :class="statusidx==20?'act1':''">
|
||||||
离线
|
离线
|
||||||
</view>
|
</view>
|
||||||
<view class="text" :class="statusidx==9?'act1':''">
|
<view class="text" :class="statusidx==20?'act1':''">
|
||||||
{{qbobj.device.onlineStatusCount[0] == null ? '0' : qbobj.device.onlineStatusCount[0]}}
|
{{qbobj.device.onlineStatusCount[0] == null ? '0' : qbobj.device.onlineStatusCount[0]}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -105,6 +106,14 @@
|
||||||
{{qbobj.device.onlineStatusCount[1] == null ? '0' : qbobj.device.onlineStatusCount[1]}}
|
{{qbobj.device.onlineStatusCount[1] == null ? '0' : qbobj.device.onlineStatusCount[1]}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="cont" @click="changeidx('9')">
|
||||||
|
<view class="text" :class="statusidx==9?'act1':''">
|
||||||
|
强制锁车
|
||||||
|
</view>
|
||||||
|
<view class="text" :class="statusidx==9?'act1':''">
|
||||||
|
{{qbobj.device.onlineStatusCount[9] == null ? '0' : qbobj.device.onlineStatusCount[9]}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="cont" @click="changeidx('7')">
|
<view class="cont" @click="changeidx('7')">
|
||||||
<view class="text" :class="statusidx==7?'act1':''">
|
<view class="text" :class="statusidx==7?'act1':''">
|
||||||
全部设备
|
全部设备
|
||||||
|
|
@ -179,11 +188,7 @@
|
||||||
status4: [], //临时锁车
|
status4: [], //临时锁车
|
||||||
status8: [], //下线
|
status8: [], //下线
|
||||||
status9: [], //离线
|
status9: [], //离线
|
||||||
markdata: {
|
markdata: {},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
statusidx: '7',
|
statusidx: '7',
|
||||||
deviceNum: {},
|
deviceNum: {},
|
||||||
areaId: 0,
|
areaId: 0,
|
||||||
|
|
@ -200,36 +205,28 @@
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.polyline = []
|
this.polyline = []
|
||||||
// this.allVehicleNum()
|
|
||||||
if (uni.getStorageSync('adminAreaid')) {
|
if (uni.getStorageSync('adminAreaid')) {
|
||||||
this.areaId = uni.getStorageSync('adminAreaid')
|
this.areaId = uni.getStorageSync('adminAreaid')
|
||||||
this.getArea()
|
this.getArea()
|
||||||
console.log(this.areaId);
|
console.log(this.areaId)
|
||||||
}
|
}
|
||||||
this.getqb()
|
this.getqb()
|
||||||
this.getmarks()
|
this.getmarks()
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
||||||
|
|
||||||
let that = this
|
let that = this
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'wgs84',
|
type: 'wgs84',
|
||||||
success: function(lb) {
|
success: function(lb) {
|
||||||
|
console.log(that.areaInfo, 'that.areaInfo')
|
||||||
console.log(that.areaInfo, 'that.areaInfo');
|
|
||||||
|
|
||||||
},
|
},
|
||||||
fail: function(error) {
|
fail: function(error) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '未获取到定位信息,请点击设置勾选允许位置信息,即可使用全部功能',
|
title: '未获取到定位信息,请点击设置勾选允许位置信息,即可使用全部功能',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
})
|
||||||
// that.getmarks()
|
|
||||||
// 在这里处理获取位置信息失败的情况
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
@ -269,10 +266,8 @@
|
||||||
|
|
||||||
|
|
||||||
onMapRegionChange(event) {
|
onMapRegionChange(event) {
|
||||||
// console.log('regionchange', event)
|
|
||||||
if (event.detail.type == 'end') {
|
if (event.detail.type == 'end') {
|
||||||
this.getCenterLocation()
|
this.getCenterLocation()
|
||||||
// this.getCenter()
|
|
||||||
}
|
}
|
||||||
// 你可以在这里执行你需要的操作
|
// 你可以在这里执行你需要的操作
|
||||||
},
|
},
|
||||||
|
|
@ -287,30 +282,30 @@
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getCenterLocation() {
|
getCenterLocation() {
|
||||||
const mapContext = uni.createMapContext('map');
|
const mapContext = uni.createMapContext('map')
|
||||||
mapContext.getCenterLocation({
|
mapContext.getCenterLocation({
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('中心点的经纬度:', res.longitude, res.latitude);
|
console.log('中心点的经纬度:', res.longitude, res.latitude)
|
||||||
this.getNearbyMarkers(res.latitude, res.longitude);
|
this.getNearbyMarkers(res.latitude, res.longitude)
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('获取中心点定位失败:', err);
|
console.error('获取中心点定位失败:', err)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
getCenter: function() {
|
getCenter: function() {
|
||||||
var _that = this;
|
var _that = this
|
||||||
appMap.getCurrentCenter(
|
appMap.getCurrentCenter(
|
||||||
function(state, point) {
|
function(state, point) {
|
||||||
if (0 == state) {
|
if (0 == state) {
|
||||||
// 反编码
|
// 反编码
|
||||||
var point = new plus.maps.Point(point["longitude"], point["latitude"]);
|
var point = new plus.maps.Point(point["longitude"], point["latitude"]);
|
||||||
plus.maps.Map.reverseGeocode(point, {}, function(event) {
|
plus.maps.Map.reverseGeocode(point, {}, function(event) {
|
||||||
var address = event.address; // 转换后的地理位置
|
var address = event.address // 转换后的地理位置
|
||||||
var coord = event.coord; // 转换后的坐标信息
|
var coord = event.coord // 转换后的坐标信息
|
||||||
var coordType = event.coordType; // 转换后的坐标系类型
|
var coordType = event.coordType // 转换后的坐标系类型
|
||||||
console.log("Address:" + address);
|
console.log("Address:" + address)
|
||||||
console.log("coord", coord);
|
console.log("coord", coord)
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: "提示",
|
title: "提示",
|
||||||
content: "确定:" + address + "?",
|
content: "确定:" + address + "?",
|
||||||
|
|
@ -321,11 +316,10 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
// console.log("Failed:" + JSON.stringify(e));
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '反编码失败' + JSON.stringify(e)
|
title: '反编码失败' + JSON.stringify(e)
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: "none",
|
icon: "none",
|
||||||
|
|
@ -333,11 +327,9 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
)
|
||||||
},
|
},
|
||||||
getNearbyMarkers(clickedLat, clickedLon) {
|
getNearbyMarkers(clickedLat, clickedLon) {
|
||||||
// console.log(clickedLat, clickedLon);
|
|
||||||
|
|
||||||
// 只有在 showdevList 为 true 的时候才显示圆形区域
|
// 只有在 showdevList 为 true 的时候才显示圆形区域
|
||||||
if (this.showdevList) {
|
if (this.showdevList) {
|
||||||
const nearbyMarkers = this.listData.filter(item => {
|
const nearbyMarkers = this.listData.filter(item => {
|
||||||
|
|
@ -347,17 +339,15 @@
|
||||||
parseFloat(clickedLon),
|
parseFloat(clickedLon),
|
||||||
parseFloat(item.latitude),
|
parseFloat(item.latitude),
|
||||||
parseFloat(item.longitude)
|
parseFloat(item.longitude)
|
||||||
);
|
)
|
||||||
return distance <= 100;
|
return distance <= 100
|
||||||
}
|
}
|
||||||
return false;
|
return false
|
||||||
});
|
})
|
||||||
|
|
||||||
// 根据 remainingPower 进行升序排序
|
// 根据 remainingPower 进行升序排序
|
||||||
nearbyMarkers.sort((a, b) => {
|
nearbyMarkers.sort((a, b) => {
|
||||||
return a.remainingPower - b.remainingPower;
|
return a.remainingPower - b.remainingPower
|
||||||
});
|
})
|
||||||
|
|
||||||
// 更新 circles 数组来绘制淡灰色的圆形区域
|
// 更新 circles 数组来绘制淡灰色的圆形区域
|
||||||
this.circles = [{
|
this.circles = [{
|
||||||
latitude: clickedLat,
|
latitude: clickedLat,
|
||||||
|
|
@ -367,9 +357,7 @@
|
||||||
radius: 100, // 圆的半径(单位:米)
|
radius: 100, // 圆的半径(单位:米)
|
||||||
strokeWidth: 1
|
strokeWidth: 1
|
||||||
}]
|
}]
|
||||||
|
this.nearbyMarkers = nearbyMarkers
|
||||||
this.nearbyMarkers = nearbyMarkers;
|
|
||||||
// console.log('Nearby markers within 100 meters:', nearbyMarkers);
|
|
||||||
} else {
|
} else {
|
||||||
// 当 showdevList 为 false 时,清空 circles 数组
|
// 当 showdevList 为 false 时,清空 circles 数组
|
||||||
this.circles = []
|
this.circles = []
|
||||||
|
|
@ -380,9 +368,7 @@
|
||||||
const toRad = angle => angle * Math.PI / 180
|
const toRad = angle => angle * Math.PI / 180
|
||||||
const dLat = toRad(lat2 - lat1)
|
const dLat = toRad(lat2 - lat1)
|
||||||
const dLon = toRad(lon2 - lon1)
|
const dLon = toRad(lon2 - lon1)
|
||||||
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
|
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2)
|
||||||
Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) *
|
|
||||||
Math.sin(dLon / 2) * Math.sin(dLon / 2)
|
|
||||||
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
|
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
|
||||||
return R * c
|
return R * c
|
||||||
},
|
},
|
||||||
|
|
@ -416,7 +402,7 @@
|
||||||
onlyFromCamera: true,
|
onlyFromCamera: true,
|
||||||
scanType: ['qrCode'],
|
scanType: ['qrCode'],
|
||||||
success: res => {
|
success: res => {
|
||||||
console.log(res);
|
console.log(res)
|
||||||
function getQueryParam(url, paramName) {
|
function getQueryParam(url, paramName) {
|
||||||
let regex = new RegExp(`[?&]${paramName}=([^&]*)`)
|
let regex = new RegExp(`[?&]${paramName}=([^&]*)`)
|
||||||
let results = regex.exec(url)
|
let results = regex.exec(url)
|
||||||
|
|
@ -425,7 +411,7 @@
|
||||||
let sceneValue = res.result
|
let sceneValue = res.result
|
||||||
let decodedValue = decodeURIComponent(sceneValue)
|
let decodedValue = decodeURIComponent(sceneValue)
|
||||||
this.sn = getQueryParam(decodedValue, 's')
|
this.sn = getQueryParam(decodedValue, 's')
|
||||||
console.log(this.sn,'....');
|
console.log(this.sn,'....')
|
||||||
if (this.sn != '') {
|
if (this.sn != '') {
|
||||||
this.$u.get('/bst/device?sn=' + this.sn).then((res) => {
|
this.$u.get('/bst/device?sn=' + this.sn).then((res) => {
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
|
|
@ -439,7 +425,7 @@
|
||||||
title: '无效车辆',
|
title: '无效车辆',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
@ -465,20 +451,6 @@
|
||||||
url: '/page_shanghu/gongzuotai/woke_deviceMgmt'
|
url: '/page_shanghu/gongzuotai/woke_deviceMgmt'
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
// allVehicleNum() {
|
|
||||||
// let data = {
|
|
||||||
// powerStart: this.rangeValue[0],
|
|
||||||
// powerEnd: this.rangeValue[1],
|
|
||||||
// areaId: this.areaId
|
|
||||||
// }
|
|
||||||
// this.$u.get('/appVerify/allVehicleNum?', data).then((res) => { //地图下面所有统计
|
|
||||||
// if (res.code === 200) {
|
|
||||||
// this.deviceNum = res.data
|
|
||||||
// }
|
|
||||||
// }).catch(error => {
|
|
||||||
// console.error("Error fetching area data:", error);
|
|
||||||
// });
|
|
||||||
// },
|
|
||||||
changeidx(ids) {
|
changeidx(ids) {
|
||||||
this.statusidx = ids
|
this.statusidx = ids
|
||||||
this.getmarks()
|
this.getmarks()
|
||||||
|
|
@ -518,7 +490,6 @@
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.latitude = res.data.latitude
|
this.latitude = res.data.latitude
|
||||||
this.longitude = res.data.longitude
|
this.longitude = res.data.longitude
|
||||||
// this.areaInfo = res.data
|
|
||||||
const polylines = this.convertBoundaryToPolyline(res.data.boundaryStr)
|
const polylines = this.convertBoundaryToPolyline(res.data.boundaryStr)
|
||||||
this.polyline.push(polylines)
|
this.polyline.push(polylines)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
@ -547,42 +518,38 @@
|
||||||
fillColor: "#FFD1CF40",
|
fillColor: "#FFD1CF40",
|
||||||
strokeColor: "#FFC107"
|
strokeColor: "#FFC107"
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if (!colorMap[num]) {
|
|
||||||
console.error("Invalid type number:", num);
|
|
||||||
return [];
|
|
||||||
}
|
}
|
||||||
|
if (!colorMap[num]) {
|
||||||
|
console.error("Invalid type number:", num)
|
||||||
|
return []
|
||||||
|
}
|
||||||
return boundaries.map(boundary => {
|
return boundaries.map(boundary => {
|
||||||
if (!boundary) return null;
|
if (!boundary) return null
|
||||||
let coords;
|
let coords
|
||||||
try {
|
try {
|
||||||
coords = JSON.parse(boundary);
|
coords = JSON.parse(boundary)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error parsing boundary JSON:", error);
|
console.error("Error parsing boundary JSON:", error)
|
||||||
return null;
|
return null
|
||||||
}
|
}
|
||||||
if (!Array.isArray(coords)) {
|
if (!Array.isArray(coords)) {
|
||||||
console.error("Parsed boundary is not an array:", coords);
|
console.error("Parsed boundary is not an array:", coords)
|
||||||
return null;
|
return null
|
||||||
}
|
}
|
||||||
const points = coords.map(coord => ({
|
const points = coords.map(coord => ({
|
||||||
latitude: parseFloat(coord[1]),
|
latitude: parseFloat(coord[1]),
|
||||||
longitude: parseFloat(coord[0])
|
longitude: parseFloat(coord[0])
|
||||||
}));
|
}))
|
||||||
return {
|
return {
|
||||||
points: points,
|
points: points,
|
||||||
fillColor: colorMap[num].fillColor,
|
fillColor: colorMap[num].fillColor,
|
||||||
strokeColor: colorMap[num].strokeColor,
|
strokeColor: colorMap[num].strokeColor,
|
||||||
strokeWidth: 2, //描边宽度
|
strokeWidth: 2, //描边宽度
|
||||||
zIndex: 1, //层级
|
zIndex: 1, //层级
|
||||||
};
|
}
|
||||||
}).filter(polyline => polyline !== null); // 过滤掉无效的折线数据
|
}).filter(polyline => polyline !== null) // 过滤掉无效的折线数据
|
||||||
|
|
||||||
},
|
},
|
||||||
markstause() {
|
markstause() {
|
||||||
// console.log(this.status9, 'aaaaaaa');
|
|
||||||
this.status0.forEach(item => {
|
this.status0.forEach(item => {
|
||||||
this.markers.push({
|
this.markers.push({
|
||||||
id: parseFloat(item.id),
|
id: parseFloat(item.id),
|
||||||
|
|
@ -591,7 +558,6 @@
|
||||||
// title: item.deviceName,
|
// title: item.deviceName,
|
||||||
width: 30,
|
width: 30,
|
||||||
height: 34,
|
height: 34,
|
||||||
// iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u6jBvj7S50FPgsHaHXai',
|
|
||||||
iconPath: item.onlineStatus == 0 ?
|
iconPath: item.onlineStatus == 0 ?
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/uQRng4QNKA38Amk8Wgt5' :
|
'https://lxnapi.ccttiot.com/bike/img/static/uQRng4QNKA38Amk8Wgt5' :
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/uocjFo8Ar2BJVpzC2G2f',
|
'https://lxnapi.ccttiot.com/bike/img/static/uocjFo8Ar2BJVpzC2G2f',
|
||||||
|
|
@ -639,12 +605,10 @@
|
||||||
longitude: parseFloat(item.longitude),
|
longitude: parseFloat(item.longitude),
|
||||||
// title: item.deviceName,
|
// title: item.deviceName,
|
||||||
width: 30,
|
width: 30,
|
||||||
|
|
||||||
height: 34,
|
height: 34,
|
||||||
iconPath: item.onlineStatus == 0 ?
|
iconPath: item.onlineStatus == 0 ?
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/uR3DQEssiK62ovhh88y8' :
|
'https://lxnapi.ccttiot.com/bike/img/static/uR3DQEssiK62ovhh88y8' :
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/u460R1NKWHEpHbt0U4H7',
|
'https://lxnapi.ccttiot.com/bike/img/static/u460R1NKWHEpHbt0U4H7',
|
||||||
// iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/um0qXpcbA32WdwqtHbxy',
|
|
||||||
callout: {
|
callout: {
|
||||||
content: '' + parseInt(item.remainingPower) + '%', // 修改为你想要显示的文字内容
|
content: '' + parseInt(item.remainingPower) + '%', // 修改为你想要显示的文字内容
|
||||||
color: '#2679D1', // 修改为文字颜色
|
color: '#2679D1', // 修改为文字颜色
|
||||||
|
|
@ -668,7 +632,6 @@
|
||||||
iconPath: item.onlineStatus == 0 ?
|
iconPath: item.onlineStatus == 0 ?
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/uG13E7BpUFF44wVYC9no' :
|
'https://lxnapi.ccttiot.com/bike/img/static/uG13E7BpUFF44wVYC9no' :
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/uHQIdWCTmtUztl49wBKU',
|
'https://lxnapi.ccttiot.com/bike/img/static/uHQIdWCTmtUztl49wBKU',
|
||||||
// iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/ur1ZrncDJ1WwuPJeiMG6',
|
|
||||||
callout: {
|
callout: {
|
||||||
content: '' + parseInt(item.remainingPower) + '%', // 修改为你想要显示的文字内容
|
content: '' + parseInt(item.remainingPower) + '%', // 修改为你想要显示的文字内容
|
||||||
color: '#2679D1', // 修改为文字颜色
|
color: '#2679D1', // 修改为文字颜色
|
||||||
|
|
@ -692,7 +655,6 @@
|
||||||
iconPath: item.onlineStatus == 0 ?
|
iconPath: item.onlineStatus == 0 ?
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/uRod2zf3t9dAOYafWoWt' :
|
'https://lxnapi.ccttiot.com/bike/img/static/uRod2zf3t9dAOYafWoWt' :
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/uZpXq3TBtM5gVgJJeImY',
|
'https://lxnapi.ccttiot.com/bike/img/static/uZpXq3TBtM5gVgJJeImY',
|
||||||
// iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/uN4ksL0Z2HM4C07fKEOF',
|
|
||||||
callout: {
|
callout: {
|
||||||
content: '' + parseInt(item.remainingPower) + '%', // 修改为你想要显示的文字内容
|
content: '' + parseInt(item.remainingPower) + '%', // 修改为你想要显示的文字内容
|
||||||
color: '#2679D1', // 修改为文字颜色
|
color: '#2679D1', // 修改为文字颜色
|
||||||
|
|
@ -716,7 +678,6 @@
|
||||||
iconPath: item.onlineStatus == 0 ?
|
iconPath: item.onlineStatus == 0 ?
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/uhZudZM3nEKj0tYKlho2' :
|
'https://lxnapi.ccttiot.com/bike/img/static/uhZudZM3nEKj0tYKlho2' :
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/ujur6TezvPf4buFAqPHo',
|
'https://lxnapi.ccttiot.com/bike/img/static/ujur6TezvPf4buFAqPHo',
|
||||||
// iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/uxbI6ZclpS3WQCfPO1zr',
|
|
||||||
callout: {
|
callout: {
|
||||||
content: '' + parseInt(item.remainingPower) + '%', // 修改为你想要显示的文字内容
|
content: '' + parseInt(item.remainingPower) + '%', // 修改为你想要显示的文字内容
|
||||||
color: '#2679D1', // 修改为文字颜色
|
color: '#2679D1', // 修改为文字颜色
|
||||||
|
|
@ -739,7 +700,6 @@
|
||||||
iconPath: item.onlineStatus == 0 ?
|
iconPath: item.onlineStatus == 0 ?
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/ucBKG3ebYRAToVweJihu' :
|
'https://lxnapi.ccttiot.com/bike/img/static/ucBKG3ebYRAToVweJihu' :
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/uyK7Vg4Lu8xb3oNVuG2l',
|
'https://lxnapi.ccttiot.com/bike/img/static/uyK7Vg4Lu8xb3oNVuG2l',
|
||||||
// iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/uYIFwg5IJ4Axh7TfJ7q6',
|
|
||||||
callout: {
|
callout: {
|
||||||
content: '' + parseInt(item.remainingPower) + '%', // 修改为你想要显示的文字内容
|
content: '' + parseInt(item.remainingPower) + '%', // 修改为你想要显示的文字内容
|
||||||
color: '#ffffff', // 修改为文字颜色
|
color: '#ffffff', // 修改为文字颜色
|
||||||
|
|
@ -784,8 +744,7 @@
|
||||||
this.status8 = []
|
this.status8 = []
|
||||||
this.status9 = []
|
this.status9 = []
|
||||||
this.status6 = []
|
this.status6 = []
|
||||||
console.log(this.rangeValue,'020202');
|
if (this.statusidx != 7 && this.statusidx != 20 && this.statusidx != 10) {
|
||||||
if (this.statusidx != 7 && this.statusidx != 9 && this.statusidx != 10) {
|
|
||||||
this.$u.get(`/bst/device/all?areaId=${this.areaId}&status=${this.statusidx}&powerRange=${this.rangeValue[0] + ',' + this.rangeValue[1]}&refresh=true`).then((res) => { //查询所有车辆信息
|
this.$u.get(`/bst/device/all?areaId=${this.areaId}&status=${this.statusidx}&powerRange=${this.rangeValue[0] + ',' + this.rangeValue[1]}&refresh=true`).then((res) => { //查询所有车辆信息
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.showmap = true
|
this.showmap = true
|
||||||
|
|
@ -839,8 +798,8 @@
|
||||||
this.markstause()
|
this.markstause()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if (this.statusidx == 9 || this.statusidx == 10) {
|
} else if (this.statusidx == 20 || this.statusidx == 10) {
|
||||||
this.$u.get(`/bst/device/all?areaId=${this.areaId}&onlineStatus=${this.statusidx == 9 ? 0 : 1}&powerRange=${this.rangeValue[0] + ',' + this.rangeValue[1]}&refresh=true`).then((res) => {
|
this.$u.get(`/bst/device/all?areaId=${this.areaId}&onlineStatus=${this.statusidx == 20 ? 0 : 1}&powerRange=${this.rangeValue[0] + ',' + this.rangeValue[1]}&refresh=true`).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.showmap = true
|
this.showmap = true
|
||||||
this.listData = res.data
|
this.listData = res.data
|
||||||
|
|
@ -874,15 +833,12 @@
|
||||||
let added = false
|
let added = false
|
||||||
for (let i = 0; i < this.clusters.length; i++) {
|
for (let i = 0; i < this.clusters.length; i++) {
|
||||||
const cluster = this.clusters[i]
|
const cluster = this.clusters[i]
|
||||||
const distance = this.calculateDistance(cluster.latitude, cluster.longitude, marker
|
const distance = this.calculateDistance(cluster.latitude, cluster.longitude, marker.latitude, marker.longitude)
|
||||||
.latitude, marker.longitude)
|
|
||||||
if (distance < this.clusterRadius) {
|
if (distance < this.clusterRadius) {
|
||||||
// 合并到现有聚合
|
// 合并到现有聚合
|
||||||
cluster.markers.push(marker)
|
cluster.markers.push(marker)
|
||||||
cluster.latitude = (cluster.latitude * cluster.markers.length + marker.latitude) / (
|
cluster.latitude = (cluster.latitude * cluster.markers.length + marker.latitude) / (cluster.markers.length + 1)
|
||||||
cluster.markers.length + 1)
|
cluster.longitude = (cluster.longitude * cluster.markers.length + marker.longitude) / (cluster.markers.length + 1)
|
||||||
cluster.longitude = (cluster.longitude * cluster.markers.length + marker.longitude) / (
|
|
||||||
cluster.markers.length + 1)
|
|
||||||
added = true
|
added = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
@ -938,11 +894,7 @@
|
||||||
longitude: parseFloat(row.longitude),
|
longitude: parseFloat(row.longitude),
|
||||||
width: 20,
|
width: 20,
|
||||||
height: 29,
|
height: 29,
|
||||||
iconPath: row.type == 1 ?
|
iconPath: row.type == 1 ? 'https://lxnapi.ccttiot.com/bike/img/static/up2xXqAgwCX5iER600k3' : row.type == 2 ? 'https://lxnapi.ccttiot.com/bike/img/static/uDNY5Q4zOiZTCBTA2Jdq' : 'https://lxnapi.ccttiot.com/bike/img/static/u53BAQcFIX3vxsCzEZ7t',
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/up2xXqAgwCX5iER600k3' :
|
|
||||||
row.type == 2 ?
|
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/uDNY5Q4zOiZTCBTA2Jdq' :
|
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/u53BAQcFIX3vxsCzEZ7t',
|
|
||||||
callout: {
|
callout: {
|
||||||
content: row.name,
|
content: row.name,
|
||||||
color: '#ffffff',
|
color: '#ffffff',
|
||||||
|
|
|
||||||
|
|
@ -231,9 +231,9 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
userId() {
|
// userId() {
|
||||||
return this.$store.getters.userId
|
// return this.$store.getters.userId
|
||||||
},
|
// },
|
||||||
// 添加过滤后的列表计算属性
|
// 添加过滤后的列表计算属性
|
||||||
filteredList() {
|
filteredList() {
|
||||||
if (!this.searchKey) return this.list
|
if (!this.searchKey) return this.list
|
||||||
|
|
|
||||||
|
|
@ -91,14 +91,8 @@
|
||||||
<view class="">
|
<view class="">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uxFLA73NZnGm7gD5yxQK" mode=""></image> 续航:<span style="font-size: 30rpx;color: #333;font-weight: 600;">{{deviceInfos.remainEndurance == null ? '--' : deviceInfos.remainEndurance}}</span> km
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uxFLA73NZnGm7gD5yxQK" mode=""></image> 续航:<span style="font-size: 30rpx;color: #333;font-weight: 600;">{{deviceInfos.remainEndurance == null ? '--' : deviceInfos.remainEndurance}}</span> km
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="" style="margin-top: 20rpx;">
|
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/ur7Q7YC9AOkkTpvaLEUU" mode=""></image> 车型 {{deviceInfos.modelName}}
|
|
||||||
</view> -->
|
|
||||||
</view>
|
</view>
|
||||||
<view class="ewm">
|
<view class="ewm">
|
||||||
<!-- <view class="" @click="generateQrcode()">
|
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uiCssXpb4SpuFAQYOp2A" mode=""></image> 二维码
|
|
||||||
</view> -->
|
|
||||||
<view class="" @click="toTrack">
|
<view class="" @click="toTrack">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uJtMZ16iR2q8agQ4iLm3" mode=""></image> 轨迹
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uJtMZ16iR2q8agQ4iLm3" mode=""></image> 轨迹
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -440,7 +434,7 @@
|
||||||
onLoad(e) {
|
onLoad(e) {
|
||||||
this.sn = e.id
|
this.sn = e.id
|
||||||
this.deviceInfo()
|
this.deviceInfo()
|
||||||
this.deptId = uni.getStorageSync('deptId');
|
this.deptId = uni.getStorageSync('deptId')
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.getyunying()
|
this.getyunying()
|
||||||
|
|
@ -570,18 +564,38 @@
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11open@"
|
customData: "11open@"
|
||||||
})
|
})
|
||||||
|
uni.showToast({
|
||||||
|
title: '发送成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
} else if (num == 2) {
|
} else if (num == 2) {
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11close@"
|
customData: "11close@"
|
||||||
})
|
})
|
||||||
|
uni.showToast({
|
||||||
|
title: '发送成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
}else if (num == 3) {
|
}else if (num == 3) {
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11reboot@"
|
customData: "11reboot@"
|
||||||
})
|
})
|
||||||
|
uni.showToast({
|
||||||
|
title: '发送成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11play1@"
|
customData: "11play1@"
|
||||||
})
|
})
|
||||||
|
uni.showToast({
|
||||||
|
title: '发送成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getlanya() {
|
getlanya() {
|
||||||
|
|
@ -670,8 +684,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 静音
|
// 静音
|
||||||
btnjingyin() {
|
btnjingyin() {
|
||||||
this.shengyin = true
|
this.shengyin = true
|
||||||
|
|
@ -858,7 +870,7 @@
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中...'
|
title: '加载中...'
|
||||||
})
|
})
|
||||||
console.log('点击了....1');
|
console.log('点击了....1')
|
||||||
this.$u.put('/bst/device/iot/unlock?id=' + this.sn).then((res) => {
|
this.$u.put('/bst/device/iot/unlock?id=' + this.sn).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
// 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
|
// 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
|
||||||
|
|
@ -881,7 +893,7 @@
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中...'
|
title: '加载中...'
|
||||||
})
|
})
|
||||||
console.log('点击了....2');
|
console.log('点击了....2')
|
||||||
this.$u.put('/bst/device/iot/lock?id=' + this.sn).then((res) => {
|
this.$u.put('/bst/device/iot/lock?id=' + this.sn).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
// 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
|
// 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构
|
||||||
|
|
@ -1088,13 +1100,6 @@
|
||||||
}
|
}
|
||||||
this.deviceInfos = res.data
|
this.deviceInfos = res.data
|
||||||
this.mac = res.data.mac
|
this.mac = res.data.mac
|
||||||
// if (res.data.onlineStatus == 0) {
|
|
||||||
// }
|
|
||||||
// if (res.data.isSound == 0) {
|
|
||||||
// this.jytxt = '关'
|
|
||||||
// } else {
|
|
||||||
// this.jytxt = '开'
|
|
||||||
// }
|
|
||||||
if (this.getnum == 0) {
|
if (this.getnum == 0) {
|
||||||
this.getArea()
|
this.getArea()
|
||||||
}
|
}
|
||||||
|
|
@ -1294,7 +1299,6 @@
|
||||||
console.error("Parsed boundary is not an array:", coords)
|
console.error("Parsed boundary is not an array:", coords)
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
console.log(coords, '1111111');
|
|
||||||
const points = coords.map(coord => ({
|
const points = coords.map(coord => ({
|
||||||
latitude: coord[1],
|
latitude: coord[1],
|
||||||
longitude: coord[0]
|
longitude: coord[0]
|
||||||
|
|
@ -1360,8 +1364,7 @@
|
||||||
strokeColor: "#FFC107", //描边颜色
|
strokeColor: "#FFC107", //描边颜色
|
||||||
strokeWidth: 2, //描边宽度
|
strokeWidth: 2, //描边宽度
|
||||||
zIndex: 1, //层级
|
zIndex: 1, //层级
|
||||||
|
}
|
||||||
};
|
|
||||||
}).filter(polyline => polyline !== null) // 过滤掉无效的折线数据
|
}).filter(polyline => polyline !== null) // 过滤掉无效的折线数据
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -1436,8 +1439,6 @@
|
||||||
this.polyline = this.polyline.concat(polylines1)
|
this.polyline = this.polyline.concat(polylines1)
|
||||||
this.polyline = this.polyline.concat(polylines)
|
this.polyline = this.polyline.concat(polylines)
|
||||||
this.parkingList = res.data
|
this.parkingList = res.data
|
||||||
// console.log(this.polyline);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.error("Error fetching parking data:", error)
|
console.error("Error fetching parking data:", error)
|
||||||
|
|
@ -1666,7 +1667,6 @@
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding-bottom: 13rpx;
|
padding-bottom: 13rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
||||||
.lt{
|
.lt{
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
|
|
@ -1692,7 +1692,6 @@
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 104rpx;
|
width: 104rpx;
|
||||||
height: 42rpx;
|
height: 42rpx;
|
||||||
// background: #DBFDD6;
|
|
||||||
border-radius: 6rpx 6rpx 6rpx 6rpx;
|
border-radius: 6rpx 6rpx 6rpx 6rpx;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
line-height: 42rpx;
|
line-height: 42rpx;
|
||||||
|
|
@ -1711,7 +1710,6 @@
|
||||||
left: 72rpx;
|
left: 72rpx;
|
||||||
top: 628rpx;
|
top: 628rpx;
|
||||||
width: 610rpx;
|
width: 610rpx;
|
||||||
// height: 282rpx;
|
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
border-radius: 30rpx 30rpx 30rpx 30rpx;
|
border-radius: 30rpx 30rpx 30rpx 30rpx;
|
||||||
z-index: 110;
|
z-index: 110;
|
||||||
|
|
@ -1908,7 +1906,6 @@
|
||||||
&.active {
|
&.active {
|
||||||
background: #ECF5FF;
|
background: #ECF5FF;
|
||||||
border: 2rpx solid #4C97E7;
|
border: 2rpx solid #4C97E7;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: '';
|
content: '';
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
||||||
|
|
@ -1149,7 +1149,7 @@
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if (num == 4) {
|
} else if (num == 4) {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
¥{{infoobj.balance == null ? '0.00' : (Number(infoobj.balance) + Number(waitDivideAmount)).toFixed(2)}}
|
¥{{infoobj.balance == null ? '0.00' : (Number(infoobj.balance) + Number(waitDivideAmount)).toFixed(2)}}
|
||||||
</view>
|
</view>
|
||||||
<view class="ljtx">
|
<view class="ljtx">
|
||||||
累积提现:{{successAmount == null ? '¥0.00' : '¥' + successAmount.toFixed(2)}}
|
累积提现:{{successAmount == null ? '¥0.00' : '¥' + Number(successAmount).toFixed(2)}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="rt">
|
<view class="rt">
|
||||||
|
|
@ -401,7 +401,7 @@
|
||||||
this.$u.get(`/getInfo`).then(res => {
|
this.$u.get(`/getInfo`).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.infoobj = res.user
|
this.infoobj = res.user
|
||||||
this.successAmount = res.stat.withdraw.successAmount == null ? 0 : res.stat.withdraw.successAmount
|
this.successAmount = res.stat.withdraw.successAmount == null ? 0 : Number(res.stat.withdraw.successAmount)
|
||||||
this.waitDivideAmount = res.stat.bonus.waitDivideAmount == null ? 0 : res.stat.bonus.waitDivideAmount
|
this.waitDivideAmount = res.stat.bonus.waitDivideAmount == null ? 0 : res.stat.bonus.waitDivideAmount
|
||||||
this.gettongji()
|
this.gettongji()
|
||||||
this.getqb()
|
this.getqb()
|
||||||
|
|
|
||||||
|
|
@ -191,12 +191,12 @@
|
||||||
type: 'gcj02', // 国内地图更兼容
|
type: 'gcj02', // 国内地图更兼容
|
||||||
isHighAccuracy: true,
|
isHighAccuracy: true,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('精确坐标:', res);
|
console.log('精确坐标:', res)
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('获取位置失败:', err);
|
console.error('获取位置失败:', err)
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
// 分享到好友(会话)
|
// 分享到好友(会话)
|
||||||
onShareAppMessage: function() {
|
onShareAppMessage: function() {
|
||||||
|
|
@ -229,9 +229,6 @@
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/' + this.tiaozhuanlist[e].url
|
url: '/' + this.tiaozhuanlist[e].url
|
||||||
})
|
})
|
||||||
// uni.navigateTo({
|
|
||||||
// url:'/page_user/zhaoshang'
|
|
||||||
// })
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 点击显示客服
|
// 点击显示客服
|
||||||
|
|
@ -337,14 +334,16 @@
|
||||||
this.$u.get("/app/notice/new?noticeType=1").then(res =>{
|
this.$u.get("/app/notice/new?noticeType=1").then(res =>{
|
||||||
if(res.code == 200){
|
if(res.code == 200){
|
||||||
this.announcements = res.data
|
this.announcements = res.data
|
||||||
this.$u.get(`/app/notice/${res.data.noticeId}`).then(resp =>{
|
if(res.data){
|
||||||
if(resp.code == 200){
|
this.$u.get(`/app/notice/${res.data.noticeId}`).then(resp =>{
|
||||||
this.gonggaoxq = resp.data
|
if(resp.code == 200){
|
||||||
if(resp.data.noticeId != uni.getStorageSync('noticeId')){
|
this.gonggaoxq = resp.data
|
||||||
this.gonggaoflag = true
|
if(resp.data.noticeId != uni.getStorageSync('noticeId')){
|
||||||
|
this.gonggaoflag = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@
|
||||||
onShow() {
|
onShow() {
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
if(this.ver_dataflag == 3){
|
if(this.ver_dataflag == 3){
|
||||||
console.log('11');
|
console.log('11')
|
||||||
}else{
|
}else{
|
||||||
xBlufi.initXBlufi(1)
|
xBlufi.initXBlufi(1)
|
||||||
xBlufi.notifyStartDiscoverBle({
|
xBlufi.notifyStartDiscoverBle({
|
||||||
|
|
@ -253,12 +253,12 @@
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.getorderdevice()
|
this.getorderdevice()
|
||||||
}, 100)
|
}, 100)
|
||||||
this.executeTask();
|
this.executeTask()
|
||||||
|
|
||||||
// 启动每分钟(60秒)执行一次的定时器
|
// 启动每分钟(60秒)执行一次的定时器
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
this.executeTask();
|
this.executeTask()
|
||||||
}, 30000);
|
}, 30000)
|
||||||
xBlufi.notifyConnectBle({
|
xBlufi.notifyConnectBle({
|
||||||
isStart: false,
|
isStart: false,
|
||||||
deviceId: this.deviceId,
|
deviceId: this.deviceId,
|
||||||
|
|
@ -271,7 +271,7 @@
|
||||||
if (this.findDeviceTimer) {
|
if (this.findDeviceTimer) {
|
||||||
clearTimeout(this.findDeviceTimer)
|
clearTimeout(this.findDeviceTimer)
|
||||||
this.findDeviceTimer = null
|
this.findDeviceTimer = null
|
||||||
console.log('清除定时器1');
|
console.log('清除定时器1')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
|
|
@ -280,12 +280,12 @@
|
||||||
if (this.findDeviceTimer) {
|
if (this.findDeviceTimer) {
|
||||||
clearTimeout(this.findDeviceTimer)
|
clearTimeout(this.findDeviceTimer)
|
||||||
this.findDeviceTimer = null
|
this.findDeviceTimer = null
|
||||||
console.log('清除定时器2');
|
console.log('清除定时器2')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 组件销毁时清除定时器
|
// 组件销毁时清除定时器
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
clearTimeout(this.uploadTimer);
|
clearTimeout(this.uploadTimer)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 点击咨询客服
|
// 点击咨询客服
|
||||||
|
|
@ -330,9 +330,9 @@
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
this.mac = res.data.deviceMac
|
this.mac = res.data.deviceMac
|
||||||
if(this.ver_dataflag != 3){
|
if(this.ver_dataflag != 3){
|
||||||
console.log('离线离线');
|
console.log('离线离线')
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
console.log('11ly',this.ljflag);
|
console.log('11ly',this.ljflag)
|
||||||
if(this.ljflag == true){
|
if(this.ljflag == true){
|
||||||
this.ljflag = false
|
this.ljflag = false
|
||||||
this.findDevice()
|
this.findDevice()
|
||||||
|
|
@ -428,7 +428,6 @@
|
||||||
dataStr.split(',').forEach(part => {
|
dataStr.split(',').forEach(part => {
|
||||||
const [key, value] = part.split(':').map(item => item.trim());
|
const [key, value] = part.split(':').map(item => item.trim());
|
||||||
if (!key || value === undefined) return;
|
if (!key || value === undefined) return;
|
||||||
|
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'status': dataObj.status = value; break;
|
case 'status': dataObj.status = value; break;
|
||||||
case 'bat': dataObj.bat = parseFloat(value); break;
|
case 'bat': dataObj.bat = parseFloat(value); break;
|
||||||
|
|
@ -438,8 +437,7 @@
|
||||||
case 'q': dataObj.q = parseInt(value); break;
|
case 'q': dataObj.q = parseInt(value); break;
|
||||||
case 's': dataObj.s = parseInt(value); break;
|
case 's': dataObj.s = parseInt(value); break;
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
// 2. 获取定位
|
// 2. 获取定位
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'gcj02',
|
type: 'gcj02',
|
||||||
|
|
@ -449,16 +447,16 @@
|
||||||
...dataObj,
|
...dataObj,
|
||||||
lon: res.longitude,
|
lon: res.longitude,
|
||||||
lat: res.latitude
|
lat: res.latitude
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
fail: () => {
|
fail: () => {
|
||||||
this.submitData({
|
this.submitData({
|
||||||
...dataObj,
|
...dataObj,
|
||||||
lon: 0,
|
lon: 0,
|
||||||
lat: 0
|
lat: 0
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// 3. 单独封装数据提交
|
// 3. 单独封装数据提交
|
||||||
|
|
@ -474,64 +472,46 @@
|
||||||
lon: Number(data.lon) || 0,
|
lon: Number(data.lon) || 0,
|
||||||
lat: Number(data.lat) || 0
|
lat: Number(data.lat) || 0
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
this.bluetoothData = payload
|
this.bluetoothData = payload
|
||||||
// console.log('提交数据:', payload);
|
|
||||||
this.throttledUpload()
|
this.throttledUpload()
|
||||||
// 4. 带错误处理的上传
|
},
|
||||||
// this.$u.put('/app/device/iot/bltUpload', payload)
|
// 节流上传控制
|
||||||
// .then(res => {
|
throttledUpload() {
|
||||||
// if (res.code !== 200) throw new Error(res.msg);
|
const now = Date.now()
|
||||||
// console.log('上传成功');
|
const throttleInterval = 10000 // 10秒
|
||||||
// })
|
// 清除之前的定时器
|
||||||
// .catch(err => {
|
clearTimeout(this.uploadTimer)
|
||||||
// console.error('上传失败:', err);
|
// 如果距离上次上传超过10秒且没有正在上传的请求
|
||||||
// // uni.showToast({ title: err.message, icon: 'none' });
|
if (now - this.lastUploadTime >= throttleInterval && !this.isUploading) {
|
||||||
// });
|
this.doUpload()
|
||||||
|
} else {
|
||||||
|
// 否则设置定时器,在剩余时间后执行
|
||||||
|
const remainingTime = throttleInterval - (now - this.lastUploadTime)
|
||||||
|
this.uploadTimer = setTimeout(() => {
|
||||||
|
this.doUpload()
|
||||||
|
}, remainingTime)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 节流上传控制
|
// 实际执行上传
|
||||||
throttledUpload() {
|
doUpload() {
|
||||||
const now = Date.now();
|
if (!this.bluetoothData || this.isUploading) return
|
||||||
const throttleInterval = 10000; // 10秒
|
this.isUploading = true
|
||||||
|
this.lastUploadTime = Date.now()
|
||||||
// 清除之前的定时器
|
console.log(this.bluetoothData,'this.bluetoothDatathis.bluetoothData')
|
||||||
clearTimeout(this.uploadTimer);
|
this.$u.put(`/app/device/iot/bltUpload`, this.bluetoothData).then(res => {
|
||||||
|
|
||||||
// 如果距离上次上传超过10秒且没有正在上传的请求
|
|
||||||
if (now - this.lastUploadTime >= throttleInterval && !this.isUploading) {
|
|
||||||
this.doUpload();
|
|
||||||
} else {
|
|
||||||
// 否则设置定时器,在剩余时间后执行
|
|
||||||
const remainingTime = throttleInterval - (now - this.lastUploadTime);
|
|
||||||
this.uploadTimer = setTimeout(() => {
|
|
||||||
this.doUpload();
|
|
||||||
}, remainingTime);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// 实际执行上传
|
|
||||||
doUpload() {
|
|
||||||
if (!this.bluetoothData || this.isUploading) return;
|
|
||||||
|
|
||||||
this.isUploading = true;
|
|
||||||
this.lastUploadTime = Date.now();
|
|
||||||
console.log(this.bluetoothData,'this.bluetoothDatathis.bluetoothData');
|
|
||||||
this.$u.put(`/app/device/iot/bltUpload`, this.bluetoothData)
|
|
||||||
.then(res => {
|
|
||||||
if(res.code == 200) {
|
if(res.code == 200) {
|
||||||
console.log('上传蓝牙数据成功',this.bluetoothData, new Date().toLocaleTimeString());
|
console.log('上传蓝牙数据成功',this.bluetoothData, new Date().toLocaleTimeString())
|
||||||
} else {
|
} else {
|
||||||
console.log('上传蓝牙数据失败', res.msg);
|
console.log('上传蓝牙数据失败', res.msg)
|
||||||
}
|
}
|
||||||
})
|
}).catch(err => {
|
||||||
.catch(err => {
|
console.error('上传异常:', err)
|
||||||
console.error('上传异常:', err);
|
}).finally(() => {
|
||||||
})
|
this.isUploading = false
|
||||||
.finally(() => {
|
})
|
||||||
this.isUploading = false;
|
},
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// 点击启动and关闭
|
// 点击启动and关闭
|
||||||
btnqd() {
|
btnqd() {
|
||||||
|
|
@ -541,12 +521,12 @@
|
||||||
isHighAccuracy: true,
|
isHighAccuracy: true,
|
||||||
accuracy:'best',
|
accuracy:'best',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('精确坐标:', res);
|
console.log('精确坐标:', res)
|
||||||
this.lslat = res.latitude;
|
this.lslat = res.latitude
|
||||||
this.lslon = res.longitude;
|
this.lslon = res.longitude
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('获取位置失败:', err);
|
console.error('获取位置失败:', err)
|
||||||
this.lat = null
|
this.lat = null
|
||||||
this.lon = null
|
this.lon = null
|
||||||
}
|
}
|
||||||
|
|
@ -558,6 +538,10 @@
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
let flag = ''
|
let flag = ''
|
||||||
if(that.ver_dataflag == 3){
|
if(that.ver_dataflag == 3){
|
||||||
flag = false
|
flag = false
|
||||||
|
|
@ -575,7 +559,7 @@
|
||||||
customData: "11open@"
|
customData: "11open@"
|
||||||
})
|
})
|
||||||
that.deivceobj.deviceLockStatus = 1
|
that.deivceobj.deviceLockStatus = 1
|
||||||
|
uni.hideLoading()
|
||||||
let data = {
|
let data = {
|
||||||
mac:that.mac,
|
mac:that.mac,
|
||||||
reason:'解锁',
|
reason:'解锁',
|
||||||
|
|
@ -586,6 +570,7 @@
|
||||||
}
|
}
|
||||||
that.$u.post(`/app/commandLog/bluetooth`,data).then(res => {})
|
that.$u.post(`/app/commandLog/bluetooth`,data).then(res => {})
|
||||||
} else {
|
} else {
|
||||||
|
uni.hideLoading()
|
||||||
let that = this
|
let that = this
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
|
|
@ -621,6 +606,7 @@
|
||||||
that.getorderdevice()
|
that.getorderdevice()
|
||||||
}
|
}
|
||||||
} else if(res.code == 20001){
|
} else if(res.code == 20001){
|
||||||
|
uni.hideLoading()
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '设备未连接,请靠近车辆等待连接',
|
content: '设备未连接,请靠近车辆等待连接',
|
||||||
|
|
@ -634,6 +620,7 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
|
|
@ -642,7 +629,7 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
console.log('取消'); // 用户点击取消
|
console.log('取消') // 用户点击取消
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -652,14 +639,14 @@
|
||||||
isHighAccuracy: true,
|
isHighAccuracy: true,
|
||||||
accuracy:'best',
|
accuracy:'best',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('精确坐标:', res);
|
console.log('精确坐标:', res)
|
||||||
this.lat = res.latitude
|
this.lat = res.latitude
|
||||||
this.lon = res.longitude
|
this.lon = res.longitude
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
this.lat = null
|
this.lat = null
|
||||||
this.lon = null
|
this.lon = null
|
||||||
console.error('获取位置失败:', err);
|
console.error('获取位置失败:', err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
let that = this
|
let that = this
|
||||||
|
|
@ -675,16 +662,20 @@
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
that.$u.put(`/app/order/closeDevice?orderId=${that.deivceobj.orderId}&lat=${that.lat}&lon=${that.lon}&requiredIot=${flag}`).then((res) => {
|
that.$u.put(`/app/order/closeDevice?orderId=${that.deivceobj.orderId}&lat=${that.lat}&lon=${that.lon}&requiredIot=${flag}`).then((res) => {
|
||||||
if (res.code == 200 && res.data.db >= 1) {
|
if (res.code == 200 && res.data.db >= 1) {
|
||||||
if(res.data.iot == false){
|
if(res.data.iot == false){
|
||||||
console.log(that.ver_dataflag,'thatthat');
|
console.log(that.ver_dataflag,'thatthat')
|
||||||
if (that.ver_dataflag == 3) {
|
if (that.ver_dataflag == 3) {
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11llose@",
|
customData: "11llose@",
|
||||||
})
|
})
|
||||||
that.deivceobj.deviceLockStatus = 0
|
that.deivceobj.deviceLockStatus = 0
|
||||||
|
uni.hideLoading()
|
||||||
let data = {
|
let data = {
|
||||||
mac:that.mac,
|
mac:that.mac,
|
||||||
reason:'临时锁车',
|
reason:'临时锁车',
|
||||||
|
|
@ -694,9 +685,10 @@
|
||||||
result:'成功'
|
result:'成功'
|
||||||
}
|
}
|
||||||
that.$u.post(`/app/commandLog/bluetooth`,data).then(res => {
|
that.$u.post(`/app/commandLog/bluetooth`,data).then(res => {
|
||||||
console.log(res,'蓝牙');
|
console.log(res,'蓝牙')
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
uni.hideLoading()
|
||||||
let that = this
|
let that = this
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
|
|
@ -719,10 +711,11 @@
|
||||||
result:'蓝牙未连接'
|
result:'蓝牙未连接'
|
||||||
}
|
}
|
||||||
that.$u.post(`/app/commandLog/bluetooth`,data).then(res => {
|
that.$u.post(`/app/commandLog/bluetooth`,data).then(res => {
|
||||||
console.log(res,'蓝牙');
|
console.log(res,'蓝牙')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '临时锁车成功',
|
title: '临时锁车成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
|
|
@ -732,6 +725,7 @@
|
||||||
that.getorderdevice()
|
that.getorderdevice()
|
||||||
}
|
}
|
||||||
} else if(res.code == 20001){
|
} else if(res.code == 20001){
|
||||||
|
uni.hideLoading()
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: '设备未连接,请靠近车辆等待连接',
|
content: '设备未连接,请靠近车辆等待连接',
|
||||||
|
|
@ -745,6 +739,7 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
|
|
@ -753,7 +748,7 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if (res.cancel) {
|
} else if (res.cancel) {
|
||||||
console.log('取消'); // 用户点击取消
|
console.log('取消') // 用户点击取消
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -761,8 +756,13 @@
|
||||||
},
|
},
|
||||||
// 点击鸣笛寻车
|
// 点击鸣笛寻车
|
||||||
btnfm() {
|
btnfm() {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
this.$u.put(`/app/device/iot/ring?id=${this.deivceobj.deviceId}`).then((res) => {
|
this.$u.put(`/app/device/iot/ring?id=${this.deivceobj.deviceId}`).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '操作成功',
|
title: '操作成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
|
|
@ -770,10 +770,12 @@
|
||||||
})
|
})
|
||||||
} else if (res.code == 20001) {
|
} else if (res.code == 20001) {
|
||||||
if (this.ver_dataflag == 3) {
|
if (this.ver_dataflag == 3) {
|
||||||
|
uni.hideLoading()
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11play1@"
|
customData: "11play1@"
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
uni.hideLoading()
|
||||||
let that = this
|
let that = this
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
|
|
@ -789,6 +791,7 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
|
|
@ -859,13 +862,13 @@
|
||||||
isHighAccuracy: true,
|
isHighAccuracy: true,
|
||||||
accuracy:'best',
|
accuracy:'best',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('精确坐标:', res);
|
console.log('精确坐标:', res)
|
||||||
this.lat = res.latitude;
|
this.lat = res.latitude
|
||||||
this.lon = res.longitude;
|
this.lon = res.longitude
|
||||||
this.getfeiyong();
|
this.getfeiyong()
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('获取位置失败:', err);
|
console.error('获取位置失败:', err)
|
||||||
this.lat = null
|
this.lat = null
|
||||||
this.lon = null
|
this.lon = null
|
||||||
this.getfeiyong() // 降级处理
|
this.getfeiyong() // 降级处理
|
||||||
|
|
@ -909,7 +912,7 @@
|
||||||
// 计算时间差(毫秒)
|
// 计算时间差(毫秒)
|
||||||
const diffMs = futureDate - now
|
const diffMs = futureDate - now
|
||||||
// 将毫秒转换为天、小时、分钟和秒
|
// 将毫秒转换为天、小时、分钟和秒
|
||||||
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24))
|
||||||
const diffHours = Math.floor((diffMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
|
const diffHours = Math.floor((diffMs % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
|
||||||
const diffMinutes = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60))
|
const diffMinutes = Math.floor((diffMs % (1000 * 60 * 60)) / (1000 * 60))
|
||||||
const diffSeconds = Math.floor((diffMs % (1000 * 60)) / 1000)
|
const diffSeconds = Math.floor((diffMs % (1000 * 60)) / 1000)
|
||||||
|
|
@ -953,6 +956,10 @@
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '还车中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
let data = {
|
let data = {
|
||||||
orderId: that.deivceobj.orderId,
|
orderId: that.deivceobj.orderId,
|
||||||
picture: that.imgs,
|
picture: that.imgs,
|
||||||
|
|
@ -978,6 +985,7 @@
|
||||||
customData: "11close@"
|
customData: "11close@"
|
||||||
})
|
})
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
|
uni.hideLoading()
|
||||||
xBlufi.notifyConnectBle({
|
xBlufi.notifyConnectBle({
|
||||||
isStart: false,
|
isStart: false,
|
||||||
deviceId: that.deviceId,
|
deviceId: that.deviceId,
|
||||||
|
|
@ -1027,6 +1035,10 @@
|
||||||
showCancel: true,
|
showCancel: true,
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '还车中...',
|
||||||
|
mask: true
|
||||||
|
})
|
||||||
let data = {
|
let data = {
|
||||||
orderId: that.deivceobj.orderId,
|
orderId: that.deivceobj.orderId,
|
||||||
picture: that.imgs,
|
picture: that.imgs,
|
||||||
|
|
@ -1057,6 +1069,7 @@
|
||||||
customData: "11llose@"
|
customData: "11llose@"
|
||||||
})
|
})
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
|
uni.hideLoading()
|
||||||
that.getorderdevice()
|
that.getorderdevice()
|
||||||
},1000)
|
},1000)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -315,7 +315,6 @@
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'wgs84',
|
type: 'wgs84',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log(res,'1212121');
|
|
||||||
this.xllat = res.latitude
|
this.xllat = res.latitude
|
||||||
this.xllng = res.longitude
|
this.xllng = res.longitude
|
||||||
},
|
},
|
||||||
|
|
@ -338,14 +337,14 @@
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
this.clearTimer()
|
this.clearTimer()
|
||||||
this.isPageActive = false;
|
this.isPageActive = false
|
||||||
this.closeWebSocket();
|
this.closeWebSocket()
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
this.clearTimer()
|
this.clearTimer()
|
||||||
// 页面隐藏时关闭连接
|
// 页面隐藏时关闭连接
|
||||||
this.isPageActive = false;
|
this.isPageActive = false
|
||||||
this.closeWebSocket();
|
this.closeWebSocket()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 拖动查询中心点的数据
|
// 拖动查询中心点的数据
|
||||||
|
|
@ -376,9 +375,9 @@
|
||||||
parseFloat(item.latitude),
|
parseFloat(item.latitude),
|
||||||
parseFloat(item.longitude)
|
parseFloat(item.longitude)
|
||||||
);
|
);
|
||||||
return distance <= 100;
|
return distance <= 100
|
||||||
}
|
}
|
||||||
return false;
|
return false
|
||||||
});
|
});
|
||||||
// 更新 circles 数组来绘制淡灰色的圆形区域
|
// 更新 circles 数组来绘制淡灰色的圆形区域
|
||||||
this.circles = [{
|
this.circles = [{
|
||||||
|
|
@ -389,17 +388,14 @@
|
||||||
radius: 100, // 圆的半径(单位:米)
|
radius: 100, // 圆的半径(单位:米)
|
||||||
strokeWidth: 1
|
strokeWidth: 1
|
||||||
}]
|
}]
|
||||||
console.log(nearbyMarkers,this.listData,'000');
|
this.nearbyMarkers = nearbyMarkers
|
||||||
this.nearbyMarkers = nearbyMarkers;
|
|
||||||
},
|
},
|
||||||
haversineDistance(lat1, lon1, lat2, lon2) {
|
haversineDistance(lat1, lon1, lat2, lon2) {
|
||||||
const R = 6371e3 // Earth radius in meters
|
const R = 6371e3 // Earth radius in meters
|
||||||
const toRad = angle => angle * Math.PI / 180
|
const toRad = angle => angle * Math.PI / 180
|
||||||
const dLat = toRad(lat2 - lat1)
|
const dLat = toRad(lat2 - lat1)
|
||||||
const dLon = toRad(lon2 - lon1)
|
const dLon = toRad(lon2 - lon1)
|
||||||
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
|
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2)
|
||||||
Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) *
|
|
||||||
Math.sin(dLon / 2) * Math.sin(dLon / 2)
|
|
||||||
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
|
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
|
||||||
return R * c
|
return R * c
|
||||||
},
|
},
|
||||||
|
|
@ -424,19 +420,18 @@
|
||||||
},
|
},
|
||||||
startTimer() {
|
startTimer() {
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
this.count++;
|
this.count++
|
||||||
console.log(`定时器执行,当前计数: ${this.count}`);
|
|
||||||
// 这里替换为你的实际逻辑
|
// 这里替换为你的实际逻辑
|
||||||
this.setMapScale()
|
this.setMapScale()
|
||||||
}, 5000);
|
}, 5000)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 清除定时器
|
// 清除定时器
|
||||||
clearTimer() {
|
clearTimer() {
|
||||||
if (this.timer) {
|
if (this.timer) {
|
||||||
clearInterval(this.timer);
|
clearInterval(this.timer)
|
||||||
this.timer = null;
|
this.timer = null
|
||||||
console.log("定时器已清除");
|
console.log("定时器已清除")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
btnjjqx(){
|
btnjjqx(){
|
||||||
|
|
@ -445,27 +440,27 @@
|
||||||
},
|
},
|
||||||
//WebSocket 自动重连实现
|
//WebSocket 自动重连实现
|
||||||
initWebSocket() {
|
initWebSocket() {
|
||||||
if (!this.isPageActive || !this.deviceMac) return;
|
if (!this.isPageActive || !this.deviceMac) return
|
||||||
let token = uni.getStorageSync('token');
|
let token = uni.getStorageSync('token')
|
||||||
// 关闭已有连接
|
// 关闭已有连接
|
||||||
if (this.socketTask) {
|
if (this.socketTask) {
|
||||||
this.socketTask.close();
|
this.socketTask.close()
|
||||||
this.socketTask = null;
|
this.socketTask = null
|
||||||
}
|
}
|
||||||
// 创建新连接
|
// 创建新连接
|
||||||
this.socketTask = uni.connectSocket({
|
this.socketTask = uni.connectSocket({
|
||||||
url: `wss://ele.ccttiot.com/prod-api/ws/device?token=${token}&mac=${this.deviceMac}`,
|
url: `wss://ele.ccttiot.com/prod-api/ws/device?token=${token}&mac=${this.deviceMac}`,
|
||||||
success: () => {
|
success: () => {
|
||||||
console.log('WebSocket连接建立中...');
|
console.log('WebSocket连接建立中...')
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('WebSocket连接失败:', err);
|
console.error('WebSocket连接失败:', err)
|
||||||
this.scheduleReconnect();
|
this.scheduleReconnect()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 监听连接打开
|
// 监听连接打开
|
||||||
this.socketTask.onOpen(() => {
|
this.socketTask.onOpen(() => {
|
||||||
console.log('WebSocket连接已打开');
|
console.log('WebSocket连接已打开')
|
||||||
this.reconnectAttempts = 0; // 重置重连计数器
|
this.reconnectAttempts = 0; // 重置重连计数器
|
||||||
// 发送订阅消息(如果需要)
|
// 发送订阅消息(如果需要)
|
||||||
this.socketTask.send({
|
this.socketTask.send({
|
||||||
|
|
@ -474,61 +469,55 @@
|
||||||
}),
|
}),
|
||||||
success: () => console.log('订阅消息发送成功'),
|
success: () => console.log('订阅消息发送成功'),
|
||||||
fail: (err) => console.error('订阅消息发送失败:', err)
|
fail: (err) => console.error('订阅消息发送失败:', err)
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
// 监听消息接收
|
// 监听消息接收
|
||||||
this.socketTask.onMessage((res) => {
|
this.socketTask.onMessage((res) => {
|
||||||
console.log('收到实时消息:', res.data);
|
console.log('收到实时消息:', res.data)
|
||||||
this.messages.push(res.data); // 存储消息
|
this.messages.push(res.data) // 存储消息
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(res.data);
|
const data = JSON.parse(res.data)
|
||||||
console.log('解析后的JSON数据:', data);
|
console.log('解析后的JSON数据:', data)
|
||||||
// 这里可以处理具体的业务逻辑
|
// 这里可以处理具体的业务逻辑
|
||||||
this.sockedata = data
|
this.sockedata = data
|
||||||
// this.getqingqiu()
|
this.covers = []
|
||||||
// this.$u.get(`/app/device/listNearBy?radius=10000¢er=${this.jingweidu}`).then((res) => {
|
const newMarkers = []
|
||||||
// if (res.code == 200) {
|
this.parkingList.forEach(item => {
|
||||||
this.covers = []
|
newMarkers.push({
|
||||||
const newMarkers = []
|
id: parseFloat(item.id),
|
||||||
this.parkingList.forEach(item => {
|
latitude: parseFloat(item.latitude),
|
||||||
newMarkers.push({
|
longitude: parseFloat(item.longitude),
|
||||||
id: parseFloat(item.id),
|
width: 40,
|
||||||
latitude: parseFloat(item.latitude),
|
height: 60,
|
||||||
longitude: parseFloat(item.longitude),
|
iconPath: item.type == 1 ?
|
||||||
width: 40,
|
'https://lxnapi.ccttiot.com/bike/img/static/up2xXqAgwCX5iER600k3' :
|
||||||
height: 60,
|
item.type == 2 ?
|
||||||
iconPath: item.type == 1 ?
|
'https://lxnapi.ccttiot.com/bike/img/static/uDNY5Q4zOiZTCBTA2Jdq' :
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/up2xXqAgwCX5iER600k3' :
|
'https://lxnapi.ccttiot.com/bike/img/static/u53BAQcFIX3vxsCzEZ7t',
|
||||||
item.type == 2 ?
|
callout: {
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/uDNY5Q4zOiZTCBTA2Jdq' :
|
content: item.name,
|
||||||
'https://lxnapi.ccttiot.com/bike/img/static/u53BAQcFIX3vxsCzEZ7t',
|
color: '#ffffff',
|
||||||
callout: {
|
fontSize: 14,
|
||||||
content: item.name,
|
borderRadius: 10,
|
||||||
color: '#ffffff',
|
bgColor: item.type == 1 ? '#3A7EDB' : item.type == 2 ? '#FF473E' :
|
||||||
fontSize: 14,
|
'#FFC107',
|
||||||
borderRadius: 10,
|
padding: 6,
|
||||||
bgColor: item.type == 1 ? '#3A7EDB' : item.type == 2 ? '#FF473E' :
|
display: 'ALWAYS'
|
||||||
'#FFC107',
|
},
|
||||||
padding: 6,
|
isCalloutVisible: true // 添加标记
|
||||||
display: 'ALWAYS'
|
})
|
||||||
},
|
})
|
||||||
isCalloutVisible: true // 添加标记
|
this.newMarkers = newMarkers
|
||||||
})
|
this.$set(this, 'covers', [...this.covers, ...newMarkers])
|
||||||
})
|
if(this.sockedata.latitude){
|
||||||
this.newMarkers = newMarkers
|
this.covers.push({
|
||||||
this.$set(this, 'covers', [...this.covers, ...newMarkers])
|
latitude: this.sockedata.latitude,
|
||||||
// this.$set(this, 'covers', [...this.covers, ...this.newMarkers])
|
longitude: this.sockedata.longitude,
|
||||||
if(this.sockedata.latitude){
|
width: 8,
|
||||||
this.covers.push({
|
height: 8,
|
||||||
latitude: this.sockedata.latitude,
|
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uow9Zq3edTUYCVHI9H60',
|
||||||
longitude: this.sockedata.longitude,
|
})
|
||||||
width: 8,
|
}
|
||||||
height: 8,
|
|
||||||
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uow9Zq3edTUYCVHI9H60',
|
|
||||||
})
|
|
||||||
}
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
this.covers.push({
|
this.covers.push({
|
||||||
latitude: data.latitude,
|
latitude: data.latitude,
|
||||||
longitude: data.longitude,
|
longitude: data.longitude,
|
||||||
|
|
@ -537,52 +526,51 @@
|
||||||
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uow9Zq3edTUYCVHI9H60',
|
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uow9Zq3edTUYCVHI9H60',
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('原始消息内容:', res.data);
|
console.log('原始消息内容:', res.data)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// 监听错误
|
// 监听错误
|
||||||
this.socketTask.onError((err) => {
|
this.socketTask.onError((err) => {
|
||||||
console.error('WebSocket错误:', err);
|
console.error('WebSocket错误:', err)
|
||||||
this.scheduleReconnect();
|
this.scheduleReconnect()
|
||||||
});
|
});
|
||||||
// 监听连接关闭
|
// 监听连接关闭
|
||||||
this.socketTask.onClose((res) => {
|
this.socketTask.onClose((res) => {
|
||||||
console.log('WebSocket连接已关闭', res);
|
console.log('WebSocket连接已关闭', res)
|
||||||
if (this.isPageActive) {
|
if (this.isPageActive) {
|
||||||
this.scheduleReconnect();
|
this.scheduleReconnect()
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
// 关闭WebSocket连接
|
// 关闭WebSocket连接
|
||||||
closeWebSocket() {
|
closeWebSocket() {
|
||||||
if (this.socketTask) {
|
if (this.socketTask) {
|
||||||
this.socketTask.close({
|
this.socketTask.close({
|
||||||
success: () => {
|
success: () => {
|
||||||
console.log('WebSocket已主动关闭');
|
console.log('WebSocket已主动关闭')
|
||||||
this.socketTask = null;
|
this.socketTask = null
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error('WebSocket关闭失败:', err);
|
console.error('WebSocket关闭失败:', err)
|
||||||
this.socketTask = null;
|
this.socketTask = null
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 安排重连
|
// 安排重连
|
||||||
scheduleReconnect() {
|
scheduleReconnect() {
|
||||||
if (!this.isPageActive || this.reconnectAttempts >= this.maxReconnectAttempts) {
|
if (!this.isPageActive || this.reconnectAttempts >= this.maxReconnectAttempts) {
|
||||||
console.log('已达到最大重连次数或页面已关闭,停止重连');
|
console.log('已达到最大重连次数或页面已关闭,停止重连')
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
this.reconnectAttempts++;
|
this.reconnectAttempts++;
|
||||||
console.log(`尝试第 ${this.reconnectAttempts} 次重连,等待 ${this.reconnectInterval/1000} 秒...`);
|
console.log(`尝试第 ${this.reconnectAttempts} 次重连,等待 ${this.reconnectInterval/1000} 秒...`)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.initWebSocket();
|
this.initWebSocket()
|
||||||
}, this.reconnectInterval);
|
}, this.reconnectInterval)
|
||||||
// 指数退避策略,增加重连间隔
|
// 指数退避策略,增加重连间隔
|
||||||
this.reconnectInterval = Math.min(this.reconnectInterval * 2, 30000); // 最大不超过30秒
|
this.reconnectInterval = Math.min(this.reconnectInterval * 2, 30000) // 最大不超过30秒
|
||||||
},
|
},
|
||||||
|
|
||||||
// 点击结束订单
|
// 点击结束订单
|
||||||
btnjsdd() {
|
btnjsdd() {
|
||||||
if (this.orderAreaReturnVerify == true) {
|
if (this.orderAreaReturnVerify == true) {
|
||||||
|
|
@ -594,7 +582,6 @@
|
||||||
type: 'gcj02', // 国内地图更兼容
|
type: 'gcj02', // 国内地图更兼容
|
||||||
isHighAccuracy: true,
|
isHighAccuracy: true,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log(res);
|
|
||||||
this.latsc = res.latitude
|
this.latsc = res.latitude
|
||||||
this.lonsc = res.longitude
|
this.lonsc = res.longitude
|
||||||
this.getfeiyong()
|
this.getfeiyong()
|
||||||
|
|
@ -755,7 +742,6 @@
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'wgs84',
|
type: 'wgs84',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log(res);
|
|
||||||
this.latsc = res.latitude
|
this.latsc = res.latitude
|
||||||
this.lngsc = res.longitude
|
this.lngsc = res.longitude
|
||||||
},
|
},
|
||||||
|
|
@ -841,16 +827,12 @@
|
||||||
if (this.orderAreaId == '') {
|
if (this.orderAreaId == '') {
|
||||||
this.covers.filter(item => {
|
this.covers.filter(item => {
|
||||||
if (item.id == id) {
|
if (item.id == id) {
|
||||||
// item.iconPath = 'https://api.ccttiot.com/smartmeter/img/static/uCBNaRAdk9kcgQgrom2G'
|
|
||||||
this.taocanflag = true
|
this.taocanflag = true
|
||||||
this.$u.get(`/app/device/availableDetail?id=${id.slice(0, -1)}`).then((res) => {
|
this.$u.get(`/app/device/availableDetail?id=${id.slice(0, -1)}`).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.cheobj = res.data
|
this.cheobj = res.data
|
||||||
this.areaId = res.data.areaId
|
this.areaId = res.data.areaId
|
||||||
this.getArea()
|
this.getArea()
|
||||||
setTimeout(()=>{
|
|
||||||
// this.getqingqiu()
|
|
||||||
},1000)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -938,7 +920,6 @@
|
||||||
btncheyc() {
|
btncheyc() {
|
||||||
this.taocanflag = false
|
this.taocanflag = false
|
||||||
this.newMarkers = ''
|
this.newMarkers = ''
|
||||||
// this.getqingqiu()
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 点击选择骑行套餐
|
// 点击选择骑行套餐
|
||||||
|
|
@ -1052,7 +1033,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.covers.push(shopCover)
|
this.covers.push(shopCover)
|
||||||
console.log('111112222');
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -1313,7 +1293,9 @@
|
||||||
this.user = res.user
|
this.user = res.user
|
||||||
this.$u.get(`/app/area/nearby?id=${res.user.areaId == null ? '' : res.user.areaId}&radius=1000¢er=${this.jingweidu}`).then((resp) => {
|
this.$u.get(`/app/area/nearby?id=${res.user.areaId == null ? '' : res.user.areaId}&radius=1000¢er=${this.jingweidu}`).then((resp) => {
|
||||||
if (resp.code == 200) {
|
if (resp.code == 200) {
|
||||||
this.yyid = resp.data.id
|
if(resp.data){
|
||||||
|
this.yyid = resp.data.id
|
||||||
|
}
|
||||||
if(resp.data && resp.data.boundaryStr) {
|
if(resp.data && resp.data.boundaryStr) {
|
||||||
const polylines = this.convertBoundaryToPolyline(resp.data.boundaryStr)
|
const polylines = this.convertBoundaryToPolyline(resp.data.boundaryStr)
|
||||||
if(polylines) {
|
if(polylines) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user