fix: 增加Route中Ship类型时的移动图片

This commit is contained in:
Xu Zhimeng 2024-10-12 13:53:05 +08:00
parent 47aaa0d794
commit 653ba9a7c8
4 changed files with 16 additions and 8 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@ dist
## front
/yarn-error.log
dist.zip
.vscode/settings.json

View File

@ -135,8 +135,12 @@ export default {
)
},
// 线
animateByRoute(coordinates) {
/**
* 按路线运动
* @param coordinates 坐标
* @param { 'Car' | 'Ship' } type 类型
*/
animateByRoute(coordinates, type) {
if (!coordinates) {
return
}
@ -158,7 +162,7 @@ export default {
},
{
image: new Icon({
src: MarkerIcon[MarkerType.Car],
src: MarkerIcon[MarkerType[type]],
anchor: [0.65, 0.5],
}),
},

View File

@ -553,7 +553,7 @@ export default {
// 使
if (active == 3) {
if (this.lastRoute) {
this.$emit('drawRoute', this.lastRoute)
this.$emit('drawRoute', this.lastRoute, this.lastRouteType)
}
this.$emit('changeMarker', [])
@ -912,8 +912,10 @@ export default {
}
this.lastRoute = result.map(({ lon, lat }) => [lon, lat])
const find = this.stationSelectOptions.find((item) => item.value == this.routeParams.stationCode)
this.lastRouteType = find ? find.stationType : 'Car'
this.$emit('drawRoute', this.lastRoute)
this.$emit('drawRoute', this.lastRoute, this.lastRouteType)
} else {
this.$message.error(message)
}
@ -945,9 +947,10 @@ export default {
stationSelectOptions() {
return this.originalDataList
.filter(({ stationType }) => stationType == 'Car' || stationType == 'Ship')
.map(({ stationName: label }) => ({
.map(({ stationName: label, stationType }) => ({
label,
value: label,
stationType,
}))
},
},

View File

@ -565,8 +565,8 @@ export default {
},
//
handleDrawRoute(routes) {
this.$refs.mapRef.animateByRoute(routes)
handleDrawRoute(routes, type) {
this.$refs.mapRef.animateByRoute(routes, type)
},
},
}