派生自 wuyushui/SewerAndRainNetwork

YANGDL
2021-03-13 83944bc2dc0f9953566ed592b298c33fb3dd3f2e
src/components/panel/LegendPanel.vue
@@ -1,25 +1,31 @@
<template>
  <div class="legend-panel">
    <div class="legend-icon unactive" @click="legendChange()">
      <i class="el-icon-more-outline"></i>
      <span>图例</span>
    </div>
    <transition name='fade'>
      <div class="legend-content" v-show="legendControl">
    <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>{{ item.title }}</p>
          <ul>
            <div v-for="(ite,inde) in item.items" :key="inde">
              <li>
                <img :src='ite.legendImage' alt=''>
                <span>{{ ite.legendContent }}</span>
              </li>
            </div>
          <p><span>{{ item.title }}</span></p>
          <div :class="index === 5 ? '':'map-under-line'"></div>
          <ul  >
            <!--            <div >-->
            <li v-for="(ite,inde) in item.items" :key="inde">
              <img :src='ite.legendImage' alt=''>
              <span>{{ ite.legendContent }}</span>
            </li>
            <!--            </div>-->
          </ul>
          <div :class="index === 5 ? '':'under-line'"></div>
        </div>
      </div>
    </transition>
    <el-tooltip :popper-class="'map-tooltip'" effect="dark" content="图例" placement="left">
      <div :class="this.legendControl?'legend-btn map-btn-active':'legend-btn map-btn-unactive'" @click="legendChange()">
        <i class="el-icon-more-outline"></i>
<!--        <span>图例</span>-->
      </div>
    </el-tooltip>
  </div>
</template>
@@ -32,75 +38,6 @@
      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: '暴雨蓝色预警'
            },
            {
              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: '暴风红色预警'
            },
            {
              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: '暴风红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            },
            {
              legendImage: '../.././assets/images/map-pages/setting.png',
              legendContent: '暴风红色预警'
            }
          ]
        },
        {
          title: '企业',
          items: [
@@ -214,7 +151,8 @@
}
</script>
<style lang="less" scoped>
<style lang="less" >
@import '@assets/css/map/_map-variable';
.legend-panel {
  position: absolute;
  z-index: 502;
@@ -225,14 +163,34 @@
  flex-direction: column;
  -webkit-box-align: end;
  -ms-flex-align: end;
  align-items: flex-end;
  .legend-icon {
    width: 3.4rem;
    height: 1.6rem;
    border-radius: 0.3rem;
    background: white;
  //align-items: flex-end;
  transition: all .5s;
  .legend-btn {
    width: .2rem;
    height: .2rem;
    //font-size: .08333rem;
    border: .00521rem solid @background-color-light;
    border-radius: @border-radius;
    text-align: center;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    background: @background-color;
    margin-top: .04167rem;
    cursor: pointer;
    //color: @color;
    margin-left: auto;
    font-size: 0.08333rem;
  }
  @keyframes bounce-in {
@@ -248,72 +206,78 @@
  .fade-enter-active {
    transform-origin: right bottom;
    animation: bounce-in .5s;
    animation: bounce-in .2s;
  }
  .fade-leave-active {
    transform-origin: right bottom;
    animation: bounce-in .5s reverse;
    animation: bounce-in .2s reverse;
  }
  .legend-content {
    position: absolute;
    right: 0.3rem;
    bottom: 3rem;
    width: 30rem;
    border-radius: 1rem;
    background: #3c7699;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: reverse;
    -ms-flex-direction: row-reverse;
    flex-direction: row-reverse;
    width: -webkit-max-content;
    width: -moz-max-content;
    width: max-content;
    overflow: hidden;
    min-height: 1.28646rem;
    .legend-content-box {
      font-size: 0.07292rem;
      padding: .10417rem;
      border-left: .00521rem solid @background-color-split;
      p {
        text-align: center;
        color: #ffffff;
        font-size: 14px;
        margin: 0 !important;
        //padding: 0;
        //color: @color-title;
        -webkit-margin-before: 0.3rem;
        margin-block-start: 0.3rem;
        -webkit-margin-after: 0.2rem;
        margin-block-end: 0.2rem;
        margin-bottom: 0.05208rem !important;
        span {
          color: @color-title;
          font-size: .08333rem;
          font-weight: 600;
        }
      }
      ul {
        list-style: none;
        display: flex;
        flex-wrap: wrap;
        padding: 0;
        margin: 0 !important;
        padding: 0 !important;;
        padding-inline: 0;
        div {
          width: 25%;
          display: flex;
          justify-content: center;
          margin: 0.1rem 0;
        font-size: .08333rem;
          li {
            width: 100%;
            list-style: none;
            display: flex;
            justify-content: space-around;
            margin-left: 15px;
            margin-right: 15px;
            -webkit-box-align: center;
            align-items: center;
            margin: 0.05208rem 0;
            img {
              height: 18px;
              width: 18px;
              width: .08333rem;
              height: .08333rem;
              margin-right: .01042rem;
            }
            span {
              width: 80px;
              font-size: 12px;
              color: white;
              color: @color;
            }
          }
        }
      }
    }
    .under-line {
      height: 2px;
      background: #7bc5ef;
      margin-block-start: 0;
      margin-block-end: 0;
    }
  }
}
</style>