浏览代码

Merge branch 'iteration-20240730-bug' into online

lex 8 月之前
父节点
当前提交
14a50f9851
共有 4 个文件被更改,包括 33 次插入9 次删除
  1. 4 4
      public/roll-call/index.html
  2. 4 2
      src/helpers/request.ts
  3. 2 1
      src/views/co-ai/index.module.less
  4. 23 2
      src/views/layout/auth.tsx

+ 4 - 4
public/roll-call/index.html

@@ -31,10 +31,10 @@
       <div class="pageTitle"></div>
       <div v-if="platform!=='modal'"  class="iconBack" @click.stop="onBack()"></div>
       <div id="menu" :class="[platform==='modal'?(imagePos==='right'?'menuRight':'menuLeft'):'']">
-        <button id="table" :class="tableIndex <= 1 ? 'disabled' : ''" v-show="!animationStatus"
-          @click.stop="start()"></button>
-        <button id="sphere" v-show="animationStatus" @click.stop="closes()"></button>
-        <button v-if="platform==='modal'" id="backBtn" @click.stop="onBack()"></button>
+        <div id="table" :class="tableIndex <= 1 ? 'disabled' : ''" v-show="!animationStatus"
+          @click.stop="start()"></div>
+        <div id="sphere" v-show="animationStatus" @click.stop="closes()"></div>
+        <div v-if="platform==='modal'" id="backBtn" @click.stop="onBack()"></div>
         <!-- <button id="reset" style="margin-left:40px;" @click="resets()">照片墙</button> -->
         <!-- <button id="lists" @click="listShow = true">中奖名单</button> -->
       </div>

+ 4 - 2
src/helpers/request.ts

@@ -22,6 +22,7 @@ const request = extend({
 
 // 是否是初始化接口
 let initRequest = false;
+let isPc = false;
 let toast: ReturnType<typeof setTimeout>;
 let toastMsg: ReturnType<typeof setTimeout>;
 
@@ -37,6 +38,7 @@ request.interceptors.request.use(
     }
 
     initRequest = options.initRequest || false;
+    isPc = options.isPc || false;
     const Authorization = storage.get(ACCESS_TOKEN) || '';
     const authHeaders: any = {};
 
@@ -92,7 +94,7 @@ request.interceptors.response.use(
       !otherCode.includes(data.code)
     ) {
       let msg = data.msg || data.message || '处理失败,请重试';
-      if (initRequest) {
+      if (initRequest && !isPc) {
         if (data.code === 403 || data.code === 5000) {
           setLogout();
         } else {
@@ -114,7 +116,7 @@ request.interceptors.response.use(
             api: 'login'
           });
         } else {
-          setLogout();
+          if (!isPc) setLogout();
         }
       }
       throw new Error(msg);

+ 2 - 1
src/views/co-ai/index.module.less

@@ -384,6 +384,7 @@
     &.VIP {
       background: url('./image/icon-music-vip.png') no-repeat center;
       background-size: contain;
+      border-top-right-radius: 9px;;
     }
   }
 
@@ -599,4 +600,4 @@
       padding: 0;
     }
   }
-}
+}

+ 23 - 2
src/views/layout/auth.tsx

@@ -34,7 +34,7 @@ export default defineComponent({
     const setAuth = async () => {
       const { query } = route;
       const token = query.userInfo || query.Authorization;
-
+      console.log(query, 'query');
       if (token) {
         storage.set(ACCESS_TOKEN, token);
       }
@@ -46,6 +46,7 @@ export default defineComponent({
         try {
           const res = await request.get('/edu-app/user/getUserInfo', {
             initRequest: true, // 初始化接口
+            isPc: query.platform ? true : false, // 老师端有用
             requestType: 'form',
             hideLoading: true
           });
@@ -60,7 +61,27 @@ export default defineComponent({
           ) {
             setLoginError();
           } else {
-            setLogout();
+            // 判断是否登录状态
+            if (query.platform) {
+              // 判断是否在应用中
+              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();
+
+            }
           }
         }
         data.loading = false;