App.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <div id="app">
  3. <transition name="fade-out">
  4. <HomeFadeIn
  5. v-if="isShowFadeInMask"
  6. class="fade-in-mask"
  7. @loading-end="onLoadingEnd"
  8. />
  9. </transition>
  10. <router-view />
  11. <nav
  12. :style="{
  13. bottom: isShowNavBar ? '0' : '-112px',
  14. }"
  15. >
  16. <button
  17. class="tab-item"
  18. :class="{
  19. active: $route.name === 'GeneralView'
  20. }"
  21. @click="$router.push({name: 'GeneralView'})"
  22. >
  23. 概述总览
  24. <img
  25. class="decorator"
  26. src="@/assets/images/nav-item-active-decorator.png"
  27. alt=""
  28. draggable="false"
  29. >
  30. </button>
  31. <button
  32. class="tab-item"
  33. :class="{
  34. active: $route.name === 'HistoryView'
  35. }"
  36. @click="$router.push({name: 'HistoryView'})"
  37. >
  38. 历史回顾
  39. <img
  40. class="decorator"
  41. src="@/assets/images/nav-item-active-decorator.png"
  42. alt=""
  43. draggable="false"
  44. >
  45. </button>
  46. <button
  47. class="tab-item"
  48. :class="{
  49. active: $route.name === 'TreasureView'
  50. }"
  51. @click="$router.push({name: 'TreasureView'})"
  52. >
  53. 国之重器
  54. <img
  55. class="decorator"
  56. src="@/assets/images/nav-item-active-decorator.png"
  57. alt=""
  58. draggable="false"
  59. >
  60. </button>
  61. <button
  62. class="tab-item"
  63. :class="{
  64. active: $route.name === 'MetaverseView'
  65. }"
  66. @click="$router.push({name: 'MetaverseView'})"
  67. >
  68. 工业元宇宙
  69. <img
  70. class="decorator"
  71. src="@/assets/images/nav-item-active-decorator.png"
  72. alt=""
  73. draggable="false"
  74. >
  75. </button>
  76. </nav>
  77. <button
  78. class="show-hide"
  79. :style="{
  80. backgroundImage: isShowNavBar ? `url(${require(`@/assets/images/arrow-down.png`)})` : `url(${require(`@/assets/images/arrow-up.png`)})`,
  81. }"
  82. @click="isShowNavBar = !isShowNavBar"
  83. />
  84. </div>
  85. </template>
  86. <script>
  87. import HomeFadeIn from "@/components/HomeFadeIn.vue"
  88. import {
  89. computed,
  90. onMounted,
  91. reactive,
  92. ref,
  93. } from 'vue'
  94. export default {
  95. components: {
  96. HomeFadeIn,
  97. },
  98. setup () {
  99. const isShowFadeInMask = ref(true)
  100. function onLoadingEnd() {
  101. isShowFadeInMask.value = false
  102. }
  103. const isShowNavBar = ref(true)
  104. const activeNavItemIdx = ref(0)
  105. return {
  106. isShowFadeInMask,
  107. onLoadingEnd,
  108. isShowNavBar,
  109. activeNavItemIdx,
  110. }
  111. },
  112. mounted() {
  113. this.$mitt.on('test', e => {
  114. console.log('test', e)
  115. })
  116. }
  117. }
  118. </script>
  119. <style lang="less">
  120. html, body {
  121. // overscroll-behavior: none;
  122. // overflow: hidden;
  123. height: 100%;
  124. }
  125. #app {
  126. height: 100%;
  127. width: 100%;
  128. height: 100%;
  129. background-image: url(@/assets/images/main-bg.jpg);
  130. background-size: cover;
  131. background-repeat: no-repeat;
  132. background-position: center center;
  133. }
  134. // * {
  135. // user-select: none;
  136. // -webkit-touch-callout: none;
  137. // }
  138. // // 360浏览器不支持not()
  139. // input, textarea {
  140. // user-select: initial;
  141. // }
  142. // 字体
  143. // @font-face {
  144. // font-family: 'Source Han Serif CN';
  145. // src: url('@/assets/style/SourceHanSerifCN-Regular.otf');
  146. // }
  147. // @font-face {
  148. // font-family: 'Source Han Serif CN-Bold';
  149. // src: url('@/assets/style/SourceHanSerifCN-Bold.otf');
  150. // }
  151. // i {
  152. // font-style: italic;
  153. // }
  154. // 滚动条
  155. // ::-webkit-scrollbar { background: #dddecc; width: 0.3rem; height: 0.3rem; } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
  156. // ::-webkit-scrollbar-thumb { background: #828a5b; border-radius: 0.15rem; }
  157. // ::-webkit-scrollbar-corner { background: #dddecc; }
  158. // vue组件过渡效果
  159. .fade-out-leave-active {
  160. transition: opacity 1s;
  161. }
  162. .fade-out-leave-to {
  163. opacity: 0;
  164. }
  165. // // 不断渐变显隐 animation
  166. // .animation-show-hide {
  167. // animation: show-hide 1.8s infinite;
  168. // }
  169. // @keyframes show-hide {
  170. // 0% {
  171. // opacity: 0;
  172. // }
  173. // 50% {
  174. // opacity: 1;
  175. // }
  176. // 100% {
  177. // opacity: 0;
  178. // }
  179. // }
  180. // // vue-viewer
  181. // .viewer-container {
  182. // background-color: rgba(0, 0, 0, 80%) !important;
  183. // }
  184. // 或者
  185. // .viewer-backdrop {
  186. // background-color: rgba(0, 0, 0, 90%) !important;
  187. // }
  188. </style>
  189. <style scoped lang="less">
  190. #app {
  191. >.fade-in-mask {
  192. z-index: 5;
  193. }
  194. >nav {
  195. position: absolute;
  196. left: 0;
  197. width: 100%;
  198. height: 112px;
  199. border-radius: 5px 5px 0 0;
  200. border-top: solid 1px #D2BD84;
  201. box-shadow: inset 0px 2px 2px 0px rgba(210,189,132,0.45), 0px -9px 24px 0px rgba(183,162,109,0.25);
  202. display: flex;
  203. justify-content: center;
  204. align-items: center;
  205. transition: all 0.5s;
  206. >button.tab-item {
  207. font-size: 30px;
  208. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  209. font-weight: 400;
  210. color: #FFFFFF;
  211. margin-left: 200px;
  212. opacity: 0.5;
  213. position: relative;
  214. >img.decorator {
  215. display: none;
  216. }
  217. &:first-of-type {
  218. margin-left: initial;
  219. }
  220. &.active {
  221. opacity: initial;
  222. >img.decorator {
  223. display: initial;
  224. position: absolute;
  225. left: 50%;
  226. bottom: -15px;
  227. transform: translateX(-50%);
  228. width: 150%;
  229. }
  230. }
  231. }
  232. @media only screen and (max-width: 1400px) {
  233. >button.tab-item {
  234. margin-left: 100px;
  235. }
  236. }
  237. }
  238. >button.show-hide {
  239. position: absolute;
  240. right: 82px;
  241. bottom: 34px;
  242. width: 36px;
  243. height: 36px;
  244. background-size: cover;
  245. background-repeat: no-repeat;
  246. background-position: center center;
  247. }
  248. @media only screen and (max-width: 1400px) {
  249. >button.show-hide {
  250. right: 10px;
  251. }
  252. }
  253. }
  254. </style>