App.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <router-view />
  3. <teleport to="body">
  4. <Transition name="toast-transition">
  5. <ToastComp v-if="isShowToast" />
  6. </Transition>
  7. <div
  8. v-if="$isMobile && windowOrientation === 'portrait' && route.meta.windowOrientation === 'landscape'"
  9. class="force-landscape window-orientation-tip"
  10. >
  11. <div class="wrap">
  12. <img
  13. class=""
  14. src="@/assets/images/force-landscape.png"
  15. alt=""
  16. draggable="false"
  17. >
  18. <div class="txt">
  19. 请开启自动旋转后
  20. </div>
  21. <div class="txt">
  22. 横屏播放
  23. </div>
  24. </div>
  25. </div>
  26. <div
  27. v-if="$isMobile && windowOrientation === 'landscape' && route.meta.windowOrientation === 'portrait'"
  28. class="force-portrait window-orientation-tip"
  29. >
  30. <div class="wrap">
  31. <img
  32. class=""
  33. src="@/assets/images/force-portrait.png"
  34. alt=""
  35. draggable="false"
  36. >
  37. <div class="txt">
  38. 请竖屏播放
  39. </div>
  40. </div>
  41. </div>
  42. </teleport>
  43. </template>
  44. <script setup>
  45. import { useWindowSize } from '@vueuse/core'
  46. import { computed, inject, ref } from 'vue'
  47. import ToastComp from "@/components/ToastComp.vue"
  48. import { isShowToast } from "@/store/index.js"
  49. import { useRoute, useRouter } from "vue-router"
  50. const route = useRoute()
  51. const router = useRouter()
  52. const {
  53. windowSizeInCssForRef,
  54. windowSizeWhenDesignForRef,
  55. } = useSizeAdapt()
  56. const $isMobile = inject('$isMobile')
  57. const { width: windowWidth, height: windowHeight } = useWindowSize()
  58. console.log(windowWidth)
  59. const windowOrientation = computed(() => {
  60. return windowWidth.value >= windowHeight.value ? 'landscape' : 'portrait'
  61. })
  62. </script>
  63. <style lang="less">
  64. // html, body {
  65. // overscroll-behavior: none;
  66. // overflow: hidden;
  67. // }
  68. * {
  69. user-select: none;
  70. -webkit-touch-callout: none;
  71. }
  72. #app {
  73. height: 100%;
  74. }
  75. // 360浏览器不支持not()
  76. input, textarea {
  77. user-select: initial;
  78. }
  79. // 字体
  80. @font-face {
  81. font-family: 'jiangxizhuokai-Regular';
  82. src: url('@/assets/style/jiangxizhuokai-Regular.ttf');
  83. }
  84. // @font-face {
  85. // font-family: 'Source Han Serif CN';
  86. // src: url('@/assets/style/SourceHanSerifCN-Regular.otf');
  87. // }
  88. // @font-face {
  89. // font-family: 'Source Han Serif CN-Bold';
  90. // src: url('@/assets/style/SourceHanSerifCN-Bold.otf');
  91. // }
  92. // i {
  93. // font-style: italic;
  94. // }
  95. // 滚动条
  96. // ::-webkit-scrollbar { background: #dddecc; width: 0.3rem; height: 0.3rem; } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
  97. // ::-webkit-scrollbar-thumb { background: #828a5b; border-radius: 0.15rem; }
  98. // ::-webkit-scrollbar-corner { background: #dddecc; }
  99. /**
  100. * vue组件过渡效果
  101. */
  102. .fade-in-enter-active {
  103. transition: opacity 1s;
  104. }
  105. .fade-in-enter-from {
  106. opacity: 0;
  107. }
  108. .fade-out-leave-active {
  109. transition: opacity 1s;
  110. pointer-events: none;
  111. }
  112. .fade-out-leave-to {
  113. opacity: 0;
  114. }
  115. .tool-fade-in-out-enter-active {
  116. transition: opacity 0.5s;
  117. pointer-events: none;
  118. }
  119. .tool-fade-in-out-leave-active {
  120. transition: opacity 0.5s;
  121. pointer-events: none;
  122. }
  123. .tool-fade-in-out-enter-from {
  124. opacity: 0 !important;
  125. }
  126. .tool-fade-in-out-leave-to {
  127. opacity: 0 !important;
  128. }
  129. .toast-transition-leave-active {
  130. transition: opacity 0.5s;
  131. pointer-events: none;
  132. }
  133. .toast-transition-leave-to {
  134. opacity: 0;
  135. }
  136. // 不断渐变显隐 animation
  137. .animation-show-hide {
  138. animation: show-hide 1.8s infinite;
  139. }
  140. @keyframes show-hide {
  141. 0% {
  142. opacity: 0;
  143. }
  144. 50% {
  145. opacity: 1;
  146. }
  147. 100% {
  148. opacity: 0;
  149. }
  150. }
  151. // vue-viewer
  152. .viewer-container {
  153. background-color: rgba(0, 0, 0, 80%) !important;
  154. backdrop-filter: blur(5px);
  155. }
  156. // 或者
  157. // .viewer-backdrop {
  158. // background-color: rgba(0, 0, 0, 90%) !important;
  159. // }
  160. </style>
  161. <style lang="less" scoped>
  162. .window-orientation-tip{
  163. position: absolute;
  164. left: 0;
  165. top: 0;
  166. width: 100%;
  167. height: 100%;
  168. z-index: 9999;
  169. background: rgba(0,0,0,0.7);
  170. backdrop-filter: blur(calc(90 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef')));
  171. display: flex;
  172. justify-content: center;
  173. align-items: center;
  174. >.wrap{
  175. text-align: center;
  176. >img{
  177. width: calc(113 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  178. height: calc(113 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  179. margin-bottom: calc(39 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  180. }
  181. >.txt{
  182. font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  183. font-family: Microsoft YaHei-Regular, Microsoft YaHei;
  184. font-weight: 400;
  185. color: rgba(255,255,255,0.7);
  186. line-height: calc(34 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  187. letter-spacing: calc(1 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  188. }
  189. }
  190. }
  191. </style>