黄琪勇 il y a 1 an
Parent
commit
8454e066df

+ 8 - 0
src/api/user.api.ts

@@ -70,3 +70,11 @@ export const logout_gyt = () => {
       url: "/api-teacher/user/logout"
    })
 }
+
+// 安全证书
+export const mutualTLSQuery_gyt = () => {
+   return httpAxios_gyt.axioseRquest({
+      method: "get",
+      url: "/api-teacher/open/mutualTLS/query?isLogin=true" // 后面跟参数来区分是不是登录511
+   })
+}

BIN
src/hooks/useSecureAnth/img/mac5.png


BIN
src/hooks/useSecureAnth/img/mac5_1.png


BIN
src/hooks/useSecureAnth/img/win8.png


BIN
src/hooks/useSecureAnth/img/win8_1.png


+ 2 - 2
src/hooks/useSecureAnth/secureAnth.vue

@@ -69,7 +69,7 @@
                   </div>
                </div>
                <div class="contentBox">
-                  <img class="mac5Img" src="./img/mac5.png" />
+                  <img class="mac5Img" :src="userStoreHook.roles === 'GYM' ? require('./img/mac5_1.png') : require('./img/mac5.png')" />
                </div>
             </div>
             <div class="stepCon" v-if="stepNum === 5">
@@ -186,7 +186,7 @@
                   <div class="titleCon">在【选择证书】弹窗中点击【确定】按钮,证书安装完成,开始使用乐教通吧!</div>
                </div>
                <div class="contentBox">
-                  <img class="win8Img" src="./img/win8.png" />
+                  <img class="win8Img" :src="userStoreHook.roles === 'GYM' ? require('./img/win8_1.png') : require('./img/win8.png')" />
                </div>
             </div>
          </template>

+ 22 - 16
src/plugin/httpAjax.ts

@@ -32,11 +32,13 @@ export const httpAjaxErrMsg = function <T extends axiosApiType, P extends Parame
             resolve(res.data)
          })
          .catch(err => {
-            ElMessage({
-               showClose: true,
-               message: err.message,
-               type: "error"
-            })
+            if (err.code !== 511) {
+               ElMessage({
+                  showClose: true,
+                  message: err.message,
+                  type: "error"
+               })
+            }
             resolve(err)
          })
    })
@@ -77,11 +79,13 @@ export const httpAjaxLoadingErrMsg = function <T extends axiosApiType, P extends
          })
          .catch(err => {
             LoadingBar.loading(false)
-            ElMessage({
-               showClose: true,
-               message: err.message || err.msg,
-               type: "error"
-            })
+            if (err.code !== 511) {
+               ElMessage({
+                  showClose: true,
+                  message: err.message,
+                  type: "error"
+               })
+            }
             resolve(err)
          })
    })
@@ -118,7 +122,7 @@ export const httpAjaxCrud = function <T extends axiosApiType, P extends Paramete
             ElNotification({
                type: "error",
                title: "失败",
-               message: err.message || err.msg,
+               message: err.message,
                position: "top-right",
                duration: 3000
             })
@@ -178,10 +182,12 @@ export const httpAjaxDownload = function <T extends axiosApiType, P extends Para
       })
       .catch(err => {
          LoadingBar.loading(false)
-         ElMessage({
-            showClose: true,
-            message: err.message,
-            type: "error"
-         })
+         if (err.code !== 511) {
+            ElMessage({
+               showClose: true,
+               message: err.message,
+               type: "error"
+            })
+         }
       })
 }

+ 13 - 15
src/viewsframe/login/login.vue

@@ -40,7 +40,7 @@ import { ref, computed } from "vue"
 import userStore from "@/store/modules/user"
 import { useRouter } from "vue-router"
 import useSecureAnth from "@/hooks/useSecureAnth"
-import { mutualTLSQuery_gym } from "@/api/user.api"
+import { mutualTLSQuery_gym, mutualTLSQuery_gyt } from "@/api/user.api"
 import { httpAjaxLoading } from "@/plugin/httpAjax"
 
 const userStoreHook = userStore()
@@ -69,20 +69,18 @@ function handleQrcodeStatus() {
          if (status === "FINISH") {
             // 登录成功
             userStoreHook.login(res.data).then(() => {
-               // 目前管乐迷才有安全证书
-               res.data.appKey === "GYM"
-                  ? httpAjaxLoading(mutualTLSQuery_gym).then(res => {
-                       if (res.code === 511) {
-                          useSecureAnth({
-                             onCancel() {
-                                router.push({ path: "/" })
-                             }
-                          })
-                       } else {
-                          router.push({ path: "/" })
-                       }
-                    })
-                  : router.push({ path: "/" })
+               // 安全证书
+               httpAjaxLoading(res.data.appKey === "GYM" ? mutualTLSQuery_gym : mutualTLSQuery_gyt).then(res => {
+                  if (res.code === 511) {
+                     useSecureAnth({
+                        onCancel() {
+                           router.push({ path: "/" })
+                        }
+                     })
+                  } else {
+                     router.push({ path: "/" })
+                  }
+               })
             })
             return
          }