From 00c4056b5d0c1b684c13f9d0188585883a73a592 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Thu, 16 Feb 2023 10:42:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0http=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 44 +++++++++++++++++++++++++++++++++++++++++ src/i18n/zh-CN/index.ts | 3 +++ 2 files changed, 47 insertions(+) diff --git a/src/App.vue b/src/App.vue index 306807f..db4b284 100644 --- a/src/App.vue +++ b/src/App.vue @@ -15,6 +15,8 @@ import GlobalData from "./common/GlobalData"; import { EProductNames } from "./entities/ProductNames"; import { api } from "./boot/axios"; import { WuJieInitializer } from "./common/WuJieInitializer"; +import { isNumber } from "zrender/lib/core/util"; +import ClientConnection from "./common/ClientConnection"; export default defineComponent({ name: "App", @@ -284,6 +286,48 @@ export default defineComponent({ }); } + EventBus.getInstance().on( + EventNamesDefine.CurrentConnectConnected, + (connection: ClientConnection) => { + let final_url = "/get_interface_version"; + if (connection) { + try { + const current_http_url = new URL(window.location.toString()); + const current_ws_url = new URL(connection.url); + current_http_url.hostname = current_ws_url.hostname; + current_http_url.pathname = "/get_interface_version"; + current_http_url.port = "80"; + final_url = current_http_url.toString(); + } catch {} + } + const show_version_tip = () => + $q.dialog({ + persistent: true, + title: $t.t("Version Mismatch !"), + message: $t.t( + "Version Mismatch ! Please Upgrade The Software Again ! Otherwise, The File Upload Function Cannot Be Used !" + ), + }); + interface _GetInterfaceVersionResponse { + version: number; + } + api + .get(final_url) + .then((data) => { + if (data) { + const verson = data.data as _GetInterfaceVersionResponse; + if (verson && verson.version == 2) { + return; + } + } + show_version_tip(); + }) + .catch(() => { + show_version_tip(); + }); + } + ); + return {}; }, }); diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index f01d07f..95454f4 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -758,4 +758,7 @@ export default { "the folder name cannot start with a '.'": "文件夹名称不能以“.” 开头", "change resolution":"更改分辨率", "Loading please wait":"加载中 请稍等" + "Version Mismatch !": "版本不匹配!", + "Version Mismatch ! Please Upgrade The Software Again ! Otherwise, The File Upload Function Cannot Be Used !": + "版本不匹配!请重新升级软件!否则文件上传功能无法正常使用!", };