123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <template>
- <!-- <router-view /> -->
- <router-view v-slot="{ Component }">
- <transition
- name="fade-in-out"
- >
- <component
- :is="Component"
- />
- </transition>
- </router-view>
- <audio
- id="bg-music"
- src="./configMultiMedia/music/music1.mp3"
- />
- </template>
- <script setup>
- import { ref, computed, watch, onMounted } from "vue"
- import { useRoute, useRouter } from "vue-router"
- import { useStore } from "vuex"
- import {
- // checkLoginStatusAndProcess,
- // getUserFromStorageIfNeed
- } from '@/api.js'
- const route = useRoute()
- const router = useRouter()
- const store = useStore()
- // store.commit('getPageVisitRecordFromStorage')
- // checkLoginStatusAndProcess()
- // getUserFromStorageIfNeed()
- // if (store.state.loginStatus === store.getters.loginStatusEnum.notLogin && route.name !== 'LoginView') {
- // router.push({
- // name: 'LoginView',
- // query: {
- // redirect: encodeURI(route.fullPath)
- // }
- // })
- // }
- const time = ref(null)
- function isNotMobile() {
- const userAgent = navigator.userAgent || navigator.vendor || window.opera
- const mobileKeywords = [
- 'Android', 'webOS', 'iPhone', 'iPad', 'iPod', 'BlackBerry', 'Windows Phone',
- 'Opera Mini', 'IEMobile', 'Mobile', 'Android'
- ]
- // Check if any of the mobile keywords are present in the user agent string.
- return !mobileKeywords.some(keyword => userAgent.toLowerCase().includes(keyword.toLowerCase()))
- }
- onMounted(() => {
- const appDom = document.getElementById('#app')
- if (isNotMobile) {
- // appDom.style.maxWidth = '390px'
- // appDom.style.maxHeight = '844px'
- // appDom.clientHeight = '844px'
- // appDom.clientWidth = '390px'
- }
- window.addEventListener(
- "resize",
- () => {
- //@ts-ignore
- clearTimeout(time.value)
- //@ts-ignore
- time.value = window.setTimeout(() => {
- // 根元素
- const dom = document.querySelector("#app")
- if (dom && document.documentElement.clientWidth < 1000) {
- dom.style.height = document.documentElement.clientHeight + "px"
- dom.style.width = document.documentElement.clientWidth + "px"
- window.windowWidth = document.documentElement.clientWidth + "px"
- window.windowHeight = document.documentElement.clientHeight + "px"
- }
- }, 100)
- },
- true
- )
- })
- </script>
- <style lang="less">
- html, body {
- // overscroll-behavior: none;
- overflow: hidden;
- height: 100%;
- }
- * {
- user-select: none;
- -webkit-touch-callout: none;
- }
- // 360浏览器不支持not()
- input, textarea {
- user-select: initial;
- }
- #app {
- height: 100%;
- position: relative;
- max-width: 500px;
- left: 50%;
- transform: translateX(-50%);
- overflow: hidden;
- // background: green;
- // @media screen and (max-width: 400px) {
- // max-width: 390px;
- // max-height: 844px;
- // }
- }
- // 字体
- @font-face {
- font-family: 'KingHwa_OldSong';
- src: url('@/assets/style/KingHwa_OldSong.TTF');
- }
- @font-face {
- font-family: 'KaiTi';
- src: url('@/assets/style/SIMKAI.TTF');
- }
- // 滚动条,只设置某一项可能导致不生效。
- // ::-webkit-scrollbar { background: #dddecc; width: 6px; height: 6px; }
- // ::-webkit-scrollbar-thumb { background: #828a5b; border-radius: 3px; }
- // ::-webkit-scrollbar-corner { background: #dddecc; }
- // vue组件过渡效果
- .fade-out-leave-active {
- transition: opacity 2s;
- pointer-events: none;
- }
- .fade-out-leave-to {
- opacity: 0;
- }
- .fade-in-enter-active {
- transition: opacity 2s;
- }
- .fade-in-enter-from {
- opacity: 0;
- }
- .fade-in-out-enter-active {
- transition: opacity 1s;
- }
- .fade-in-out-leave-active {
- transition: opacity 1s;
- pointer-events: none;
- }
- .fade-in-out-enter-from {
- opacity: 0;
- }
- .fade-in-out-leave-to {
- opacity: 0;
- }
- // 不断渐变显隐 animation
- .animation-show-hide {
- animation: show-hide 1.5s infinite;
- }
- @keyframes show-hide {
- 0% {
- opacity: 0;
- }
- 50% {
- opacity: 1;
- }
- 100% {
- opacity: 0;
- }
- }
- // 不断渐变显隐,显示时间较长 animation
- .animation-show-long-hide {
- animation: show-long-hide 2.5s infinite;
- }
- @keyframes show-long-hide {
- 0% {
- opacity: 0;
- }
- 35% {
- opacity: 1;
- }
- 65% {
- opacity: 1;
- }
- 100% {
- opacity: 0;
- }
- }
- // // vue-viewer
- .viewer-backdrop {
- background-color: rgba(0, 0, 0, 90%) !important;
- }
- </style>
|