From 42e58b994b71ef0a20cfeed633c5f51670adf157 Mon Sep 17 00:00:00 2001 From: 徐旺旺 <11530253@qq.com> Date: 星期四, 01 四月 2021 14:45:27 +0800 Subject: [PATCH] 修改图例内容读取配置文件 --- /dev/null | 221 ------------------------------------ src/components/panel/LegendPanel.vue | 121 +------------------ src/Sgis.js | 1 3 files changed, 12 insertions(+), 331 deletions(-) diff --git a/src/Sgis.js b/src/Sgis.js index 6e794e0..6626200 100644 --- a/src/Sgis.js +++ b/src/Sgis.js @@ -49,6 +49,7 @@ */ const initBasemapsHelper = (map) => { // todo 杩欓噷杩涜搴曞浘鍦板浘鐨勫垵濮嬪寲 + console.log(map) return new BasemapHelper({ map }) } /** diff --git a/src/components/icon-btn/IconBtn.vue b/src/components/icon-btn/IconBtn.vue deleted file mode 100644 index 4c618b8..0000000 --- a/src/components/icon-btn/IconBtn.vue +++ /dev/null @@ -1,221 +0,0 @@ -<template> - <div class="float-panel"> - <div :class='["btn",active ? "active" : ""]' @click="onClick"> - <span> - <img :src="src" alt="" width="26px" style="display: block;margin: auto"> - <span class="icon-name">{{label}}</span> - </span> - </div> - </div> -</template> - -<script> -import '@assets/css/map/magic.min.css' - -import iconSetting from '@/assets/images/map-pages/icon/setting.png' - -export default { - name: 'LayerController', - props: { - src: String, - label: String, - active: Object, - onClick: Function - }, - computed: { - map () { - return this.$store.state.map.map - }, - L () { - return this.$store.state.map.L - }, - layerHelper () { - return this.$store.state.map.layerHelper - } - }, - data () { - return { - width: '250px', - isShow: true, - icons: { - setting: iconSetting - }, - layerControllerVisible: false, - panelSwitch: { - main: true // 涓荤獥鍙� - } - } - }, - mounted () { - this.$nextTick(function () { - this.init() - }) - }, - methods: { - } -} -</script> - -<style lang="less"> - .float-panel { - position: absolute; - left: 2px; - top: 120px; - height: auto; - font-size: 11px; - z-index: 1000; - - div { - color: #00fff6; - } - .btn { - width:45px; - text-align: center; - background: rgba(0, 16, 30, 0.5); - cursor: pointer; - color: #00fff6; - border: 0.00521rem solid #00fff6; - box-shadow: 0 0 0.03rem #00fff6; - } - .active { - border: 0.00521rem solid #fff700; - box-shadow: 0 0 0.03rem #fff700; - } - .title-border { - width: 100%; - height: 28px; - background: #10488c; - -webkit-clip-path: polygon(0px 0px, 0px 28px, 230px 28px, 230px 9px, 95px 9px, 86px 0px); - clip-path: polygon(0px 0px, 0px 28px, 230px 28px, 230px 9px, 95px 9px, 86px 0px); - position: relative; - } - - .title-border:before { - content: ""; - display: block; - position: absolute; - width: 6px; - height: 6px; - top: 0; - left: 0; - background-color: #38c8ef; - } - - .title-border:after { - content: ""; - display: block; - position: absolute; - width: 6px; - height: 6px; - top: 9px; - right: 0; - background-color: #38c8ef; - -webkit-clip-path: polygon(0px 0px, 0px 1px, 5px 1px, 5px 6px, 6px 6px, 6px 0px); - clip-path: polygon(0px 0px, 0px 1px, 5px 1px, 5px 6px, 6px 6px, 6px 0px); - } - - .title-text-border { - width: 30px; - height: 120px; - float: left; - background: #091331; - // -webkit-clip-path: polygon(1px 1px, 1px 27px, 229px 27px, 229px 10px, 94px 10px, 85px 1px); - // clip-path: polygon(1px 1px, 1px 27px, 229px 27px, 229px 10px, 94px 10px, 85px 1px); - } - - .title-icon { - float: left; - width: 22px; - height: 22px; - margin-top: 4px; - margin-left: 2px; - background-image: url(../../assets/images/map-pages/icon/setting.png); - } - - .title-text { - width: 25px; - color: #00d0f9; - font-weight: bold; - margin-top: 6px; - text-align: center; - font-size: 14px; - filter: brightness(100%); - text-shadow: 0 0 5px #00d0f9, 0 0 0 #00d0f9, 0 0 0 #00d0f9, 0 0 0 #0258c5, 0 0 0 #0258c5, 0 0 2px #0258c5, 0 0 5px #0258c5, 0 0 15px #0258c5; - } - - .title-line { - display: inline-block; - width: 120px; - height: 1px; - // margin-top: 14px; - margin-left: 4px; - background-color: #04527f; - line-height: 5px; - vertical-align: middle; - } - - .title-point { - display: inline-block; - width: 5px; - height: 5px; - // margin-top: 12px; - background-color: #04527f; - line-height: 5px; - vertical-align: middle; - } - - .title-button { - float: right; - width: 28px; - height: 28px; - cursor: pointer; - - :hover { - font-weight: bold; - color: white; - } - } - - .body-box { - background-color: rgba(44, 62, 80, 0.6); - border: 1px solid #10488c; - margin-top: -1px; - margin-left: 30px; - height: auto; - } - .switch-head-down { - transform: rotateX(180deg); - transform-origin: 50% 50%; - transition: transform 0.5s linear 0s; - } - - select { - background: transparent; - margin: 6px; - border: .5px solid #569EB7; - width: 150px; - color: #569EB7; - padding: 0 16px; - } - ::-webkit-scrollbar { - width: 7px; - height: 5px !important; - } - - ::-webkit-scrollbar-thumb { - /*婊氬姩鏉¢噷闈㈠皬鏂瑰潡*/ - border-radius: 10px; - box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); - background: #0661AE; - border: 1px solid transparent; - } - - ::-webkit-scrollbar-track { - /*婊氬姩鏉¢噷闈㈣建閬�*/ - // box-shadow : inset 0 0 5px rgba(0, 0, 0, 0.2); - border-radius: 0px; - background: #0E3565; - } - } - -</style> diff --git a/src/components/panel/LegendPanel.vue b/src/components/panel/LegendPanel.vue index 383aea2..b3c4784 100644 --- a/src/components/panel/LegendPanel.vue +++ b/src/components/panel/LegendPanel.vue @@ -2,13 +2,13 @@ <div class="legend-panel"> <transition name="fade"> <div :class="'legend-content map-background'" v-show="legendControl"> - <div class="legend-content-box" v-for="(item,index) in legendContents" :key="index"> - <p><span>{{ item.title }}</span></p> - <div :class="index === 5 ? '':'map-under-line'"></div> + <div class="legend-content-box" v-for="(item,index) in serviceLayers" :key="index"> + <p><span>{{ item.name }}</span></p> + <div class="map-under-line"></div> <ul> - <li v-for="(ite,inde) in item.items" :key="inde"> + <li v-for="(ite,inde) in item.layers" :key="inde"> <img :src='ite.legendImage' alt=''> - <span>{{ ite.legendContent }}</span> + <span>{{ ite.name }}</span> </li> </ul> </div> @@ -28,111 +28,12 @@ data () { return { // 鎺у埗鍥句緥 鍐呭鐨� 鏄剧ず/闅愯棌 - legendControl: false, - // 鍥鹃噷瀛樺偍鏁版嵁 - legendContents: [ - { - title: '浼佷笟', - items: [ - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '涓浗鐭冲寲' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '娌圭敯浼佷笟 ' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鐐煎寲浼佷笟' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '閿�鍞紒涓�' - } - ] - }, - { - title: '姘存儏', - items: [ - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '姘存枃绔�' - } - ] - }, - { - title: '绠$嚎', - items: [ - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '澶╃劧姘旂绾�' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '澶╃劧姘斿満绔�' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鎴愬搧娌圭绾�' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鎴愬搧娌瑰満绔�' - } - ] - }, - { - title: '鍙伴', - items: [ - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鍙伴瀹炴祴涓績' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鍙伴瀹炴祴璺緞' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鍙伴棰勬祴涓績' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鍙伴棰勬祴璺緞' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鍙伴褰撳墠涓績' - } - ] - }, - { - title: '闄嶆按绛夌骇(鍗曚綅锛歮m)', - items: [ - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '灏忛洦0-5' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '涓洦5-10' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '澶ч洦10-20' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '鏆撮洦20-50' - }, - { - legendImage: '../.././assets/images/map-pages/setting.png', - legendContent: '澶ф毚闆�50-100' - } - ] - } - ] + legendControl: false + } + }, + computed: { + serviceLayers () { + return this.$store.state.map.serviceLayers.LayerSewersLine } }, methods: { -- Gitblit v1.8.0