panhui před 5 roky
rodič
revize
a0ae8bfeb5

+ 6 - 0
src/main/map/.prettierrc

@@ -0,0 +1,6 @@
+{
+    "semi": true,
+    "singleQuote": true,
+    "tabWidth": 4,
+    "trailingComma": "all"
+}

+ 0 - 6
src/main/map/.prettierrc.js

@@ -1,6 +0,0 @@
-module.exports = {
-    semi: true,
-    singleQuote: true,
-    tabWidth: 4,
-		trailingComma: 'all',
-};

+ 67 - 76
src/main/map/src/views/Home.vue

@@ -15,93 +15,84 @@ export default {
     data() {
         return {
             map: null,
-						userMarker:null,
-						merchantMarKer:null,
-						riderMarKer:null,
-						center:null,
-						location:null,
-						merchantLocation:null,
-						riderLocation:null,
+            userMarker: null,
+            merchantMarKer: null,
+            riderMarKer: null,
+            center: null,
+            location: null,
+            merchantLocation: null,
+            riderLocation: null,
         };
     },
     mounted() {
-        window.setLocation=this.setLocation
+        window.setLocation = this.setLocation;
     },
     methods: {
-			setLocation(orderInfo,location,merchantLocation,riderLocation){
-	
-				this.nowStatus=getStatusInfo(JSON.parse(orderInfo))
-				this.location=JSON.parse(location)
-				this.merchantLocation=JSON.parse(merchantLocation)
-				this.riderLocation=JSON.parse(riderLocation)
-				
-				if (
-                	this.nowStatus.nowImgType === 'merchant' &&
-                merchantLocation
-            ) {
-                this.center= merchantLocation
-            } else if (
-                	this.nowStatus.nowImgType === 'rider' &&
-               riderLocation
-            ) {
-                 this.center= riderLocation
+        setLocation(orderInfo, location, merchantLocation, riderLocation) {
+            this.nowStatus = getStatusInfo(orderInfo);
+            this.location = location;
+            this.merchantLocation = merchantLocation;
+            this.riderLocation = riderLocation;
+
+            if (this.nowStatus.nowImgType === 'merchant' && merchantLocation) {
+                this.center = merchantLocation;
+            } else if (this.nowStatus.nowImgType === 'rider' && riderLocation) {
+                this.center = riderLocation;
             } else {
-								 this.center= location
+                this.center = location;
             }
 
-        this.$nextTick(() => {
-					this.initMap();
-        });
-			},
+            this.$nextTick(() => {
+                this.initMap();
+            });
+        },
         initMap() {
             // 初始化地图
-           if(!this.map){
-						  this.map = new TMap.Map('container', {
-                zoom: 15, // 设置地图缩放级别
-                center: new TMap.LatLng(this.center.lat, this.center.lng), // 设置地图中心点坐标
-                doubleClickZoom: false,
-            });
-					 }
-					 else{
-						 		this.map.setCenter(new TMap.LatLng(this.center.lat, this.center.lng))
-				 }
+            if (!this.map) {
+                this.map = new TMap.Map('container', {
+                    zoom: 15, // 设置地图缩放级别
+                    center: new TMap.LatLng(this.center.lat, this.center.lng), // 设置地图中心点坐标
+                    doubleClickZoom: false,
+                });
+            } else {
+                this.map.setCenter(
+                    new TMap.LatLng(this.center.lat, this.center.lng),
+                );
+            }
 
-				 if(	this.userMarker){
-					 this.userMarker.setMap(null)
-				 }
-            		this.userMarker=new Marker({
-                    map: this.map,
-                    position: new TMap.LatLng(
-                        this.location.lat,
-                        this.location.lng,
-                    ),
-                    type: 'user',
-                    nowStatus: this.nowStatus,
-								})
-									 if(this.merchantMarKer){
-					 this.merchantMarKer.setMap(null)
-				 }
-								this.merchantMarKer=new Marker({
-                    map: this.map,
-                    position: new TMap.LatLng(
-                        this.merchantLocation.lat,
-                        this.merchantLocation.lng,
-                    ),
-                    type: 'merchant',
-                    nowStatus: this.nowStatus,
-								});
-									 if(this.riderMarKer){
-					 this.riderMarKer.setMap(null)
-				 }
-								this.riderMarKer= new Marker({
-                    map: this.map,
-                    position: new TMap.LatLng(
-                      this.riderLocation.lat,
-                      this.riderLocation.lng,
-                    ),
-                    type: 'rider',
-                    nowStatus: this.nowStatus,
-								})
+            if (this.userMarker) {
+                this.userMarker.setMap(null);
+            }
+            this.userMarker = new Marker({
+                map: this.map,
+                position: new TMap.LatLng(this.location.lat, this.location.lng),
+                type: 'user',
+                nowStatus: this.nowStatus,
+            });
+            if (this.merchantMarKer) {
+                this.merchantMarKer.setMap(null);
+            }
+            this.merchantMarKer = new Marker({
+                map: this.map,
+                position: new TMap.LatLng(
+                    this.merchantLocation.lat,
+                    this.merchantLocation.lng,
+                ),
+                type: 'merchant',
+                nowStatus: this.nowStatus,
+            });
+            if (this.riderMarKer) {
+                this.riderMarKer.setMap(null);
+            }
+            this.riderMarKer = new Marker({
+                map: this.map,
+                position: new TMap.LatLng(
+                    this.riderLocation.lat,
+                    this.riderLocation.lng,
+                ),
+                type: 'rider',
+                nowStatus: this.nowStatus,
+            });
         },
     },
 };