Browse Source

Merge branch 'master' of http://www.sysuimars.cn:3000/lxf/foster-pc-vue

刘秀芳 5 days ago
parent
commit
51f556994a
3 changed files with 452 additions and 333 deletions
  1. 37 31
      src/views/home/components/tabs.vue
  2. 1 23
      src/views/home/map/samplePointLayer.js
  3. 414 279
      yarn.lock

+ 37 - 31
src/views/home/components/tabs.vue

@@ -1,8 +1,8 @@
 <template>
     <div class="btn-group">
         <div
-            :class="['btn-item', { active: active === index }]"
-            @click="handleActive(item,index)"
+            :class="['btn-item', { active: activeVal === index }]"
+            @click="handleActive(item, index)"
             v-for="(item, index) in baseList"
             :key="index + item"
         >
@@ -12,61 +12,67 @@
 </template>
 
 <script setup>
-import {onMounted, onUnmounted, ref, watch} from 'vue'
+import { onMounted, onUnmounted, ref, watch } from "vue";
 import eventBus from "@/api/eventBus";
 
 const props = defineProps({
     list: {
         type: Array,
-        defalut: ()=>[],
+        defalut: () => [],
     },
     keyStr: {
         type: String,
-        defalut: '',
+        defalut: "",
     },
     active: {
         type: String,
-        defalut: '',
+        defalut: "",
     },
 });
 
-onMounted(()=>{
+onMounted(() => {
     //选项监听事件
-    eventBus.on('handleTab',handleTab)
-})
+    eventBus.on("handleTab", handleTab);
+});
 
-onUnmounted(()=>{
-    eventBus.off('handleTab',handleTab)
-})
+onUnmounted(() => {
+    eventBus.off("handleTab", handleTab);
+});
 
-const emit = defineEmits(["handleActive"])
+const emit = defineEmits(["handleActive"]);
 
-const baseList = ref([])
-const active = ref(0);
-const handleActive = (item,index) => {
-    active.value = index;
-    eventBus.emit('handleActive',{name:item,key:props.keyStr,index})
+const baseList = ref([]);
+const activeVal = ref(0);
+const handleActive = (item, index) => {
+    activeVal.value = index;
+    eventBus.emit("handleActive", { name: item, key: props.keyStr, index });
 };
 
-function handleTab(e){
-  active.value = 0
+function handleTab(e) {
+    activeVal.value = 0;
 }
 
-watch(()=>props.list,(newValue,oldValue)=>{
-    if(newValue){
-        baseList.value = newValue
+watch(
+    () => props.list,
+    (newValue, oldValue) => {
+        if (newValue) {
+            baseList.value = newValue;
+        }
     }
-})
+);
 
-watch(()=>props.active,(newValue,oldValue)=>{
-    if(newValue){
-        const index = props.list.findIndex(item =>item===newValue)
-        if(index!==-1){
-            active.value = index
-            handleActive(newValue,index)
+watch(
+    () => props.active,
+    (newValue, oldValue) => {
+        if (newValue) {
+            const index = props.list.findIndex((item) => item === newValue);
+            if (index !== -1) {
+                activeVal.value = index;
+                handleActive(newValue, index);
+            }
         }
     }
-})
+);
 </script>
 
 <style lang="scss" scoped>

+ 1 - 23
src/views/home/map/samplePointLayer.js

@@ -26,7 +26,7 @@ class SamplePointLayer {
     this.regionId = regionId
     let vectorStyle = new KMap.VectorStyle();
     this.vectorStyle = vectorStyle;
-    this.clusterSource = new Cluster({
+    this.treeClusterLayer = new Cluster({
       distance: 10,
       minDistance: 10,
     });
@@ -42,28 +42,6 @@ class SamplePointLayer {
       source: this.clusterSource,
       style: (f) => this.getStyle(f)
     })
-    this.yellowBlockLayer = new KMap.VectorLayer("yellow-block", 999, {
-      minZoom: 15,
-      // source:this.clusterSource,
-      // source:"POINT(113.61396985128522 23.5859386716038)",
-      style: () => {
-        return new Style({
-          image: new Icon({
-            src: require("@/assets/images/map/yellow-block.png"),
-            scale: 0.4,
-          }),
-        });
-      },
-    })
-    // map.addLayer(this.treeClusterLayer.layer)
-    // map.addLayer(this.yellowBlockLayer.layer);
-
-    let point = new Feature(new Point([113.61396985128522, 23.5859386716038]));
-    let point1 = new Feature(new Point([113.61390710255375, 23.586379215663726]));
-    let point2 = new Feature(new Point([113.61491218688275, 23.58671519555776]));
-    // this.yellowBlockLayer.addFeature(point);
-    // this.yellowBlockLayer.addFeature(point1);
-    // this.yellowBlockLayer.addFeature(point2);
 
     this.addMapSingerClick(map.map);
 

File diff suppressed because it is too large
+ 414 - 279
yarn.lock


Some files were not shown because too many files changed in this diff