浏览代码

公众号配置及地图调整

luobo 3 年之前
父节点
当前提交
e9d74f1a09
共有 2 个文件被更改,包括 37 次插入15 次删除
  1. 3 3
      smart-admin/src/main/resources/application.yml
  2. 34 12
      smart-ui/src/views/management/marker/index.vue

+ 3 - 3
smart-admin/src/main/resources/application.yml

@@ -129,10 +129,10 @@ wx:
   # 公众号配置
   mp:
     configs:
-      - appId: wx025d97449fff2b28
+      - appId: wx88f523f0487780de
         secret: 88183d5786aa42c15990f6ac054fc485
-        token: e10adc3949ba59abbe56e057f20f883e
-        aesKey: xxxxxxxxxxxxxxxxxxxx
+        token: qrjfwechat2017
+        aesKey: KYgyocjIfT5IIxNJx1HiZIsVCHvkbRDXFphdcMepOEp
   # 小程序配置
   ma:
     configs:

+ 34 - 12
smart-ui/src/views/management/marker/index.vue

@@ -184,7 +184,7 @@
     />
 
     <!-- 添加或修改标记物管理对话框 -->
-    <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
+    <el-dialog :title="title" :visible.sync="open" width="80%" @close="closeDialog" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="120px">
         <el-tabs v-model="activeName" @tab-click="handleClick">
           <el-tab-pane label="基础信息" name="first">
@@ -386,7 +386,8 @@ export default {
       baseUrl: process.env.VUE_APP_BASE_API,
       labelList: undefined,
       contentList: [],
-      contentIdsList: []
+      contentIdsList: [],
+      positionList: []
 
     };
   },
@@ -559,6 +560,7 @@ export default {
     },
     /**初始化地图 */
     initMap () {
+        this.positionList = []
       this.TMap().then(_tmap => {
         this.tmap = _tmap
         console.log(this.$refs.containerRef)
@@ -605,12 +607,22 @@ export default {
 
           }
 
-          var centerMarker = new _tmap.LatLng(this.form.lat, this.form.lng)
-          console.log(center)
-          var geometrie = {
-            position: centerMarker
-          }
-          this.marker.setGeometries([geometrie])
+        //   var centerMarker = new _tmap.LatLng(this.form.lat, this.form.lng)
+        //   console.log(center)
+        //   var geometrie = {
+        //     position: centerMarker
+        //   }
+          var locationSet = JSON.parse(this.form.locationSet)
+          var geometries = []
+          locationSet.forEach((item,index) => {
+              this.positionList.push(item)
+                var position = {
+                "position": new TMap.LatLng(item.lat, item.lng)
+                }
+            geometries.push(position)
+          });
+          console.log(geometries)
+          this.marker.setGeometries(geometries)
         } else if (this.form.shapeType == "polyline" && this.form.lat && this.form.lng) {
           //线
           //  var centerPolyline = new _tmap.LatLng(this.form.lat, this.form.lng)
@@ -687,11 +699,13 @@ export default {
           console.log(geometry)
           var position = undefined;
           var geometries = [geometry]
+          
           if (this.form.shapeType === "marker") {
             position = geometry.position
-
-            this.form.locationSet = JSON.stringify(geometry.position);
-            this.marker.setGeometries(geometries)
+            this.positionList.push(position);
+            this.form.locationSet = JSON.stringify(this.positionList);
+            console.log(this.form.locationSet)
+            //this.marker.setGeometries(geometries)
           } else if (this.form.shapeType === "polyline") {
             position = geometry.paths[0]
             this.form.locationSet = JSON.stringify(geometry.paths);
@@ -720,7 +734,6 @@ export default {
       if (this.activeName = "second") {
 
         if (!this.map) {
-
           setTimeout(() => {
             this.initMap()
           }, 500);
@@ -747,7 +760,16 @@ export default {
       // selectLabel(this.form.markerType).then(res=>{
       //     console.log(res);
       // })
+    },
+    closeDialog(){
+        this.open = false;
+              if (this.map) {
+                this.map.destroy()
+                this.map = null
+              }
+              this.getList();
     }
+    
   }
 };
 </script>