This commit is contained in:
tx 2024-08-29 09:52:00 +08:00
parent 1627996c8a
commit d47f9ecfe9
4 changed files with 267 additions and 203 deletions

View File

@ -1,15 +1,15 @@
const install = (Vue, vm) => { const install = (Vue, vm) => {
uni.setStorageSync('deptId', 101); uni.setStorageSync('deptId', 100);
Vue.prototype.$u.http.setConfig({ Vue.prototype.$u.http.setConfig({
// baseUrl: 'http://61.174.243.28:15861', // baseUrl: 'http://61.174.243.28:15861',
// baseUrl: 'http://192.168.2.46:8080', // baseUrl: 'http://192.168.2.46:8080',
// baseUrl: 'https://che.chuangtewl.com/prod-api', // baseUrl: 'https://che.chuangtewl.com/prod-api',
// 测试环境 // 测试环境
baseUrl: 'https://dianche.chuantewulian.cn/prod-api', // baseUrl: 'https://dianche.chuantewulian.cn/prod-api',
// 俞山岛 // 俞山岛
// baseUrl: 'https://dche.ccttiot.com/prod-api', baseUrl: 'https://dche.ccttiot.com/prod-api',
// 创特 // 创特
loadingText: '努力加载中~', loadingText: '努力加载中~',
loadingTime: 10000, loadingTime: 10000,

View File

@ -51,7 +51,7 @@
/* */ /* */
"mp-weixin" : { "mp-weixin" : {
"libVersion" : "latest", "libVersion" : "latest",
"appid" : "wx4d178f8c80348214", "appid" : "wx3428c498d5061192",
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : false,
"minified" : true "minified" : true

View File

@ -777,7 +777,7 @@
if (res.code == 200) { if (res.code == 200) {
if(this.orderinfo.areaId==res.data.areaId){ if(this.orderinfo.areaId==res.data.areaId){
this.deviceinfo = res.data this.deviceinfo = res.data
this.deviceinfo.onlineStatus=0 // this.deviceinfo.onlineStatus=0
}else{ }else{
uni.showToast({ uni.showToast({
title: '换车设备和当前运营区不同,请使用其他车辆换车', title: '换车设备和当前运营区不同,请使用其他车辆换车',

View File

@ -12,14 +12,19 @@
<view style="width: 650rpx;margin: 0 auto;"> <view style="width: 650rpx;margin: 0 auto;">
<slider-range :value="rangeValue" :min="rangeMin" :max="rangMax" :step="1" :bar-height="3" <slider-range :value="rangeValue" :min="rangeMin" :max="rangMax" :step="1" :bar-height="3"
:block-size="20" background-color="#EEEEF6" active-color="#4C97E7" :format="format" :block-size="20" background-color="#EEEEF6" active-color="#4C97E7" :format="format"
:decorationVisible="true" @change="handleRangeChange" @regionchange="onMapRegionChange"></slider-range> :decorationVisible="true" @change="handleRangeChange"
@regionchange="onMapRegionChange"></slider-range>
</view> </view>
</view> </view>
</view> </view>
<map class="map" id="map" ref="map" :scale="zoomSize" :latitude="latitude" :longitude="longitude" :circles="circles" <map class="map" id="map" ref="map" :scale="zoomSize" :latitude="latitude" :longitude="longitude"
:show-location="true" :markers="markers" :polygons="polyline" @markertap="onMarkerTap" @regionchange="onMapRegionChange"> :circles="circles" :show-location="true" :markers="markers" :polygons="polyline" @markertap="onMarkerTap"
@regionchange="onMapRegionChange">
<view class="center-marker">
<image src="/static/center-point.png" style="width: 30px; height: 30px;" />
</view>
</map> </map>
<view class="park" @click="toggleIconAndCallout"> <view class="park" @click="toggleIconAndCallout">
<image src="https://lxnapi.ccttiot.com/bike/img/static/uRiYQZQEb3l2LsltEsyW" mode=""></image> <image src="https://lxnapi.ccttiot.com/bike/img/static/uRiYQZQEb3l2LsltEsyW" mode=""></image>
@ -149,9 +154,12 @@
:{{item.vehicleNum}} :{{item.vehicleNum}}
</view> </view>
<view class="right_top_left"> <view class="right_top_left">
<image src=" https://lxnapi.ccttiot.com/bike/img/static/u9pggdTCxcZgUTNsEvXQ" mode="" v-if="item.remainingPower<=39" ></image> <image src=" https://lxnapi.ccttiot.com/bike/img/static/u9pggdTCxcZgUTNsEvXQ" mode=""
<image src="https://lxnapi.ccttiot.com/bike/img/static/uu1004113wsUShxo11X9" mode="" v-if="item.remainingPower>=40&&item.remainingPower<=69"></image> v-if="item.remainingPower<=39"></image>
<image src="https://lxnapi.ccttiot.com/bike/img/static/uRI1LMpzqfIM060BO7np" mode="" v-if="item.remainingPower>=70&&item.remainingPower<=100"></image> <image src="https://lxnapi.ccttiot.com/bike/img/static/uu1004113wsUShxo11X9" mode=""
v-if="item.remainingPower>=40&&item.remainingPower<=69"></image>
<image src="https://lxnapi.ccttiot.com/bike/img/static/uRI1LMpzqfIM060BO7np" mode=""
v-if="item.remainingPower>=70&&item.remainingPower<=100"></image>
{{item.remainingPower}}% {{item.remainingPower}}%
</view> </view>
@ -172,6 +180,7 @@
<script> <script>
import SliderRange from '@/pages_admin/components/primewind-sliderrange/index.vue' import SliderRange from '@/pages_admin/components/primewind-sliderrange/index.vue'
let timerId; let timerId;
var appMap = null;
export default { export default {
data() { data() {
return { return {
@ -239,7 +248,8 @@
this.getArea() this.getArea()
} }
appMap = uni.createMapContext("map", this).$getAppMap();
appMap.showUserLocation(true);
let that = this let that = this
uni.getLocation({ uni.getLocation({
type: 'wgs84', type: 'wgs84',
@ -292,19 +302,13 @@
return '禁用中' return '禁用中'
} }
}, },
onMapRegionChange(event) {
// console.log('regionchange', event)
// console.log('', event.detail.scale);
if (event.detail.type == 'end'&&event.detail.scale>17) {
this.getCenterLanLat()
}
//
},
onMapRegionChange(event) { onMapRegionChange(event) {
// console.log('regionchange', event) // console.log('regionchange', event)
if (event.detail.type == 'end') { if (event.detail.type == 'end') {
this.getCenterLanLat() this.getCenterLocation()
// this.getCenter()
} }
// //
}, },
@ -316,15 +320,63 @@
// console.log("", res) // console.log("", res)
// that.deviceGps.latitude = res.latitude; // that.deviceGps.latitude = res.latitude;
// that.deviceGps.longitude = res.longitude; // that.deviceGps.longitude = res.longitude;
this.getNearbyMarkers(res.latitude, res.longitude);
// //
}, },
fail: (err) => {} fail: (err) => {}
}) })
}, },
getCenterLocation() {
const mapContext = uni.createMapContext('map');
mapContext.getCenterLocation({
success: (res) => {
console.log('中心点的经纬度:', res.longitude, res.latitude);
this.getNearbyMarkers(res.latitude, res.longitude);
},
fail: (err) => {
console.error('获取中心点定位失败:', err);
}
});
},
getCenter: function() {
var _that = this;
appMap.getCurrentCenter(
function(state, point) {
if (0 == state) {
//
var point = new plus.maps.Point(point["longitude"], point["latitude"]);
plus.maps.Map.reverseGeocode(point, {}, function(event) {
var address = event.address; //
var coord = event.coord; //
var coordType = event.coordType; //
console.log("Address:" + address);
console.log("coord", coord);
uni.showModal({
title: "提示",
content: "确定:" + address + "?",
success: function(res) {
if (res.confirm) {
// ...
} else if (res.cancel) {}
}
})
}, function(e) {
// console.log("Failed:" + JSON.stringify(e));
uni.showToast({
title: '反编码失败' + JSON.stringify(e)
});
});
} else {
uni.showToast({
icon: "none",
title: "获取经纬度失败!" + state
})
}
}
);
},
getNearbyMarkers(clickedLat, clickedLon) { getNearbyMarkers(clickedLat, clickedLon) {
console.log(clickedLat, clickedLon); // console.log(clickedLat, clickedLon);
// showdevList true // showdevList true
if (this.showdevList) { if (this.showdevList) {
@ -352,7 +404,7 @@
}]; }];
this.nearbyMarkers = nearbyMarkers; this.nearbyMarkers = nearbyMarkers;
console.log('Nearby markers within 100 meters:', nearbyMarkers); // console.log('Nearby markers within 100 meters:', nearbyMarkers);
} else { } else {
// showdevList false circles // showdevList false circles
this.circles = []; this.circles = [];
@ -437,7 +489,8 @@
// console.log(this.areaId,); // console.log(this.areaId,);
if (res.data.areaId == this.areaId) { if (res.data.areaId == this.areaId) {
uni.navigateTo({ uni.navigateTo({
url: '/pages_admin/order/device_detail?id=' + this.sn url: '/pages_admin/order/device_detail?id=' + this
.sn
}) })
} else { } else {
uni.showToast({ uni.showToast({
@ -633,9 +686,9 @@
width: 20, width: 20,
height: 23, height: 23,
// iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/u6jBvj7S50FPgsHaHXai', // 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',
callout: { callout: {
content: '' + item.remainingPower + '%', // content: '' + item.remainingPower + '%', //
color: '#ffffff', // color: '#ffffff', //
@ -659,9 +712,9 @@
width: 20, width: 20,
// joinCluster: true, // joinCluster: true,
height: 23, height: 23,
iconPath: item.onlineStatus == 0 iconPath: item.onlineStatus == 0 ?
? 'https://lxnapi.ccttiot.com/bike/img/static/uzhMeExOQJbMcZtrfGUV' 'https://lxnapi.ccttiot.com/bike/img/static/uzhMeExOQJbMcZtrfGUV' :
: 'https://lxnapi.ccttiot.com/bike/img/static/uheL17wVZn24BwCwEztT', 'https://lxnapi.ccttiot.com/bike/img/static/uheL17wVZn24BwCwEztT',
// iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/uAajBTcihvOr9HttyWck', // iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/uAajBTcihvOr9HttyWck',
callout: { callout: {
content: '' + item.remainingPower + '%', // content: '' + item.remainingPower + '%', //
@ -683,9 +736,9 @@
width: 20, width: 20,
height: 23, height: 23,
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', // iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/um0qXpcbA32WdwqtHbxy',
callout: { callout: {
content: '' + item.remainingPower + '%', // content: '' + item.remainingPower + '%', //
@ -707,9 +760,9 @@
width: 20, width: 20,
height: 23, height: 23,
// joinCluster: true, // joinCluster: true,
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', // iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/ur1ZrncDJ1WwuPJeiMG6',
callout: { callout: {
content: '' + item.remainingPower + '%', // content: '' + item.remainingPower + '%', //
@ -731,9 +784,9 @@
width: 20, width: 20,
height: 23, height: 23,
// joinCluster: true, // joinCluster: true,
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', // iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/uN4ksL0Z2HM4C07fKEOF',
callout: { callout: {
content: '' + item.remainingPower + '%', // content: '' + item.remainingPower + '%', //
@ -755,9 +808,9 @@
width: 20, width: 20,
height: 23, height: 23,
// joinCluster: true, // joinCluster: true,
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', // iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/uxbI6ZclpS3WQCfPO1zr',
callout: { callout: {
content: '' + item.remainingPower + '%', // content: '' + item.remainingPower + '%', //
@ -778,9 +831,9 @@
// title: item.deviceName, // title: item.deviceName,
width: 20, width: 20,
height: 23, height: 23,
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', // iconPath: 'https://lxnapi.ccttiot.com/bike/img/static/uYIFwg5IJ4Axh7TfJ7q6',
callout: { callout: {
content: '' + item.remainingPower + '%', // content: '' + item.remainingPower + '%', //
@ -939,12 +992,15 @@
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.latitude, marker.longitude); const distance = this.calculateDistance(cluster.latitude, cluster.longitude, marker
.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.markers.length + 1); cluster.latitude = (cluster.latitude * cluster.markers.length + marker.latitude) / (
cluster.longitude = (cluster.longitude * cluster.markers.length + marker.longitude) / (cluster.markers.length + 1); cluster.markers.length + 1);
cluster.longitude = (cluster.longitude * cluster.markers.length + marker.longitude) / (
cluster.markers.length + 1);
added = true; added = true;
break; break;
} }
@ -1074,6 +1130,13 @@
.page { .page {
width: 750rpx; width: 750rpx;
.center-marker {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -100%); /* 定位在中心点上方 */
pointer-events: none; /* 使其不可点击 */
}
.fixdivce { .fixdivce {
padding: 12rpx 22rpx 12rpx 22rpx; padding: 12rpx 22rpx 12rpx 22rpx;
position: fixed; position: fixed;
@ -1084,9 +1147,11 @@
background: #FFFFFF80; background: #FFFFFF80;
border-radius: 0 40rpx 40rpx 0; border-radius: 0 40rpx 40rpx 0;
box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0, 0, 0, 0.3); box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0, 0, 0, 0.3);
.scrollable-content::-webkit-scrollbar { .scrollable-content::-webkit-scrollbar {
display: none; display: none;
} }
.scrollable-content { .scrollable-content {
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
@ -1136,9 +1201,7 @@
} }
} }
.right_top_right { .right_top_right {}
}
} }
.right_bot { .right_bot {
@ -1152,6 +1215,7 @@
} }
} }
} }
.decice_cont { .decice_cont {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;