Michael Wang 5 жил өмнө
parent
commit
73372b4bb1

+ 17 - 7
.env.development

@@ -1,8 +1,18 @@
 VUE_APP_SKIP_CHECK_NATIVE=true
-VUE_APP_TK_SERVER_HTML_URL=http://192.168.10.38:5220
-VUE_APP_TK_SERVER_API_URL=http://192.168.10.38:8008
-VUE_APP_WK_SERVER_SOCKET=wss://wuhan-dev.qmth.com.cn:8878/api/ws/faceBiopsy
-VUE_APP_WK_SERVER_SOCKET_FOR_AUDIO=wss://wuhan-dev.qmth.com.cn:8878/api/ws/fileAnswer
-VUE_APP_CORE_HOST_URL=https://192.168.10.38:8878
-VUE_APP_OE_ADMIN_HOST_URL=https://192.168.10.38:8878
-VUE_APP_OE_STUDENT_HOST_URL=https://192.168.10.38:8878
+#VUE_APP_TK_SERVER_HTML_URL=http://192.168.10.38:5220
+#VUE_APP_TK_SERVER_API_URL=http://192.168.10.38:8008
+#VUE_APP_WK_SERVER_SOCKET=wss://wuhan-dev.qmth.com.cn:8878/api/ws/faceBiopsy
+#VUE_APP_WK_SERVER_SOCKET_FOR_AUDIO=wss://wuhan-dev.qmth.com.cn:8878/api/ws/fileAnswer
+#VUE_APP_CORE_HOST_URL=https://192.168.10.38:8878
+#VUE_APP_OE_ADMIN_HOST_URL=https://192.168.10.38:8878
+#VUE_APP_OE_STUDENT_HOST_URL=https://192.168.10.38:8878
+
+VUE_APP_CONFIG_FILE_SEVER_URL=https://ecs-test-static.qmth.com.cn
+VUE_APP_TK_SERVER_HTML_URL=http://ecs-test.qmth.com.cn
+VUE_APP_TK_SERVER_API_URL=http://ecs-test.qmth.com.cn
+#VUE_APP_WK_SERVER_SOCKET=wss://ecs-test.qmth.com.cn:8878/api/ws/faceBiopsy
+#VUE_APP_WK_SERVER_SOCKET_FOR_AUDIO=wss://ecs-test.qmth.com.cn:8878
+VUE_APP_CORE_HOST_URL=https://ecs-test.qmth.com.cn:8878
+VUE_APP_OE_ADMIN_HOST_URL=https://ecs-test.qmth.com.cn:8878
+VUE_APP_OE_STUDENT_HOST_URL=https://ecs-test.qmth.com.cn:8878
+

+ 5 - 3
.env.production

@@ -1,5 +1,7 @@
+VUE_APP_CONFIG_FILE_SEVER_URL=https://ecs-static.qmth.com.cn
+# 考虑直接用location.host,即以下两个变量不需要
 VUE_APP_TK_SERVER_HTML_URL=http://ecs.qmth.com.cn
 VUE_APP_TK_SERVER_API_URL=http://ecs.qmth.com.cn
-VUE_APP_WK_SERVER_SOCKET=wss://ecs.qmth.com.cn:8878/api/ws/faceBiopsy
-VUE_APP_WK_SERVER_SOCKET_FOR_AUDIO=wss://ecs.qmth.com.cn:8878/api/ws/fileAnswer
-VUE_APP_GIT_REPO_VERSION=TO_BE_OVERRIDED
+#VUE_APP_WK_SERVER_SOCKET=wss://ecs.qmth.com.cn:8878/api/ws/faceBiopsy
+#VUE_APP_WK_SERVER_SOCKET_FOR_AUDIO=wss://ecs.qmth.com.cn:8878/api/ws/fileAnswer
+VUE_APP_GIT_REPO_VERSION=TO_BE_OVERRIDED

+ 3 - 2
.env.staging

@@ -1,8 +1,9 @@
 VUE_APP_SKIP_CHECK_NATIVE=true
+VUE_APP_CONFIG_FILE_SEVER_URL=https://ecs-test-static.qmth.com.cn
 VUE_APP_TK_SERVER_HTML_URL=http://192.168.10.39:5220
 VUE_APP_TK_SERVER_API_URL=http://192.168.10.39:8008
