lex před 1 rokem
rodič
revize
972bc8a0c8
3 změnil soubory, kde provedl 54 přidání a 57 odebrání
  1. 37 47
      dev-dist/sw.js
  2. 3 0
      src/views/attend-class/index.tsx
  3. 14 10
      src/views/preview-window/index.tsx

+ 37 - 47
dev-dist/sw.js

@@ -13,29 +13,31 @@
 
 // If the loader is already loaded, just stop.
 if (!self.define) {
-  const registry = {};
+  let registry = {};
 
   // Used for `eval` and `importScripts` where we can't get script URL by other means.
   // In both cases, it's safe to use a global var because those functions are synchronous.
   let nextDefineUri;
 
   const singleRequire = (uri, parentUri) => {
-    uri = new URL(uri + '.js', parentUri).href;
-    return (
-      registry[uri] ||
-      new Promise(resolve => {
-        if ('document' in self) {
-          const script = document.createElement('script');
-          script.src = uri;
-          script.onload = resolve;
-          document.head.appendChild(script);
-        } else {
-          nextDefineUri = uri;
-          importScripts(uri);
-          resolve();
-        }
-      }).then(() => {
-        const promise = registry[uri];
+    uri = new URL(uri + ".js", parentUri).href;
+    return registry[uri] || (
+      
+        new Promise(resolve => {
+          if ("document" in self) {
+            const script = document.createElement("script");
+            script.src = uri;
+            script.onload = resolve;
+            document.head.appendChild(script);
+          } else {
+            nextDefineUri = uri;
+            importScripts(uri);
+            resolve();
+          }
+        })
+      
+      .then(() => {
+        let promise = registry[uri];
         if (!promise) {
           throw new Error(`Module ${uri} didn’t register its module`);
         }
@@ -45,32 +47,27 @@ if (!self.define) {
   };
 
   self.define = (depsNames, factory) => {
-    const uri =
-      nextDefineUri ||
-      ('document' in self ? document.currentScript.src : '') ||
-      location.href;
+    const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href;
     if (registry[uri]) {
       // Module is already loading or loaded.
       return;
     }
-    const exports = {};
+    let exports = {};
     const require = depUri => singleRequire(depUri, uri);
     const specialDeps = {
       module: { uri },
       exports,
       require
     };
-    registry[uri] = Promise.all(
-      depsNames.map(depName => specialDeps[depName] || require(depName))
-    ).then(deps => {
+    registry[uri] = Promise.all(depsNames.map(
+      depName => specialDeps[depName] || require(depName)
+    )).then(deps => {
       factory(...deps);
       return exports;
     });
   };
 }
-
-define(['./workbox-5357ef54'], function (workbox) {
-  'use strict';
+define(['./workbox-5357ef54'], (function (workbox) { 'use strict';
 
   self.skipWaiting();
   workbox.clientsClaim();
@@ -80,23 +77,16 @@ define(['./workbox-5357ef54'], function (workbox) {
    * requests for URLs in the manifest.
    * See https://goo.gl/S9QRab
    */
-  workbox.precacheAndRoute(
-    [
-      {
-        url: 'registerSW.js',
-        revision: '3ca0b8505b4bec776b69afdba2768812'
-      },
-      {
-        url: 'index.html',
-        revision: '0.88abiq01ca8'
-      }
-    ],
-    {}
-  );
+  workbox.precacheAndRoute([{
+    "url": "registerSW.js",
+    "revision": "3ca0b8505b4bec776b69afdba2768812"
+  }, {
+    "url": "index.html",
+    "revision": "0.bm002gug6co"
+  }], {});
   workbox.cleanupOutdatedCaches();
-  workbox.registerRoute(
-    new workbox.NavigationRoute(workbox.createHandlerBoundToURL('index.html'), {
-      allowlist: [/^\/$/]
-    })
-  );
-});
+  workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
+    allowlist: [/^\/$/]
+  }));
+
+}));

+ 3 - 0
src/views/attend-class/index.tsx

@@ -866,6 +866,7 @@ export default defineComponent({
           ]}
           onClick={async () => {
             if (data.type === 'preview') {
+              handleStop();
               if (state.application) {
                 emit('close');
               } else {
@@ -990,6 +991,7 @@ export default defineComponent({
               round
               onClick={() => {
                 data.modelAttendStatus = false;
+                handleStop();
                 if (state.application) {
                   emit('close');
                 } else {
@@ -1024,6 +1026,7 @@ export default defineComponent({
             onConfirm={() => {
               // 布置完作业之后直接关闭
               setTimeout(() => {
+                handleStop();
                 if (state.application) {
                   emit('close');
                 } else {

+ 14 - 10
src/views/preview-window/index.tsx

@@ -55,16 +55,20 @@ export default defineComponent({
           showIcon={false}
           displayDirective="show">
           <>
-            {type.value == 'attend' ? (
-              <AttendClass
-                type={params.value.type || ''}
-                subjectId={params.value.subjectId || ''}
-                detailId={params.value.detailId || ''}
-                classGroupId={params.value.classGroupId || ''}
-                onClose={() => emit('update:show', false)}
-              />
-            ) : type.value == 'notation' ? (
-              <iframe src={params.value.src}></iframe>
+            {show.value ? (
+              type.value == 'attend' ? (
+                <AttendClass
+                  type={params.value.type || ''}
+                  subjectId={params.value.subjectId || ''}
+                  detailId={params.value.detailId || ''}
+                  classGroupId={params.value.classGroupId || ''}
+                  onClose={() => emit('update:show', false)}
+                />
+              ) : type.value == 'notation' ? (
+                <iframe src={params.value.src}></iframe>
+              ) : (
+                ''
+              )
             ) : (
               ''
             )}