index.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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: "title", id: "vTitle", img: "txt-icon", display: false }
  19. ];
  20. export default {
  21. components:{
  22. vAudio:audio,
  23. vImage:image,
  24. vIframe:iframe,
  25. vTitle:title,
  26. vVideo:video
  27. },
  28. methods:{
  29. close(){
  30. this.$hideHotspot()
  31. if(g_bgAudio && g_bgAudio.pauseByHot){
  32. window.manage.switchBgmState(true);
  33. }
  34. }
  35. },
  36. mounted(){
  37. iconArr.forEach(item => {
  38. if (this.hotspot[item.key]) {
  39. this.active = !this.active ? item.id : this.active;
  40. }
  41. });
  42. !this.active && (this.active = 'vTitle')
  43. },
  44. data(){
  45. return {
  46. active:''
  47. }
  48. }
  49. }
  50. </script>
  51. <style lang="less" scoped>
  52. .hotspotcon{
  53. background: #000;
  54. position: fixed;
  55. z-index: 99999;
  56. width: 100%;
  57. height: 100%;
  58. left: 0;
  59. top: 0;
  60. .close{
  61. position: fixed;
  62. top: 40px;
  63. right: 40px;
  64. width: 70px;
  65. height: 70px;
  66. cursor: pointer;
  67. z-index: 9999999;
  68. }
  69. .ifrclose{
  70. top: 100px;
  71. }
  72. }
  73. @media only screen and (max-width: 487px) {
  74. .hotspotcon{
  75. .close{
  76. position: fixed;
  77. top: unset;
  78. right: unset;
  79. bottom: 4%;
  80. transform: translateX(-50%);
  81. left: 50%;
  82. width: 50px;
  83. height: 50px;
  84. cursor: pointer;
  85. }
  86. }
  87. }
  88. </style>