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 !": + "版本不匹配!请重新升级软件!否则文件上传功能无法正常使用!", };