hotspot.vue 4.0 KB

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