更新
This commit is contained in:
@@ -152,7 +152,6 @@
|
||||
},
|
||||
methods: {
|
||||
showSite() {
|
||||
console.log('footerScroll this.markers',this.markers)
|
||||
let markers = encodeURIComponent(JSON.stringify(this.markers))
|
||||
uni.navigateTo({
|
||||
url:`/BagStation/pages/newRoutePlanning/siteList?markers=${markers}`
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
:selePrice='selePrice' @dragMap='dragMap' :details='details' :polyline="polyline"
|
||||
@mapEventListeners='mapEventListeners' :markers="markers" />
|
||||
<view class="map_body">
|
||||
<map @bindregionchange='bindregionchange' @tap='poitap' @updated='mapUpdated' :scale='mapScale'
|
||||
@callouttap='callouttap' :enable-scroll='enableScroll' @markertap='markertap' :polyline="polyline"
|
||||
<map @tap='poitap' @updated='mapUpdated' :scale='mapScale' @callouttap='callouttap'
|
||||
:enable-scroll='enableScroll' @markertap='markertap' :polyline="polyline"
|
||||
subkey="UTXBZ-BUH6D-TQD44-HCEG4-UKOFT-U2BDN" layer-style='2' id="map_Id" :show-location="true"
|
||||
:markers="markers" class="map_xx" :latitude="coordinate.latitude" :longitude="coordinate.longitude">
|
||||
<cover-view slot="callout">
|
||||
@@ -72,7 +72,8 @@
|
||||
details: {},
|
||||
spareMarkers: [],
|
||||
selePrice: null,
|
||||
mapScale: 16
|
||||
mapScale: 16,
|
||||
firstLocation: {}
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
@@ -92,21 +93,18 @@
|
||||
perspectives(item) {
|
||||
let {
|
||||
latitude,
|
||||
longitude
|
||||
longitude,
|
||||
siteId
|
||||
} = item
|
||||
setTimeout(() => {
|
||||
this.newMapMoveToLocation(longitude, latitude, 'reset')
|
||||
}, 500)
|
||||
},
|
||||
bindregionchange(e) {
|
||||
console.log(e, '***********')
|
||||
},
|
||||
|
||||
mapUpdated(e) {
|
||||
let that = this
|
||||
console.log('更新', e);
|
||||
that.mapContext.getScale({
|
||||
this.mapContext.getScale({
|
||||
success: function(e) {
|
||||
console.log(e, '当前缩放比例')
|
||||
console.log('地图渲染回调,当前缩放系数:', e)
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -147,6 +145,7 @@
|
||||
|
||||
this.spareMarkers = this.locationProcessing(markerList);
|
||||
this.markers = await this.filterMarkers(JSON.parse(JSON.stringify(this.spareMarkers)));
|
||||
this.mapScale = 10
|
||||
break;
|
||||
case 'localScreen':
|
||||
// 手动筛选 备份下数据
|
||||
@@ -179,7 +178,6 @@
|
||||
this.markers = this.filterMarkers(this.markers,this.$refs.footerScroll.filter());
|
||||
},0)
|
||||
*/
|
||||
|
||||
break;
|
||||
case 'MoveToLocation':
|
||||
arguments[1] ? (this.newMapMoveToLocation(this.Route.start.longitude, this.Route.start
|
||||
@@ -198,7 +196,7 @@
|
||||
// 更新路线规划
|
||||
async mapRoutePlanning(start = this.Route.start, end = this.Route.end, strategy = 'LEAST_TIME') {
|
||||
// 获取路径
|
||||
let res = await this.getMapRoutePlanning(start, end, strategy);
|
||||
let res = await this.getMapRoutePlanning(start, end);
|
||||
//处理数据
|
||||
this.polyline = this.RoutePlanningHandle(res);
|
||||
//缩放显示所有经纬度
|
||||
@@ -266,7 +264,11 @@
|
||||
})
|
||||
},
|
||||
//获取路线规划
|
||||
getMapRoutePlanning(start, end, strategy = 'LEAST_TIME') {
|
||||
getMapRoutePlanning(start, end) {
|
||||
let {
|
||||
seleIndex
|
||||
} = this.$refs.footerScroll.$data
|
||||
|
||||
var _this = this;
|
||||
return new Promise(function(res, rej) {
|
||||
_this.TXSDK.direction({
|
||||
@@ -274,7 +276,7 @@
|
||||
mode: 'driving',
|
||||
from: start,
|
||||
to: end,
|
||||
policy: strategy,
|
||||
policy: seleIndex || 'LEAST_TIME',
|
||||
success: function(e) {
|
||||
console.log('获取路线规划成功')
|
||||
res(e)
|
||||
@@ -324,12 +326,6 @@
|
||||
zoomRoutePlanning(points, padding) {
|
||||
let that = this
|
||||
let system = uni.getSystemInfoSync().platform;
|
||||
// setTimeout(()=>{
|
||||
// uni.showToast({
|
||||
// title: system,
|
||||
// icon: 'none'
|
||||
// })
|
||||
// },1000)
|
||||
try {
|
||||
let paddingTop = this.$refs.addressSelector.getElement();
|
||||
this.mapContext.includePoints({
|
||||
@@ -361,14 +357,20 @@
|
||||
},
|
||||
//更新markers点
|
||||
async mapUpdateMarkers(points = this.polyline[0].points, oilProductCode = '0#', juLi = '5', siteChannel = '') {
|
||||
//标记
|
||||
let {
|
||||
latitude,
|
||||
longitude
|
||||
} = this.firstLocation
|
||||
|
||||
let data = {
|
||||
geoList: points,
|
||||
oilProductCode: oilProductCode ? oilProductCode : '0#',
|
||||
juLi: juLi ? juLi : '5',
|
||||
siteChannel: siteChannel,
|
||||
countJuLi: points[0].distance,
|
||||
latitude: this.coordinate.latitude,
|
||||
longitude: this.coordinate.longitude
|
||||
latitude: latitude || this.coordinate.latitude,
|
||||
longitude: longitude || this.coordinate.longitude
|
||||
}
|
||||
let taht = this;
|
||||
return new Promise(function(re, rj) {
|
||||
@@ -393,11 +395,10 @@
|
||||
},
|
||||
//定位处理
|
||||
locationProcessing(markerList) {
|
||||
// console.log(markerList, '----')
|
||||
markerList.forEach((item, index) => {
|
||||
let configure = {
|
||||
siteId: item.id,
|
||||
id: Number(`${index}`),
|
||||
id: Number(`${index}`), //2023.08.30 在此处踩坑 一作这b竟然把id重新赋值了
|
||||
imgCustomCallout: this.olitype(item.siteChannel),
|
||||
iconPath: '../../static/img/tt.png',
|
||||
width: 5,
|
||||
@@ -417,13 +418,11 @@
|
||||
//点击气泡事件
|
||||
async callouttap(e) {
|
||||
let seleMark = this.markers.filter(item => item.id == e.detail.markerId);
|
||||
// this.enableScroll = true
|
||||
let details = await oilSiteApi.getSiteDetails({
|
||||
latitude: String(this.coordinate.latitude),
|
||||
longitude: String(this.coordinate.longitude),
|
||||
latitude: String(this.firstLocation.latitude),
|
||||
longitude: String(this.firstLocation.longitude),
|
||||
siteId: seleMark[0].siteId
|
||||
});
|
||||
// console.log(details, '***')
|
||||
if (details.code !== 20000) {
|
||||
uni.showToast({
|
||||
title: details.msg,
|
||||
@@ -441,16 +440,25 @@
|
||||
},
|
||||
//获取当前位置
|
||||
getCurrentLocation() {
|
||||
let that = this
|
||||
// let that = this
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
success: function(res) {
|
||||
({
|
||||
latitude: that.coordinate.latitude,
|
||||
longitude: that.coordinate.longitude
|
||||
} = res);
|
||||
that.myLocation = res;
|
||||
that.Route.start = Object.assign(that.Route.start, that.coordinate);
|
||||
success: (res) => {
|
||||
// ({
|
||||
// latitude: that.coordinate.latitude,
|
||||
// longitude: that.coordinate.longitude
|
||||
// } = res);
|
||||
let {
|
||||
latitude,
|
||||
longitude
|
||||
} = res
|
||||
this.coordinate.latitude = latitude
|
||||
this.firstLocation.latitude = latitude
|
||||
|
||||
this.coordinate.longitude = longitude
|
||||
this.firstLocation.longitude = longitude
|
||||
this.myLocation = res;
|
||||
this.Route.start = Object.assign(this.Route.start, this.coordinate);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -460,19 +468,18 @@
|
||||
this.mapContext.moveToLocation({
|
||||
longitude: longitude,
|
||||
latitude: latitude,
|
||||
success(e) {
|
||||
success: (e) => {
|
||||
console.log(`移动 坐标→ ${longitude}-${latitude}`);
|
||||
if (type) {
|
||||
that.coordinate.latitude = latitude
|
||||
that.coordinate.longitude = longitude
|
||||
that.mapContext.getScale({
|
||||
success: function(e) {
|
||||
setTimeout(() => {
|
||||
that.mapScale = e.scale;
|
||||
setTimeout(() => {
|
||||
that.mapScale = 13
|
||||
}, 500)
|
||||
}, 500)
|
||||
this.coordinate.latitude = latitude
|
||||
this.coordinate.longitude = longitude
|
||||
|
||||
this.mapContext.getScale({
|
||||
success: res => {
|
||||
this.mapScale = res.scale
|
||||
this.$nextTick(() => {
|
||||
this.mapScale = 13
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
if (!options.markers) return
|
||||
let markers = JSON.parse(decodeURIComponent(options.markers))
|
||||
this.siteList = markers
|
||||
console.log('site markers', markers)
|
||||
},
|
||||
filters: {
|
||||
adjust(val) {
|
||||
|
||||
Reference in New Issue
Block a user