Ver Fonte

添加权限

lex há 11 meses atrás
pai
commit
a29546c000
1 ficheiros alterados com 17 adições e 11 exclusões
  1. 17 11
      src/views/layout/auth.tsx

+ 17 - 11
src/views/layout/auth.tsx

@@ -60,20 +60,26 @@ export default defineComponent({
           ) {
             setLoginError();
           } else {
-            setLogout();
-
             // 判断是否登录状态
             if (query.platform) {
               // 判断是否在应用中
-              window.parent.postMessage(
-                {
-                  api: 'onLogin'
-                },
-                '*'
-              );
-              setTimeout(() => {
-                window.location.href = `${location.origin}/classroom`;
-              }, 500);
+              if(window.parent && window.parent !== window) {
+                window.parent.postMessage(
+                  {
+                    api: 'onLogin'
+                  },
+                  '*'
+                );
+                setTimeout(() => {
+                  window.location.href = `${location.origin}/classroom`;
+                }, 500);
+              } else {
+                  window.location.href = `${location.origin}/classroom`;
+              }
+
+            } else {
+              setLogout();
+
             }
           }
         }