Browse Source

修复 打开窗口全频

mo 1 year ago
parent
commit
c15f0b84ba

+ 3 - 1
src/components/layout/index.tsx

@@ -21,7 +21,7 @@ import { px2vw, px2vwH } from '@/utils/index';
 import PlaceholderTone from './modals/placeholderTone';
 import { state } from '/src/state';
 import PreviewWindow from '/src/views/preview-window';
-import { nextTick } from 'process';
+import {fscreen} from '@/utils/index'
 export default defineComponent({
   name: 'layoutView',
   setup() {
@@ -666,6 +666,8 @@ export default defineComponent({
                 previewItem.value = {
                   ...item
                 };
+                state.application = window.matchMedia('(display-mode: standalone)').matches
+                fscreen()
               } else {
                 const { href } = router.resolve({
                   path: '/attend-class',

+ 2 - 1
src/views/attend-class/index.tsx

@@ -50,6 +50,7 @@ import beatIcon from '/src/components/layout/images/beatIcon.png';
 import toneIcon from '/src/components/layout/images/toneIcon.png';
 import { px2vw } from '/src/utils';
 import PlaceholderTone from '/src/components/layout/modals/placeholderTone';
+import { state as globalState } from '/src/state';
 import { state } from '/src/state';
 export type ToolType = 'init' | 'pen' | 'whiteboard';
 export type ToolItem = {
@@ -1341,7 +1342,7 @@ export default defineComponent({
                 type="primary"
                 onClick={() => {
                   //
-                  if (window.matchMedia('(display-mode: standalone)').matches) {
+                  if (globalState.application) {
                     document.exitFullscreen
                       ? document.exitFullscreen()
                       : document.mozCancelFullScreen

+ 3 - 0
src/views/classList/index.tsx

@@ -30,6 +30,7 @@ import TheTooltip from '/src/components/TheTooltip';
 import PreviewWindow from '../preview-window';
 import { state as globalState } from '/src/state';
 import {courseSchedulePage} from '../home/api'
+import { fscreen } from '/src/utils';
 export default defineComponent({
   name: 'class-classList',
   setup(props, { emit }) {
@@ -381,6 +382,8 @@ export default defineComponent({
                 state.previewParams = {
                   ...item
                 };
+                globalState.application= window.matchMedia('(display-mode: standalone)').matches
+                fscreen()
               } else {
                 const { href } = router.resolve({
                   path: '/attend-class',

+ 2 - 0
src/views/home/index.tsx

@@ -61,6 +61,7 @@ import PlaceholderTone from '@/components/layout/modals/placeholderTone';
 import { state } from '/src/state';
 import { fscreen} from '@/utils/index'
 import PreviewWindow from '../preview-window';
+import { state as globalState } from '/src/state';
 export const formatDateToDay = () => {
   const hours = dayjs().hour();
   if (hours < 12) {
@@ -343,6 +344,7 @@ export default defineComponent({
                 subjectId: forms.subjectId,
                 detailId: forms.unit
               };
+              globalState.application = window.matchMedia('(display-mode: standalone)').matches
               // 加全屏
               fscreen()
             } else {

+ 1 - 0
src/views/login/index.tsx

@@ -40,6 +40,7 @@ export default defineComponent({
 
 
       if (window.matchMedia('(display-mode: standalone)').matches) {
+        state.application = window.matchMedia('(display-mode: standalone)').matches
         console.log('应用内打开')
       }else{
         console.log(popEvent.value,'popEvent.value')

+ 2 - 0
src/views/notation/index.tsx

@@ -48,6 +48,7 @@ export default defineComponent({
       console.log(e.data, 'data');
       if (e.data.api === 'notation_open') {
         if (window.matchMedia('(display-mode: standalone)').matches) {
+          state.application = window.matchMedia('(display-mode: standalone)').matches
           show.value = true;
           previewModal.value = true;
           previewParams.value = {
@@ -108,6 +109,7 @@ export default defineComponent({
                     '*'
                   );
                   if (window.matchMedia('(display-mode: standalone)').matches) {
+                    state.application = window.matchMedia('(display-mode: standalone)').matches
                     fscreen()
                 }}}>
                 确定

+ 2 - 0
src/views/prepare-lessons/components/lesson-main/courseware/index.tsx

@@ -193,6 +193,7 @@ export default defineComponent({
       }
       // 判断是否在应用里面
       if (window.matchMedia('(display-mode: standalone)').matches) {
+        state.application = window.matchMedia('(display-mode: standalone)').matches
         forms.previewModal = true;
         fscreen()
         forms.previewParams = {
@@ -436,6 +437,7 @@ export default defineComponent({
             onClose={() => (forms.showAttendClass = false)}
             onPreview={(item: any) => {
               if (window.matchMedia('(display-mode: standalone)').matches) {
+                state.application = window.matchMedia('(display-mode: standalone)').matches
                 forms.previewModal = true;
                 forms.previewParams = {
                   ...item

+ 1 - 0
src/views/prepare-lessons/model/attend-class/index.tsx

@@ -45,6 +45,7 @@ export default defineComponent({
           detailId: prepareStore.getSelectKey
         });
         if (window.matchMedia('(display-mode: standalone)').matches) {
+          state.application = window.matchMedia('(display-mode: standalone)').matches
           setTimeout(() => {
             fscreen();
           }, 200);

+ 1 - 0
src/views/xiaoku-music/index.tsx

@@ -403,6 +403,7 @@ export default defineComponent({
                       : location.origin;
                     const src = `${origin}/instrument?platform=pc&showGuide=true&id=${activeItem.value.id}&Authorization=${user.getToken}`;
                     if (window.matchMedia('(display-mode: standalone)').matches) {
+                      state.application = window.matchMedia('(display-mode: standalone)').matches
                       data.previewModal = true;
                       data.previewUrl = src;
                       data.showPreivew = false;