hotspot.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <div class="hotspot">
  3. <div class="main">
  4. <div class="txtNone" v-if="data.length === 0">暂无热点</div>
  5. <div class="mainBox" v-else>
  6. <div
  7. v-for="(item, index) in data"
  8. :key="index"
  9. :class="{ active: hotInd === index }"
  10. @click="openHot(item, index)"
  11. >
  12. {{ item.info.title ? item.info.title : "热点" }}
  13. </div>
  14. </div>
  15. </div>
  16. <!-- 关闭按钮 -->
  17. <div class="close" @click="$emit('close')"></div>
  18. </div>
  19. </template>
  20. <script>
  21. export default {
  22. name: "hotspot",
  23. components: {},
  24. data() {
  25. //这里存放数据
  26. return {
  27. data: [],
  28. hotInd: null,
  29. };
  30. },
  31. //监听属性 类似于data概念
  32. computed: {},
  33. //监控data中的数据变化
  34. watch: {},
  35. //方法集合
  36. methods: {
  37. openHot(e, index) {
  38. // 停止自动导览
  39. window.player.director.stopTour();
  40. setTimeout(() => {
  41. e && e.examine(window.player, true);
  42. this.hotInd = index;
  43. }, 200);
  44. },
  45. },
  46. //生命周期 - 创建完成(可以访问当前this实例)
  47. created() {
  48. this.data = window.myHotList;
  49. },
  50. //生命周期 - 挂载完成(可以访问DOM元素)
  51. mounted() {},
  52. beforeCreate() {}, //生命周期 - 创建之前
  53. beforeMount() {}, //生命周期 - 挂载之前
  54. beforeUpdate() {}, //生命周期 - 更新之前
  55. updated() {}, //生命周期 - 更新之后
  56. beforeDestroy() {}, //生命周期 - 销毁之前
  57. destroyed() {}, //生命周期 - 销毁完成
  58. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  59. };
  60. </script>
  61. <style lang='less' scoped>
  62. .hotspot {
  63. position: fixed;
  64. width: 100vw;
  65. height: calc(100% - 50px);
  66. bottom: 0;
  67. left: 0;
  68. z-index: 9998;
  69. padding: 30px 20px 0;
  70. &::before {
  71. content: "";
  72. position: absolute;
  73. left: 0;
  74. top: 0;
  75. width: 100%;
  76. height: 100%;
  77. background: rgba(161, 101, 59, 0.8);
  78. backdrop-filter: blur(4px);
  79. z-index: -1;
  80. }
  81. .main {
  82. border-radius: 8px;
  83. padding: 25px 0 10px 0;
  84. background-color: #fff6d2;
  85. width: 100%;
  86. height: calc(100% - 60px);
  87. .txtNone {
  88. color: #774926;
  89. width: 100%;
  90. height: 100%;
  91. font-size: 24px;
  92. display: flex;
  93. justify-content: center;
  94. align-items: center;
  95. }
  96. .mainBox::-webkit-scrollbar {
  97. width: 4px;
  98. }
  99. .mainBox::-webkit-scrollbar-thumb {
  100. outline: 2px solid #cc946d;
  101. }
  102. .mainBox {
  103. padding: 0 15px;
  104. width: 100%;
  105. height: 100%;
  106. overflow-y: auto;
  107. & > div {
  108. font-size: 16px;
  109. color: #774926;
  110. text-align: center;
  111. width: 100%;
  112. margin-bottom: 15px;
  113. }
  114. .active {
  115. color: #d4a781;
  116. }
  117. }
  118. }
  119. .close {
  120. cursor: pointer;
  121. position: absolute;
  122. left: 50%;
  123. bottom: 15px;
  124. transform: translateX(-50%);
  125. width: 30px;
  126. height: 30px;
  127. background: url("../../../assets/img/close.png");
  128. background-size: 100% 100%;
  129. }
  130. }
  131. </style>