index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <div class="hotspotcon">
  3. <img @click="close" class="close" :class="{ifrclose:active=='vIframe'}" :src="require('@/assets/images/project/close.png')" alt="">
  4. <component :is="active" :hotspot="hotspot"></component>
  5. </div>
  6. </template>
  7. <script>
  8. import audio from './audio.vue';
  9. import image from './image.vue';
  10. import video from './video.vue';
  11. import title from './title.vue';
  12. import iframe from './iframe.vue';
  13. let iconArr = [
  14. { name: "视频", key: "video", id: "vVideo", img: "video-icon", display: false },
  15. { name: "网页", key: "iframe", id: "vIframe", img: "iframe-icon", display: false },
  16. { name: "图片", key: "images", id: "vImage", img: "img-icon", display: false },
  17. { name: "模型", key: "model", id: "vModel", img: "model-icon", display: false },
  18. { name: "音频", key: "backgroundMusic", id: "vAudio", img: "model-icon", display: false },
  19. { name: "介绍", key: "title", id: "vTitle", img: "txt-icon", display: false }
  20. ];
  21. export default {
  22. components:{
  23. vAudio:audio,
  24. vImage:image,
  25. vIframe:iframe,
  26. vTitle:title,
  27. vVideo:video
  28. },
  29. methods:{
  30. close(){
  31. this.$hideHotspot()
  32. g_currentHot.closePopup()
  33. if(g_bgAudio && g_bgAudio.pauseByHot){
  34. window.manage.switchBgmState(true);
  35. }
  36. }
  37. },
  38. mounted(){
  39. console.log(this.hotspot);
  40. iconArr.forEach(item => {
  41. if (this.hotspot[item.key]) {
  42. this.active = !this.active ? item.id : this.active;
  43. }
  44. });
  45. !this.active && (this.active = 'vTitle')
  46. console.log(this.active);
  47. },
  48. data(){
  49. return {
  50. active:''
  51. }
  52. }
  53. }
  54. </script>
  55. <style lang="less" scoped>
  56. .hotspotcon{
  57. background: #000;
  58. position: fixed;
  59. z-index: 99999;
  60. width: 100%;
  61. height: 100%;
  62. left: 0;
  63. top: 0;
  64. .close{
  65. position: fixed;
  66. top: 40px;
  67. right: 40px;
  68. width: 70px;
  69. height: 70px;
  70. cursor: pointer;
  71. z-index: 9999999;
  72. }
  73. .ifrclose{
  74. top: 100px;
  75. }
  76. }
  77. @media only screen and (max-width: 487px) {
  78. .hotspotcon{
  79. .close{
  80. position: fixed;
  81. top: unset;
  82. right: unset;
  83. bottom: 4%;
  84. transform: translateX(-50%);
  85. left: 50%;
  86. width: 50px;
  87. height: 50px;
  88. cursor: pointer;
  89. }
  90. }
  91. }
  92. </style>