index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <div class="layout">
  3. <!-- tab -->
  4. <div class="all" v-show="$route.meta.myInd" :class="{ activeAll: cutTab }" @click="cutTab = !cutTab"></div>
  5. <div class="tab" :class="{ active: cutTab }" v-show="cutTab">
  6. <div class="small small1" :class="{ activeSmall: $route.meta.myInd === 1 }" @click="jump('tab1')">
  7. <img :src="require(`@/assets/imgM/${$route.meta.myInd === 1 ? 'tab1Ac' : 'tab1'
  8. }.png`)
  9. " alt="" />
  10. <p>数字史馆</p>
  11. </div>
  12. <!-- <div
  13. class="small small2"
  14. :class="{ activeSmall: $route.meta.myInd === 2 }"
  15. @click="jump('tab2')"
  16. >
  17. <img
  18. :src="
  19. require(`@/assets/imgM/${
  20. $route.meta.myInd === 2 ? 'tab2Ac' : 'tab2'
  21. }.png`)
  22. "
  23. alt=""
  24. />
  25. <p>校园全景</p>
  26. </div> -->
  27. <div class="small small3" :class="{ activeSmall: $route.meta.myInd === 3 }" @click="jump('tab2')">
  28. <img :src="require(`@/assets/imgM/${$route.meta.myInd === 3 ? 'tab3Ac' : 'tab3'
  29. }.png`)
  30. " alt="" />
  31. <p>文物典藏</p>
  32. </div>
  33. <div class="small small4" :class="{ activeSmall: $route.meta.myInd === 4 }" @click="jump('tab3')">
  34. <img :src="require(`@/assets/imgM/${$route.meta.myInd === 4 ? 'tab4Ac' : 'tab4'
  35. }.png`)
  36. " alt="" />
  37. <p>信息检索</p>
  38. </div>
  39. </div>
  40. <!-- 切换的组件页面 -->
  41. <Router-view />
  42. </div>
  43. </template>
  44. <script>
  45. //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  46. //例如:import 《组件名称》 from '《组件路径》';
  47. export default {
  48. //import引入的组件需要注入到对象中才能使用
  49. components: {},
  50. data() {
  51. //这里存放数据
  52. return {
  53. cutTab: false,
  54. }
  55. },
  56. //监听属性 类似于data概念
  57. computed: {},
  58. //监控data中的数据变化
  59. watch: {},
  60. //方法集合
  61. methods: {
  62. // 点击tab栏
  63. jump(url) {
  64. this.$router.replace(url).catch(() => { })
  65. // if (url === "tab1") url = "/index?m=TEST";
  66. // this.$router.replace(url).catch(() => {});
  67. // if (url === "/index?m=TEST") {
  68. // this.$nextTick(() => {
  69. // setTimeout(() => {
  70. // location.reload(true);
  71. // }, 300);
  72. // });
  73. // }
  74. },
  75. },
  76. //生命周期 - 创建完成(可以访问当前this实例)
  77. created() { },
  78. //生命周期 - 挂载完成(可以访问DOM元素)
  79. mounted() { },
  80. beforeCreate() { }, //生命周期 - 创建之前
  81. beforeMount() { }, //生命周期 - 挂载之前
  82. beforeUpdate() { }, //生命周期 - 更新之前
  83. updated() { }, //生命周期 - 更新之后
  84. beforeDestroy() { }, //生命周期 - 销毁之前
  85. destroyed() { }, //生命周期 - 销毁完成
  86. activated() { }, //如果页面有keep-alive缓存功能,这个函数会触发
  87. }
  88. </script>
  89. <style lang='less' scoped>
  90. .layout {
  91. width: 100vw;
  92. height: 100vh;
  93. }
  94. .all {
  95. z-index: 100;
  96. position: fixed;
  97. bottom: 15px;
  98. right: 15px;
  99. width: 60px;
  100. height: 60px;
  101. background: url("../../assets/imgM/all.png");
  102. background-size: 100% 100%;
  103. }
  104. .activeAll {
  105. background: url("../../assets/imgM/allAc.png");
  106. background-size: 100% 100%;
  107. }
  108. .tab {
  109. transform: translate(50px, 50px);
  110. border-radius: 50%;
  111. z-index: 99;
  112. position: fixed;
  113. width: 200px;
  114. height: 200px;
  115. background-color: transparent;
  116. bottom: 0px;
  117. right: 0px;
  118. .small {
  119. z-index: 101;
  120. text-align: center;
  121. width: 60px;
  122. height: 50px;
  123. position: absolute;
  124. bottom: 56px;
  125. left: 16px;
  126. color: #fff;
  127. font-size: 14px;
  128. & > img {
  129. width: 40px;
  130. height: 40px;
  131. }
  132. & > p {
  133. transform: scale(0.7) translateY(-10px);
  134. }
  135. }
  136. .small1 {
  137. & > p {
  138. transform: scale(0.7) translateY(-15px);
  139. }
  140. }
  141. .small2 {
  142. bottom: 97px;
  143. left: 8px;
  144. }
  145. .small3 {
  146. bottom: 119px;
  147. left: 24px;
  148. }
  149. .small4 {
  150. bottom: 136px;
  151. left: 90px;
  152. }
  153. .activeSmall {
  154. color: #b92e2e;
  155. }
  156. }
  157. .active {
  158. &::after {
  159. content: "";
  160. border-radius: 50%;
  161. position: absolute;
  162. width: 98%;
  163. height: 98%;
  164. top: 5px;
  165. left: 5px;
  166. border: 1px solid #b92e2e;
  167. }
  168. &::before {
  169. content: "";
  170. border-radius: 50%;
  171. position: absolute;
  172. width: 95%;
  173. height: 95%;
  174. top: 8px;
  175. left: 8px;
  176. border: 1px solid #b92e2e;
  177. }
  178. background-color: rgba(194, 181, 162, 0.8);
  179. }
  180. //@import url(); 引入公共css类</style>