-VUE_APP_WK_SERVER_SOCKET=wss://wuhan-test.qmth.com.cn:8878/api/ws/faceBiopsy
-VUE_APP_WK_SERVER_SOCKET_FOR_AUDIO=wss://wuhan-test.qmth.com.cn:8878/api/ws/fileAnswer
+#VUE_APP_WK_SERVER_SOCKET=wss://wuhan-test.qmth.com.cn:8878/api/ws/faceBiopsy
+#VUE_APP_WK_SERVER_SOCKET_FOR_AUDIO=wss://wuhan-test.qmth.com.cn:8878/api/ws/fileAnswer
 VUE_APP_CORE_HOST_URL=https://192.168.10.38:8878
 VUE_APP_OE_ADMIN_HOST_URL=https://192.168.10.38:8878
 VUE_APP_OE_STUDENT_HOST_URL=https://192.168.10.38:8878

+ 3 - 2
.env.stagingAli

@@ -1,6 +1,7 @@
 VUE_APP_SKIP_CHECK_NATIVE=true
+VUE_APP_CONFIG_FILE_SEVER_URL=https://ecs-test-static.qmth.com.cn
 VUE_APP_TK_SERVER_HTML_URL=http://ecs-test.qmth.com.cn
 VUE_APP_TK_SERVER_API_URL=http://ecs-test.qmth.com.cn
-VUE_APP_WK_SERVER_SOCKET=wss://ecs-test.qmth.com.cn:8878/api/ws/faceBiopsy
-VUE_APP_WK_SERVER_SOCKET_FOR_AUDIO=wss://ecs-test.qmth.com.cn:8878/api/ws/fileAnswer
+#VUE_APP_WK_SERVER_SOCKET=wss://ecs-test.qmth.com.cn:8878/api/ws/faceBiopsy
+#VUE_APP_WK_SERVER_SOCKET_FOR_AUDIO=wss://ecs-test.qmth.com.cn:8878/api/ws/fileAnswer
 VUE_APP_GIT_REPO_VERSION=TO_BE_OVERRIDED

+ 9 - 2
src/constants/constants.js

@@ -2,9 +2,16 @@ export const FACEID_LINENESS_URL =
   "https://api.megvii.com/faceid/liveness/v2/do?token=";
 export const TK_SERVER_HTML_URL = process.env.VUE_APP_TK_SERVER_HTML_URL;
 export const TK_SERVER_API_URL = process.env.VUE_APP_TK_SERVER_API_URL;
-export const VUE_APP_WK_SERVER_SOCKET = process.env.VUE_APP_WK_SERVER_SOCKET;
+export const VUE_APP_WK_SERVER_SOCKET =
+  (window.location.protocol === "https:" ? "wss://" : "ws://") +
+  window.location.host +
+  "/api/ws/faceBiopsy";
 export const VUE_APP_WK_SERVER_SOCKET_FOR_AUDIO =
-  process.env.VUE_APP_WK_SERVER_SOCKET_FOR_AUDIO;
+  (window.location.protocol === "https:" ? "wss://" : "ws://") +
+  window.location.host +
+  "/api/ws/fileAnswer";
+export const VUE_APP_CONFIG_FILE_SEVER_URL =
+  process.env.VUE_APP_CONFIG_FILE_SEVER_URL;
 export const FACE_API_MODEL_PATH = "/models/20190620/";
 // export const EPCC_DOMAIN = "iepcc-ps.ecs.qmth.com.cn";
 export const EPCC_DOMAIN = "bds.ecs.qmth.com.cn";

+ 5 - 5
src/features/Login/Login.vue

@@ -126,7 +126,10 @@ import { mapMutations } from "vuex";
 import { FACE_API_MODEL_PATH } from "@/constants/constants";
 import DevTools from "./DevTools.vue";
 import nativeExe from "@/utils/nativeExe";
-import { EPCC_DOMAIN } from "@/constants/constants";
+import {
+  EPCC_DOMAIN,
+  VUE_APP_CONFIG_FILE_SEVER_URL,
+} from "@/constants/constants";
 import UA, { chromeUA } from "@/utils/ua.js";
 
 // 检测devtools.  仅在chrome 72+ 有效。
@@ -641,10 +644,7 @@ export default {
     },
     async checkElectronConfig() {
       try {
-        const fileSever =
-          location.hostname === "ecs.qmth.com.cn"
-            ? "https://ecs-static.qmth.com.cn"
-            : "https://ecs-test-static.qmth.com.cn";
+        const fileSever = VUE_APP_CONFIG_FILE_SEVER_URL;
 
         const res = await fetch(
           fileSever +

+ 1 - 0
vue.config.js

@@ -10,6 +10,7 @@ let proxy = {
   "/api": {
     target: process.env.VUE_APP_CORE_HOST_URL,
     changeOrigin: true,
+    ws: true,
   },
 };