InfoWindowYard.vue 9.89 KB
<template>
  <div style="position: relative;">
    <div class="info-window-yarn-wrapper">
      <div :style="{ width: (widow_info.width * 0.8) + 'px', overflow: 'auto' }">
        <div class="hideScrollBar info-window-title">
          <div v-for="(item, index) in info?.details" :key="index" @click="handleTitle(index)"
            :class="[isActive === index ? 'checked' : '', 'item']">
            <span>{{ item.name }}</span>
          </div>
        </div>
        <!-- <div v-if="info?.details?.length > 3" @click="handleNavScroll()" style="position: fixed; right: 0.75rem; width: 1rem; background-color: #FFF;top: 1rem;">
          <van-icon v-if="!nav_scroll" name="arrow" color="#888" size="1.25rem" style="vertical-align: sub;" />
          <van-icon v-else name="arrow-left" color="#888" size="1.25rem" style="vertical-align: sub;" />
        </div> -->
        <div v-for="(item, index) in info?.details" :key="index">
          <div v-if="isActive === index">
            <div style="width: 80%; float: left; color: #888; line-height: 1.75;">
              <div>类型: {{ item.type }}</div>
              <div>容纳人数: {{ item.sum }}</div>
              <div>负责人: {{ item.manager }}</div>
              <div>联系电话: {{ item.contact }}</div>
              <div>状态: {{ item.status }}</div>
            </div>
            <div v-if="yard_info.img_url" class="info-control">
              <viewer :images="yard_info.img_url" :options="options" class="images clearfix">
                <template #default="scope">
                  <van-image v-for="src in scope.images" width="100%" fit="contain" :src="src" />
                </template>
              </viewer>
            </div>
          </div>
        </div>
      </div>
      <div class="van-hairline--top warn-button-wrapper">
        <div @click="goToNote()" style="width: 50%; float: left; text-align: center; margin-top: 0.75rem;"
          class="van-hairline--right">
          <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E8%AF%A6%E6%83%85@2x.png" size="1.25rem" color="#FFF"
            style="vertical-align: sub;" />&nbsp;
          <span style="color: #AB8F57; font-size: 1rem;">须知</span>
        </div>
        <div @click="goToOrder()" style="width: 50%; float: left; text-align: center; margin-top: 0.75rem;"
          class="van-hairline--right">
          <van-icon name="https://cdn.ipadbiz.cn/xys/map/icon/%E9%A2%84%E5%AE%9A@2x.png" size="1.25rem" color="#FFF"
            style="vertical-align: sub;" />&nbsp;
          <span style="color: #AB8F57; font-size: 1rem;">预定</span>
        </div>
        <div @click="goToLocation()" style="width: 50%; float: left; text-align: center; margin-top: 0.75rem;">
          <van-icon name="https://cdn.ipadbiz.cn/xys/map/%E5%89%8D%E5%BE%80@2x.png" size="1.25rem" color="#FFF"
            style="vertical-align: sub;" />&nbsp;
          <span style="color: #AB8F57; font-size: 1rem;">前往</span>
        </div>
      </div>
    </div>
    <div class="leaflet-popup-tip-container" style="left: 50%; position: relative;">
      <div class="leaflet-popup-tip"></div>
    </div>

    <van-popup
      v-model:show="showPopup"
      position="bottom"
      :overlay="true"
      :style="{ height: '90%' }"
      teleport="body"
    >
      <van-icon name="cross" size="1.35rem" @click="showPopup = false" style="float: right; color: gray; margin-right: 1rem; margin-top: 1rem;" />
      <div style="clear: both;">
        <div style="color: #965f13; text-align: center; margin: 1rem; font-size: 1.25rem;">
          用户须知
        </div>
        <div v-html="yard_info.note" style="padding: 1rem;"></div>
      </div>
    </van-popup>
  </div>
</template>

<script>
import $ from 'jquery'

export default {
  props: {
    infoWindow: {
      type: Object,
      default: () => { }
    },
    info: {
      type: Object,
      default: () => { }
    },
    rect: {
      type: Object,
      default: () => { }
    },
  },
  mounted() {
  },
  computed: {
    warn_span1() {
      let flag = false;
      if (this.yard_info.case_url) {
        if (this.yard_info.notice_url || this.yard_info.handle_url) {
          flag = true
        }
      }
      return flag;
    },
    warn_span2() {
      let flag = false;
      if (this.yard_info.notice_url) {
        if (this.yard_info.handle_url) {
          flag = true
        }
      }
      return flag;
    },
  },
  watch: {
    rect(val) {
      this.widow_info = val;
    },
    infoWindow(val) {
      if (val) {
        this.yard_info = this.info.details[0]
      }
    }
  },
  data() {
    return {
      popup_title: '',
      popup_content: '',
      video_src: '',
      ind: '',
      is_play: false,
      audio: new Audio(),
      widow_info: {},
      play_time: '00:00',
      isActive: 0,
      nav_scroll: false,
      yard_info: {},
      showBottom: false,
      img_url: '',
      show: false,
      images: ['https://picsum.photos/200/200'],
      options: {
        title: false,
        toolbar: false,
        navbar: false,
      },
      showPopup: false
    }
  },
  methods: {
    // 关闭
    close() {
      // 高德地图信息窗关闭的api
      this.infoWindow.close()
      // 默认选中项
      this.isActive = 0;
      // 滚动状态
      this.nav_scroll = false;
    },
    goToNote () {
      this.showPopup = true;
      console.warn(this.yard_info);
    },
    goToOrder () {},
    goToLocation () {},
    onClose () {
      window.devicePixelRatio = 1;
    },
    handleTitle(index) {
      this.isActive = index;
      // // 标题滚动
      // if (index === 2 && this.info.details.length > 3) {
      //   this.handleNavScroll()
      // }
      this.yard_info = this.info.details[index]
    },
    handleNavScroll() { // 滚动标题
      this.nav_scroll = !this.nav_scroll;
      if (this.nav_scroll) {
        setTimeout(() => {
          $('.info-window-title').animate({
            scrollLeft: $('.info-window-title .item').outerWidth() * 3
          }, 1000);
        }, 100);
      } else {
        setTimeout(() => {
          $('.info-window-title').animate({
            scrollLeft: 0
          }, 1000);
        }, 100);
      }
    }
  }
}
</script>

