Commit 58407caf by ym

map

1 parent 43410487
...@@ -128,51 +128,24 @@ export default { ...@@ -128,51 +128,24 @@ export default {
}; };
}, },
mounted() { mounted() {
// this.getOilNoList();
let longitude, latitude;
if (this.$store.state.address.longitude) {
longitude = this.$store.state.address.longitude;
latitude = this.$store.state.address.latitude;
}
if (longitude) {
this.mapChange({ longitude, latitude });
} else {
const ua = navigator.userAgent.toLowerCase(); const ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == "micromessenger") { if (ua.match(/MicroMessenger/i) == "micromessenger") {
this.getLocation(); this.getLocation();
} else { } else {
this.getMapLocation(); this.getMapLocation();
} }
// this.listeningBack();
this.getOilNoList();
// let longitude, latitude;
// if (this.$store.state.address.longitude) {
// longitude = this.$store.state.address.longitude;
// latitude = this.$store.state.address.latitude;
// }
// if (longitude) {
// this.mapChange({ longitude, latitude });
// } else {
// const ua = navigator.userAgent.toLowerCase();
// if (ua.match(/MicroMessenger/i) == "micromessenger") {
// this.getLocation();
// } else {
// this.getMapLocation();
// }
// }
},
methods: {
listeningBack() {
const path = window.vm.$store.state.prevPath;
window.onpopstate = null;
window.onpopstate = function () {
window.onpopstate = null;
history.pushState({}, null, window.location.href);
if (
path == "oilStation.location" ||
path == "oilStation.detail" ||
path == "oilStation.record"
) {
window.vm.$router.replace({ name: window.vm.$store.state.prevPath });
if (sessionStorage.getItem("common") == 1) {
window.vm.$router.replace({ name: "equity.index" });
} else {
window.vm.$router.replace({ name: "common.index" });
}
} }
};
}, },
methods: {
mapChange(e) { mapChange(e) {
AMap.plugin("AMap.Geocoder", () => { AMap.plugin("AMap.Geocoder", () => {
const geocoder = new AMap.Geocoder(); const geocoder = new AMap.Geocoder();
...@@ -209,7 +182,7 @@ export default { ...@@ -209,7 +182,7 @@ export default {
timeout: 10000, //超过10秒后停止定位,默认:5s timeout: 10000, //超过10秒后停止定位,默认:5s
buttonPosition: "RB", //定位按钮的停靠位置 buttonPosition: "RB", //定位按钮的停靠位置
buttonOffset: new AMap.Pixel(10, 20), //定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20) buttonOffset: new AMap.Pixel(10, 20), //定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
zoomToAccuracy: true, //定位成功后是否自动调整地图视野到定位点 zoomToAccuracy: false, //定位成功后是否自动调整地图视野到定位点
}); });
geolocation.getCurrentPosition(function (status, result) { geolocation.getCurrentPosition(function (status, result) {
if (status == "complete") { if (status == "complete") {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!