Browse Source

更新登录问题

lex 1 year ago
parent
commit
f24d203822

+ 37 - 46
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,31 +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();
@@ -79,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.g1op20r37qo'
-      }
-    ],
-    {}
-  );
+  workbox.precacheAndRoute([{
+    "url": "registerSW.js",
+    "revision": "3ca0b8505b4bec776b69afdba2768812"
+  }, {
+    "url": "index.html",
+    "revision": "0.hrh4hj1mvdo"
+  }], {});
   workbox.cleanupOutdatedCaches();
-  workbox.registerRoute(
-    new workbox.NavigationRoute(workbox.createHandlerBoundToURL('index.html'), {
-      allowlist: [/^\/$/]
-    })
-  );
-});
+  workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {
+    allowlist: [/^\/$/]
+  }));
+
+}));

+ 3 - 1
src/components/layout/index.module.less

@@ -225,6 +225,8 @@
       }
 
       .optons {
+        margin-top: 18px;
+        margin-bottom: 14px;
         width: 32px;
         height: 32px;
         margin-right: 24px;
@@ -501,4 +503,4 @@
     }
   }
 
-}
+}

+ 2 - 2
src/components/layout/layoutTop.tsx

@@ -92,13 +92,13 @@ export default defineComponent({
                   <div
                     class={styles.optons}
                     onClick={() => (showSuggestionViseble.value = true)}>
-                    <NImage src={opinionIcon} previewDisabled></NImage>
+                    <img src={opinionIcon}></img>
                   </div>
                 ),
                 default: '意见反馈'
               }}
             </NTooltip>
-            {/* </div> */}
+
             <div onClick={() => (showImGroup.value = true)}>
               <NBadge
                 value={noReadCount.value}

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

@@ -58,6 +58,8 @@ import { px2vw } from '/src/utils';
 import PlaceholderTone from '/src/components/layout/modals/placeholderTone';
 import { state as globalState } from '/src/state';
 import Chapter from './model/chapter';
+import { useRouter } from 'vue-router';
+import { useUserStore } from '@/store/modules/users';
 
 import iconBeatIcon from './new-image/icon-beatIcon.png';
 import iconChange from './new-image/icon-change.png';
@@ -113,6 +115,8 @@ export default defineComponent({
   setup(props, { emit }) {
     const message = useMessage();
     const route = useRoute();
+    const router = useRouter();
+    const users = useUserStore();
     /** 设置播放容器 16:9 */
     const parentContainer = reactive({
       width: '100vw'
@@ -247,6 +251,19 @@ export default defineComponent({
           handlePreAndNext('down');
         }
       }
+
+      if (ev.data?.api === 'onLogin') {
+        const documentDom: any = document;
+        documentDom.exitFullscreen
+          ? documentDom.exitFullscreen()
+          : documentDom.mozCancelFullScreen
+          ? documentDom.mozCancelFullScreen()
+          : documentDom.webkitExitFullscreen
+          ? documentDom.webkitExitFullscreen()
+          : '';
+        users.logout();
+        router.replace('/login');
+      }
     };
 
     onMounted(() => {