<style lang="less">
.info-window-yarn-wrapper {
  background: #fff;
  color: #333;
  -webkit-box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
  text-align: left;
  border-radius: 5px;
  padding: 1.5rem 1.25rem;
  overflow: auto;

  .info-text {
    width: 100%;
    line-height: 1.5;
    float: left;
    color: #7A6C6C;
  }

  .info-text-audio {
    width: 80%;
    line-height: 1.5;
    float: left;
    color: #7A6C6C;
  }

  .info-control {
    width: 20%;
    float: left;
    text-align: center;
    color: #AB8F57;

    .control-play {
      text-align: center;
      margin-bottom: 0.5rem;

      i {
        margin-top: 0 !important;
      }
    }
  }

  // .t-popup-content {
  //   position: relative;
  //   width: 25rem;
  //   padding: 0;
  //   margin: 0;
  //   border-radius: 0.1rem;
  //   background: rgba(255, 255, 255, 0.9);
  //   -webkit-box-shadow: 0 0.02rem 0.05rem 0 rgba(0, 0, 0, 0.1);
  //   box-shadow: 0 0.02rem 0.05rem 0 rgba(0, 0, 0, 0.1);
  //   line-height: 1.4;

  //   .view-name {
  //     margin: 0;
  //     padding: 0.5rem;
  //     width: 25rem;
  //     height: 2.5rem;
  //     font-size: 1.2rem;
  //     text-indent: 0.2rem;
  //     white-space: nowrap;
  //     text-overflow: ellipsis;
  //     color: #5b5b5b;
  //     -webkit-box-sizing: border-box;
  //     box-sizing: border-box;
  //     border-bottom: solid 1px #e8e8e8;
  //     border-radius: 0.1rem 0.1rem 0 0;
  //     background: #f7f7f7;
  //     overflow: hidden;
  //   }

  //   .view-photo {
  //     display: block;
  //     float: left;
  //     margin: 0.5rem;
  //     height: 100%;
  //     width: 9rem;
  //     height: 9rem;
  //     border-radius: 3px;
  //   }

  //   .introduction {
  //     float: left;
  //     margin: 0.2rem 0;
  //     width: 13.5rem;
  //     height: 6.75rem;
  //     font-size: 0.9rem;
  //     color: #202020;
  //     overflow: hidden;
  //   }

  //   // .control-play {
  //   //   display: block;
  //   //   float: left;
  //   //   margin-right: 0.5rem;
  //   //   width: 7rem;
  //   //   height: 3rem;
  //   //   border-radius: 2px;
  //   //   background: #ffdd02 center no-repeat;
  //   //   background-size: 6.5rem 3rem;
  //   // }

  //   .show-details {
  //     display: block;
  //     float: left;
  //     width: 7rem;
  //     height: 3rem;
  //     border-radius: 2px;
  //     background: #9196a9 center no-repeat;
  //     background-size: 6.5rem 3rem;
  //   }
  // }

  .info-window-title {
    display: flex;
    overflow-x: scroll;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
    text-align: left;

    .item {
      width: 35%;
      flex-shrink: 0;
      color: #888;
      font-size: 1.1rem;
      margin-bottom: 0.75rem;
      display: inline-block;
      margin-right: 0.5rem;
    }

    .checked {
      color: #AB8F57;

      span {
        border-bottom: 1.5px solid #AB8F57;
        padding-bottom: 3px;
      }
    }
  }
}

.leaflet-popup-tip-container {
  margin-top: -1px;
  width: 2rem;
  height: 2rem;
  margin-left: -20px;
  overflow: hidden;
  pointer-events: none;
}

.leaflet-popup-tip {
  width: 1rem;
  height: 1rem;
  -webkit-transform: rotate(0);
  transform: rotate(0);
  background: transparent url(https://map.365daoyou.cn/web/images/info-sharp.png) center no-repeat;
  background-size: 1rem 1rem;
  box-shadow: none;
}

.warn-button-wrapper {
  margin-top: 1rem;
  display: flex;
  justify-content: space-around;

  .f-line {
    text-align: center;
    margin-top: 1rem;
  }
}

.hideScrollBar::-webkit-scrollbar {
  display: none;
}

.hideScrollBar {
  -ms-overflow-style: none;
  overflow: -moz-scrollbars-none;
}

.wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
  }

  .block {
    width: 120px;
    height: 120px;
    background-color: #fff;
  }
</style>