黄琪勇 1 rok pred
rodič
commit
70063fbb1c

+ 4 - 0
.env

@@ -1,3 +1,7 @@
 # 公共环境变量
 
 VUE_APP_TITLE="乐教通"
+#安全证书
+VUE_APP_MAC_GYM_SECUREANTH="https://oss.dayaedu.com/https-ssl/gym/安全证书.p12"  #密码  dayaedu.com
+VUE_APP_MAC_GYT_SECUREANTH="https://oss.dayaedu.com/https-ssl/gyt/安全证书.p12"  #密码  lexiaoya.cn
+VUE_APP_WIN_SECUREANTH="https://oss.dayaedu.com/https-ssl/安全证书.pfx"

+ 5 - 0
src/config/index.ts

@@ -4,3 +4,8 @@ export const URL_API_GYM = process.env.VUE_APP_URL_GYM as string
 
 // 画板地址
 export const URL_WHITEBOARD = process.env.VUE_APP_WHITEBOARD as string
+
+// 安全证书地址
+export const URL_MAC_GYM_SECUREANTH = process.env.VUE_APP_MAC_GYM_SECUREANTH as string
+export const URL_MAC_GYT_SECUREANTH = process.env.VUE_APP_MAC_GYT_SECUREANTH as string
+export const URL_WIN_SECUREANTH = process.env.VUE_APP_WIN_SECUREANTH as string

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


+ 11 - 9
src/hooks/useSecureAnth/index.ts

@@ -16,13 +16,15 @@ type objType = {
    onOk?: (...nargs: any[]) => void
 }
 export default (obj?: objType) => {
-   modalFrame({
-      template: secureAnth,
-      width: 920,
-      height: 860,
-      btnShow: [],
-      className: "useSecureAnth",
-      onCancel: obj?.onCancel,
-      onOk: obj?.onCancel
-   })
+   // 只弹窗一次
+   document.querySelector(".h-modalFrame.useSecureAnth") ||
+      modalFrame({
+         template: secureAnth,
+         width: 920,
+         height: 860,
+         btnShow: [],
+         className: "useSecureAnth",
+         onCancel: obj?.onCancel,
+         onOk: obj?.onCancel
+      })
 }

+ 7 - 4
src/hooks/useSecureAnth/secureAnth.vue

@@ -36,13 +36,13 @@
                   <div class="stepNum">03</div>
                   <div class="titleCon">
                      输入证书密码:
-                     <span class="colorTwo">lexiaoya.cn</span>
+                     <span class="colorTwo">{{ userStoreHook.roles === "GYM" ? "dayaedu.com" : "lexiaoya.cn" }}</span>
                      ,点击
                      <span class="colorOne">【好】</span>
                   </div>
                </div>
                <div class="contentBox">
-                  <img class="mac3Img" src="./img/mac3.png" />
+                  <img class="mac3Img" :src="userStoreHook.roles === 'GYM' ? require('./img/mac3_1.png') : require('./img/mac3.png')" />
                </div>
             </div>
             <div class="stepCon" v-if="stepNum === 3">
@@ -201,7 +201,10 @@
 <script setup lang="ts">
 import { ref } from "vue"
 import { ElScrollbar } from "element-plus"
+import { URL_MAC_GYM_SECUREANTH, URL_MAC_GYT_SECUREANTH, URL_WIN_SECUREANTH } from "@/config"
+import userStore from "@/store/modules/user"
 
+const userStoreHook = userStore()
 const emits = defineEmits<{
    (e: "onCancel"): void
 }>()
@@ -217,9 +220,9 @@ const elScrollbarDom = ref<InstanceType<typeof ElScrollbar>>()
 // 下载证书
 function handleDownload() {
    if (isMac) {
-      window.open("https://oss.dayaedu.com/https-ssl/yjt/安全证书.p12")
+      window.open(userStoreHook.roles === "GYM" ? URL_MAC_GYM_SECUREANTH : URL_MAC_GYT_SECUREANTH)
    } else {
-      window.open("https://oss.dayaedu.com/https-ssl/安全证书.pfx")
+      window.open(URL_WIN_SECUREANTH)
    }
 }
 // 步骤

+ 8 - 7
src/libs/axios.ts

@@ -77,16 +77,17 @@ class HttpAsynAxios {
             // }
             if (error.response?.status === 511) {
                // isLogin=true 带有这个是登录时候的判断弹窗验证证书  其他的走正常弹窗
-               if (/isLogin=true/.test(error.config?.url)) {
-                  return Promise.reject({
-                     code: 511,
-                     message: "没有安装证书",
-                     data: null
-                  })
+               if (!/isLogin=true/.test(error.config?.url)) {
+                  useSecureAnth()
                }
-               useSecureAnth()
+               return Promise.reject({
+                  code: 511,
+                  message: "请下载安装安全数据证书",
+                  data: null
+               })
             }
             const rejectData: apiResDataType =
+               //取消接口返回自己的 CODE_ERR_CANCELED
                error.code === CODE_ERR_CANCELED
                   ? {
                        code: error.code,