<template>
<!-- 运单跟中详情地图 -->
<div style="height:900px;">
<el-amap vid="amapDemo" :zoom="zoom" :center="[longitudes,latitude]" class="amap-demo">
<el-amap-marker :position="[longitude,latitude]"></el-amap-marker>
</el-amap>
</div>
</template>
<script>
import { nowPhoneGPS, nowBeiDouGPS } from "@/api/gpsMap";
export default {
data() {
return {
zoom: 14,
longitudes: "1",
latitudes: "3",
returnData: [],
longitude: "2",
latitude: "7"
};
},
created() {
if (this.$route.query.grabsingleId) {
this.getNowPhoneGPS();
}
if (this.$route.query.plateNumber) {
this.getNowBeiDouGPS();
}
},
methods: {
getNowPhoneGPS() {
nowPhoneGPS({ grabSingleId: this.$route.query.grabsingleId }).then(
response => {
if (response.code === 0) {
this.returnData = response.data[0];
if (this.returnData.latitude || this.returnData.longitude) {
this.longitudes = this.returnData.longitude;
this.latitude = this.returnData.latitude;
if (this.longitudes || this.latitude) {
this.longitude = this.returnData.longitude;
this.latitude = this.returnData.latitude;
}
}
}else{
this.$message.error(response.msg)
}
}
);
},
getNowBeiDouGPS() {
nowBeiDouGPS({ plateNumber: "京A99999" }).then(response => {
if (response.code === 0) {
this.returnData = response.data[0];
if (this.returnData.latitude || this.returnData.longitude) {
this.longitudes = this.returnData.longitude;
this.latitude = this.returnData.latitude;
if (this.longitudes || this.latitude) {
this.longitude = this.returnData.longitude;
this.latitude = this.returnData.latitude;
}
}
}else{
this.$message.error(response.msg)
}
});
}
}
};
</script>
<style>
</style>
gps实时定位
最新推荐文章于 2023-02-06 20:55:50 发布