wangcc 2 سال پیش
والد
کامیت
963dcfe854
2فایلهای تغییر یافته به همراه23 افزوده شده و 12 حذف شده
  1. 17 12
      src/components/amapPow.vue
  2. 6 0
      src/service/index.js

+ 17 - 12
src/components/amapPow.vue

@@ -3,7 +3,7 @@
  * @Author: wangcc
  * @Date: 2022-10-19 09:32:46
  * @LastEditors: wangcc
- * @LastEditTime: 2022-11-02 14:24:57
+ * @LastEditTime: 2022-11-03 10:10:26
  * @FilePath: \castgroup_bigscreen\src\components\amapPow.vue
  * @Copyright: Copyright (c) 2016~2022 by wangcc, All Rights Reserved. 
 -->
@@ -40,7 +40,8 @@ import {
   farmInfo,
   smallClassDetail,
   treePlant,
-  projectList
+  projectList,
+  getProjectIcon
 } from '@/service/index.js';
 import axios from 'axios';
 export default {
@@ -107,7 +108,8 @@ export default {
       // 项目小班边界
       smallClassProject: [],
       // 项目小班红点转边界图
-      projectPolygonArr: []
+      projectPolygonArr: [],
+      projectIcon:''
     };
   },
   watch: {
@@ -459,8 +461,8 @@ export default {
               cursor: 'pointer',
               angle: 2,
               style: {
-                width: '5px',
-                height: '5px',
+                width: '2px',
+                height: '2px',
                 'border-radius': '50%',
                 'border-width': 0,
                 'text-align': 'center',
@@ -509,11 +511,6 @@ export default {
                       _this.setMapLabel(detail);
                     } else if (this.leftPage == 'treeSpecies') {
                       this.addTreeSpeciesPolygon(detail);
-                      // this.forestMarker.setLabel({
-                      //   direction: 'top',
-                      //   offset: new AMap.Pixel(0, 8), //设置文本标注偏移量
-                      //   content: `<div class="label-treecomp">${item.treeComp}<span class="smallH">${item.smallNumber}</span></div>` //设置文本标注内容
-                      // });
                     }
                   }
                 }
@@ -530,6 +527,7 @@ export default {
   },
   created() {
     this.getTreePlant();
+    this.getIcon()
   },
   mounted() {
     this.initAMap();
@@ -543,6 +541,13 @@ export default {
       'changeSelectStreet',
       'changeSelectAddr'
     ]),
+    getIcon(){
+      getProjectIcon('project_icon').then(res =>{
+        if (res.code == 200) {
+          this.projectIcon = res.data[0].dictValue
+        }
+      })
+    },
     setMapLabel(val) {
       let _this = this;
       let lanLatArr = [val.longitude, val.latitude];
@@ -781,8 +786,8 @@ export default {
         map: that.map
       });
       //当前聚焦的区域
+      // this.$tipMarkerContent = $('<div class="tipMarker top"></div>');
       this.$tipMarkerContent = $('<div class="tipMarker top"></div>');
-      // eslint-disable-next-line no-undef
       this.tipMarker = new AMap.Marker({
         content: this.$tipMarkerContent.get(0),
         offset: new AMap.Pixel(0, 0),
@@ -1150,7 +1155,7 @@ export default {
         if (res.code == 200) {
           let infoIcon = new AMap.Icon({
             size: new AMap.Size(20, 25), // 图标尺寸
-            image: require('@/assets/img/infoMarker.png'),
+            image: this.projectIcon,
             imageSize: new AMap.Size(20, 25) // 根据所设置的大小拉伸或压缩图片
           });
           res.rows.forEach((element) => {

+ 6 - 0
src/service/index.js

@@ -43,6 +43,12 @@ export const smallClassDetail = data =>
     data,
     prefixUrl: "api2"
   });
+  // 查询项目图标
+export const getProjectIcon = data =>
+callApi({
+  url: "dict/data/type/" + data,
+  prefixUrl: "api2"
+});
 // 按区域统计小班
 export const smallClassCount = data =>
   callApi({