<template>
  <div class="hotList">
    <div class="title">
      <div class="titleLL">热点列表</div>
      <div class="titleRR" @click="$emit('close')">
        <img src="../../../assets/img/close.png" alt="" />
      </div>
    </div>
    <div class="main">
      <div class="txtNone" v-if="data.length === 0">暂无热点</div>
      <div class="txt" v-else>
        <span
          :class="{ active: hotInd === index }"
          @click="openHot(item, index)"
          v-for="(item, index) in data"
          :key="index"
          >{{ item.info.title ? item.info.title : "热点" }}</span
        >
      </div>
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      data: [],
      hotInd: null,
    };
  },
  computed: {},
  watch: {},
  methods: {
    openHot(e, index) {
      // 停止自动导览
      window.player.director.stopTour();
      setTimeout(() => {
        e && e.examine(window.player, true);
        this.hotInd = index;
      }, 200);
    },
  },
  created() {
    this.data = window.myHotList || [];
  },
  mounted() {},
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成
  activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
};
</script>
<style lang='less' scoped>
.hotList {
  position: absolute;
  width: 940px;
  height: 640px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-image: url("../../../assets/img/open/bg-list.png");
  background-size: 100% 100%;
  padding: 60px 80px;
  .title {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .titleLL {
      font-size: 24px;
      color: #d6b970;
    }
    .titleRR {
      cursor: pointer;
    }
  }
  .main {
    margin-top: 20px;
    width: calc(100% - 14px);
    height: calc(100% - 100px);
    overflow-y: auto;
    .txtNone {
      height: 100%;
      color: #d6b970;
      font-size: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .txt {
      width: calc(100% - 10px);
      color: #fff;
      font-size: 16px;
      & > span {
        border-top: 1px solid #f0e2c0;
        padding: 15px 0;
        cursor: pointer;
        display: block;
        width: 100%;
        &:last-child {
          margin-bottom: 60px;
          border-bottom: 1px solid #f0e2c0;
        }
        &:hover {
          color: #d6b970;
        }
      }
      .active {
        color: #d6b970;
      }
    }
    &::-webkit-scrollbar-thumb {
      outline: 2px solid #d6b970;
    }
    &::-webkit-scrollbar {
      width: 2px;
    }
  }
}
@media screen and (max-width: 1000px) {
  .hotList {
    width: 94%;
    height: 90%;
    padding: 30px 10px 30px 30px;
    .title {
      .titleLL {
        font-size: 18px;
      }
      .titleRR {
        position: absolute;
        right: -5px;
        top: 5px;
      }
    }
    .main {
      margin-top: 10px;
      .txt {
        font-size: 14px;
        & > span {
          &:hover {
            color: #fff;
          }
        }
        .active {
          color: #d6b970;
        }
      }
    }
  }
}
</style>