温红权 3 년 전
부모
커밋
82d6989e02
1개의 변경된 파일11개의 추가작업 그리고 3개의 파일을 삭제
  1. 11 3
      ruoyi-ui/src/components/map/index.vue

+ 11 - 3
ruoyi-ui/src/components/map/index.vue

@@ -18,6 +18,8 @@ import { Point,LineString } from "ol/geom";
 import { Style, Icon,Stroke } from "ol/style";
 import { Vector as LayerVec } from "ol/layer";
 
+let ispro = process.env.NODE_ENV === "production";
+//  ispro = false;
 export default {
   props: {
     src: {
@@ -34,7 +36,7 @@ export default {
   },
   mounted() {
     var that = this;
-    if (process.env.NODE_ENV === "production") {
+    if (ispro) {
       this.initprod();
     } else {
       this.initdev();
@@ -65,7 +67,7 @@ export default {
   methods: {
     //[[1111,1111]]
     transpoints: function(points, type) {
-      if (process.env.NODE_ENV === "production") {
+      if (ispro) {
         return points;
       } else {
         if (type == 1) {
@@ -122,7 +124,8 @@ export default {
         target: "map",
         layers: [ign],
         view: new View({
-          zoom: 10
+          center: [0, 0],
+          zoom: 2
         })
       });
       map
@@ -136,7 +139,10 @@ export default {
           ],
           map.getSize()
         );
+
       this.map = map;
+      map.getView().setCenter(this.transpoints([[118.78, 32.04]],0)[0]);
+      map.getView().setZoom(13);
     },
     initprod: function() {
       const proj3857 = getProjection("EPSG:4326");
@@ -217,6 +223,8 @@ export default {
       });
       map.getView().fit([75.0, 20.0, 135.0, 50.0], map.getSize());
       this.map = map;
+      map.getView().setCenter(this.transpoints([[118.78, 32.04]],0)[0]);
+      map.getView().setZoom(13);
     },
 
     addline:function(){