App.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <!-- <router-view /> -->
  3. <router-view v-slot="{ Component }">
  4. <transition name="fade-in-out">
  5. <component :is="Component" />
  6. </transition>
  7. </router-view>
  8. <audio
  9. id="bg-music"
  10. src="./configMultiMedia/music/music1.mp3"
  11. style="opacity: 0;"
  12. />
  13. <!-- <audio
  14. id="bg-music2"
  15. src="./configMultiMedia/music/music2.mp3"
  16. style="opacity: 0;"
  17. /> -->
  18. </template>
  19. <script setup>
  20. import { ref, computed, watch, onMounted } from "vue"
  21. import { useRoute, useRouter } from "vue-router"
  22. import { useStore } from "vuex"
  23. import {
  24. // checkLoginStatusAndProcess,
  25. // getUserFromStorageIfNeed
  26. } from '@/api.js'
  27. const route = useRoute()
  28. const router = useRouter()
  29. const store = useStore()
  30. // store.commit('getPageVisitRecordFromStorage')
  31. // checkLoginStatusAndProcess()
  32. // getUserFromStorageIfNeed()
  33. // if (store.state.loginStatus === store.getters.loginStatusEnum.notLogin && route.name !== 'LoginView') {
  34. // router.push({
  35. // name: 'LoginView',
  36. // query: {
  37. // redirect: encodeURI(route.fullPath)
  38. // }
  39. // })
  40. // }
  41. const time = ref(null)
  42. function isNotMobile() {
  43. const userAgent = navigator.userAgent || navigator.vendor || window.opera
  44. const mobileKeywords = [
  45. 'Android', 'webOS', 'iPhone', 'iPad', 'iPod', 'BlackBerry', 'Windows Phone',
  46. 'Opera Mini', 'IEMobile', 'Mobile', 'Android'
  47. ]
  48. // Check if any of the mobile keywords are present in the user agent string.
  49. return !mobileKeywords.some(keyword => userAgent.toLowerCase().includes(keyword.toLowerCase()))
  50. }
  51. onMounted(() => {
  52. const appDom = document.getElementById('#app')
  53. if (isNotMobile) {
  54. // appDom.style.maxWidth = '390px'
  55. // appDom.style.maxHeight = '844px'
  56. // appDom.clientHeight = '844px'
  57. // appDom.clientWidth = '390px'
  58. }
  59. window.addEventListener(
  60. "resize",
  61. () => {
  62. //@ts-ignore
  63. clearTimeout(time.value)
  64. //@ts-ignore
  65. time.value = window.setTimeout(() => {
  66. // 根元素
  67. const dom = document.querySelector("#app")
  68. if (dom && document.documentElement.clientWidth < 1000) {
  69. dom.style.height = document.documentElement.clientHeight + "px"
  70. dom.style.width = document.documentElement.clientWidth + "px"
  71. window.windowWidth = document.documentElement.clientWidth + "px"
  72. window.windowHeight = document.documentElement.clientHeight + "px"
  73. }
  74. }, 100)
  75. },
  76. true
  77. )
  78. })
  79. </script>
  80. <style lang="less">
  81. html,
  82. body {
  83. // overscroll-behavior: none;
  84. overflow: hidden;
  85. height: 100%;
  86. }
  87. * {
  88. user-select: none;
  89. -webkit-touch-callout: none;
  90. }
  91. // 360浏览器不支持not()
  92. input,
  93. textarea {
  94. user-select: initial;
  95. }
  96. #app {
  97. height: 100%;
  98. position: relative;
  99. max-width: 500px;
  100. left: 50%;
  101. transform: translateX(-50%);
  102. overflow: hidden;
  103. // background: green;
  104. // @media screen and (max-width: 400px) {
  105. // max-width: 390px;
  106. // max-height: 844px;
  107. // }
  108. }
  109. // 字体
  110. @font-face {
  111. font-family: 'KingHwa_OldSong';
  112. src: url('@/assets/style/KingHwa_OldSong.TTF');
  113. }
  114. @font-face {
  115. font-family: 'KaiTi';
  116. src: url('@/assets/style/SIMKAI.TTF');
  117. }
  118. // 滚动条,只设置某一项可能导致不生效。
  119. // ::-webkit-scrollbar { background: #dddecc; width: 6px; height: 6px; }
  120. // ::-webkit-scrollbar-thumb { background: #828a5b; border-radius: 3px; }
  121. // ::-webkit-scrollbar-corner { background: #dddecc; }
  122. // vue组件过渡效果
  123. .fade-out-leave-active {
  124. transition: opacity 2s;
  125. pointer-events: none;
  126. }
  127. .fade-out-leave-to {
  128. opacity: 0;
  129. }
  130. .fade-in-enter-active {
  131. transition: opacity 2s;
  132. }
  133. .fade-in-enter-from {
  134. opacity: 0;
  135. }
  136. .fade-in-out-enter-active {
  137. transition: opacity 1s;
  138. }
  139. .fade-in-out-leave-active {
  140. transition: opacity 1s;
  141. pointer-events: none;
  142. }
  143. .fade-in-out-enter-from {
  144. opacity: 0;
  145. }
  146. .fade-in-out-leave-to {
  147. opacity: 0;
  148. }
  149. // 不断渐变显隐 animation
  150. .animation-show-hide {
  151. animation: show-hide 1.5s infinite;
  152. }
  153. @keyframes show-hide {
  154. 0% {
  155. opacity: 0;
  156. }
  157. 50% {
  158. opacity: 1;
  159. }
  160. 100% {
  161. opacity: 0;
  162. }
  163. }
  164. // 不断渐变显隐,显示时间较长 animation
  165. .animation-show-long-hide {
  166. animation: show-long-hide 2.5s infinite;
  167. }
  168. @keyframes show-long-hide {
  169. 0% {
  170. opacity: 0;
  171. }
  172. 35% {
  173. opacity: 1;
  174. }
  175. 65% {
  176. opacity: 1;
  177. }
  178. 100% {
  179. opacity: 0;
  180. }
  181. }
  182. // // vue-viewer
  183. .viewer-backdrop {
  184. background-color: rgba(0, 0, 0, 90%) !important;
  185. }
  186. .viewer-backdrop-home {
  187. background-color: #597557 !important;
  188. backdrop-filter: blur(10px);
  189. }
  190. .big-tip {
  191. position: fixed;
  192. // width: 100px;
  193. bottom: 30px;
  194. left: 50%;
  195. transform: translateX(-50%);
  196. z-index: 2016;
  197. display: flex;
  198. align-items: center;
  199. font-size: calc(24 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  200. line-height: calc(30 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  201. font-family: KaiTi, KaiTi;
  202. color: white;
  203. transition: all 0.5s;
  204. >img{
  205. width: 30px;
  206. height: 30px;
  207. margin-left: 10px;
  208. }
  209. }
  210. .viewer-button-home{
  211. background: url(@/assets/images/icon_cancel.png);
  212. background-size: 100% 100%;
  213. background-color: rgba(0, 0, 0, 0) !important;
  214. height: 40px !important;
  215. right: 10px !important;
  216. top: 10px !important;
  217. width: 40px !important;
  218. border: none !important;
  219. -webkit-tap-highlight-color:none !important;
  220. }
  221. .viewer-button-home::before{
  222. display: none !important;
  223. }
  224. </style>