123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <template>
- <router-view />
- <teleport to="body">
- <Transition name="toast-transition">
- <ToastComp v-if="isShowToast" />
- </Transition>
- <div
- v-if="$isMobile && windowOrientation === 'portrait' && route.meta.windowOrientation === 'landscape'"
- class="force-landscape window-orientation-tip"
- >
- <div class="wrap">
- <img
- class=""
- src="@/assets/images/force-landscape.png"
- alt=""
- draggable="false"
- >
- <div class="txt">
- 请开启自动旋转后
- </div>
- <div class="txt">
- 横屏播放
- </div>
- </div>
- </div>
- <div
- v-if="$isMobile && windowOrientation === 'landscape' && route.meta.windowOrientation === 'portrait'"
- class="force-portrait window-orientation-tip"
- >
- <div class="wrap">
- <img
- class=""
- src="@/assets/images/force-portrait.png"
- alt=""
- draggable="false"
- >
- <div class="txt">
- 请竖屏播放
- </div>
- </div>
- </div>
- </teleport>
- </template>
- <script setup>
- import { useWindowSize } from '@vueuse/core'
- import { computed, inject, ref } from 'vue'
- import ToastComp from "@/components/ToastComp.vue"
- import { isShowToast } from "@/store/index.js"
- import { useRoute, useRouter } from "vue-router"
- const route = useRoute()
- const router = useRouter()
- const {
- windowSizeInCssForRef,
- windowSizeWhenDesignForRef,
- } = useSizeAdapt()
- const $isMobile = inject('$isMobile')
- const { width: windowWidth, height: windowHeight } = useWindowSize()
- console.log(windowWidth)
- const windowOrientation = computed(() => {
- return windowWidth.value >= windowHeight.value ? 'landscape' : 'portrait'
- })
- </script>
- <style lang="less">
- // html, body {
- // overscroll-behavior: none;
- // overflow: hidden;
- // }
- * {
- user-select: none;
- -webkit-touch-callout: none;
- }
- #app {
- height: 100%;
- }
- // 360浏览器不支持not()
- input, textarea {
- user-select: initial;
- }
- // 字体
- @font-face {
- font-family: 'jiangxizhuokai-Regular';
- src: url('@/assets/style/jiangxizhuokai-Regular.ttf');
- }
- // @font-face {
- // font-family: 'Source Han Serif CN';
- // src: url('@/assets/style/SourceHanSerifCN-Regular.otf');
- // }
- // @font-face {
- // font-family: 'Source Han Serif CN-Bold';
- // src: url('@/assets/style/SourceHanSerifCN-Bold.otf');
- // }
- // i {
- // font-style: italic;
- // }
- // 滚动条
- // ::-webkit-scrollbar { background: #dddecc; width: 0.3rem; height: 0.3rem; } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
- // ::-webkit-scrollbar-thumb { background: #828a5b; border-radius: 0.15rem; }
- // ::-webkit-scrollbar-corner { background: #dddecc; }
- /**
- * vue组件过渡效果
- */
- .fade-in-enter-active {
- transition: opacity 1s;
- }
- .fade-in-enter-from {
- opacity: 0;
- }
- .fade-out-leave-active {
- transition: opacity 1s;
- pointer-events: none;
- }
- .fade-out-leave-to {
- opacity: 0;
- }
- .tool-fade-in-out-enter-active {
- transition: opacity 0.5s;
- pointer-events: none;
- }
- .tool-fade-in-out-leave-active {
- transition: opacity 0.5s;
- pointer-events: none;
- }
- .tool-fade-in-out-enter-from {
- opacity: 0 !important;
- }
- .tool-fade-in-out-leave-to {
- opacity: 0 !important;
- }
- .toast-transition-leave-active {
- transition: opacity 0.5s;
- pointer-events: none;
- }
- .toast-transition-leave-to {
- opacity: 0;
- }
- // 不断渐变显隐 animation
- .animation-show-hide {
- animation: show-hide 1.8s infinite;
- }
- @keyframes show-hide {
- 0% {
- opacity: 0;
- }
- 50% {
- opacity: 1;
- }
- 100% {
- opacity: 0;
- }
- }
- // vue-viewer
- .viewer-container {
- background-color: rgba(0, 0, 0, 80%) !important;
- backdrop-filter: blur(5px);
- }
- // 或者
- // .viewer-backdrop {
- // background-color: rgba(0, 0, 0, 90%) !important;
- // }
- </style>
- <style lang="less" scoped>
- .window-orientation-tip{
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- z-index: 9999;
- background: rgba(0,0,0,0.7);
- backdrop-filter: blur(calc(90 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef')));
- display: flex;
- justify-content: center;
- align-items: center;
- >.wrap{
- text-align: center;
- >img{
- width: calc(113 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- height: calc(113 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- margin-bottom: calc(39 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- }
- >.txt{
- font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- font-family: Microsoft YaHei-Regular, Microsoft YaHei;
- font-weight: 400;
- color: rgba(255,255,255,0.7);
- line-height: calc(34 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- letter-spacing: calc(1 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
- }
- }
- }
- </style>
|