Home.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <!-- -->
  2. <template>
  3. <div class="Home" @click.once="music = true">
  4. <audio src="../assets/media/bacMusic.mp3" loop id="bacMusic"></audio>
  5. <div class="logo">
  6. <img src="../assets/img/Home/logo.png" alt="" />
  7. </div>
  8. <div class="music" @click="music = !music">
  9. <img
  10. :src="require(`@/assets/img/Home/music${music ? 'X' : ''}.png`)"
  11. alt=""
  12. />
  13. </div>
  14. <!-- 底部列表 -->
  15. <div class="tab">
  16. <div class="row" @click="$router.replace('/Video')">场馆漫游</div>
  17. <div class="row row2" @click="toQjkk">全景风貌</div>
  18. <div class="row row3" @click="toGoods">文物赏析</div>
  19. </div>
  20. </div>
  21. </template>
  22. <script>
  23. export default {
  24. name: "Home",
  25. components: {},
  26. data() {
  27. //这里存放数据
  28. return {
  29. music: false,
  30. };
  31. },
  32. //监听属性 类似于data概念
  33. computed: {},
  34. //监控data中的数据变化
  35. watch: {
  36. music(val) {
  37. let dom = document.querySelector("#bacMusic");
  38. if (val) dom.play();
  39. else dom.pause();
  40. },
  41. },
  42. //方法集合
  43. methods: {
  44. toQjkk() {
  45. window.location.replace("/YHT/Qjkk/show.html?id=WK1578926366500417536");
  46. },
  47. toGoods() {
  48. let dom = document.querySelector("#bacMusic");
  49. dom.pause();
  50. this.$router.replace("/Goods");
  51. },
  52. },
  53. //生命周期 - 创建完成(可以访问当前this实例)
  54. created() {},
  55. //生命周期 - 挂载完成(可以访问DOM元素)
  56. mounted() {
  57. fetch("http://map.4dage.com:8109/api/count/saveVisit/museum_yuhuatai")
  58. .then((response) => response.json())
  59. .then((data) => {
  60. console.log("增加访问量");
  61. });
  62. },
  63. beforeCreate() {}, //生命周期 - 创建之前
  64. beforeMount() {}, //生命周期 - 挂载之前
  65. beforeUpdate() {}, //生命周期 - 更新之前
  66. updated() {}, //生命周期 - 更新之后
  67. beforeDestroy() {}, //生命周期 - 销毁之前
  68. destroyed() {}, //生命周期 - 销毁完成
  69. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  70. };
  71. </script>
  72. <style lang='less' scoped>
  73. .Home {
  74. width: 100%;
  75. height: 100%;
  76. position: relative;
  77. background-image: url("../assets/img/Home/bac.jpg");
  78. background-size: cover;
  79. .logo {
  80. position: absolute;
  81. top: 70px;
  82. left: 70px;
  83. width: 690px;
  84. height: 140px;
  85. img {
  86. width: 100%;
  87. height: 100%;
  88. }
  89. }
  90. .music {
  91. position: absolute;
  92. top: 26px;
  93. right: 26px;
  94. width: 38px;
  95. height: 38px;
  96. cursor: pointer;
  97. img {
  98. width: 100%;
  99. height: 100%;
  100. }
  101. }
  102. .tab {
  103. position: absolute;
  104. bottom: 76px;
  105. display: flex;
  106. justify-content: center;
  107. width: 100%;
  108. height: 78px;
  109. left: 50%;
  110. transform: translateX(-50%);
  111. .row {
  112. cursor: pointer;
  113. width: 276px;
  114. height: 78px;
  115. background-image: url("../assets/img/Home/list1.png");
  116. background-size: 100% 100%;
  117. font-size: 24px;
  118. color: #fff;
  119. text-align: center;
  120. line-height: 78px;
  121. margin-right: 120px;
  122. padding-left: 40px;
  123. &:hover {
  124. color: #d8b275;
  125. }
  126. }
  127. .row2 {
  128. background-image: url("../assets/img/Home/list2.png");
  129. background-size: 100% 100%;
  130. }
  131. .row3 {
  132. background-image: url("../assets/img/Home/list3.png");
  133. background-size: 100% 100%;
  134. margin-right: 0;
  135. }
  136. }
  137. }
  138. </style>