From d68a776a361f2c655c00992f5ed6d65b1568441f Mon Sep 17 00:00:00 2001 From: fangxiang Date: Tue, 30 Aug 2022 10:26:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=E6=A8=A1=E5=BC=8F=E6=97=A0?= =?UTF-8?q?=E8=AE=BA=E5=A6=82=E4=BD=95=E5=BC=80=E6=94=BE=E8=BE=93=E5=87=BA?= =?UTF-8?q?=E6=9D=BF=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 37 ++++++++++++++++++++++++++ src/common/EventBus.ts | 1 + src/components/SystemSettingDialog.vue | 10 ++++--- src/layouts/MainLayout.vue | 4 +++ 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/src/App.vue b/src/App.vue index ce311e6..13643dd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -105,6 +105,43 @@ export default defineComponent({ console.log(e); } + EventBus.getInstance().on(EventNamesDefine.CheckDebug, () => { + const to_normal_url = () => { + const p1 = window.location.href.indexOf("?debug"); + const p2 = window.location.href.indexOf("#"); + const p3 = window.location.href.substring(0, p1); + const p4 = window.location.href.substring(p2); + window.location.href = p3 + p4; + }; + if ($store.state.advanced_debug) { + const pwd = Math.floor(Math.random() * (999999 - 100000 + 1) + 100000); + $q.dialog({ + title: "PWD?", + message: pwd + "?", + prompt: { + model: "", + type: "text", // optional + }, + persistent: true, + cancel: true, + }) + .onOk((data: string) => { + try { + const v = parseInt(data.replace(/-/g, "").trim()); + if (pwd * pwd * pwd * new Date().getUTCHours() == v) { + return; + } + } catch (e) { + console.log(e); + } + to_normal_url(); + }) + .onCancel(() => { + to_normal_url(); + }); + } + }); + window.onresize = (evt: any) => EventBus.getInstance().emit(EventNamesDefine.WindowResize, evt); diff --git a/src/common/EventBus.ts b/src/common/EventBus.ts index 9f40088..c0e3dd0 100644 --- a/src/common/EventBus.ts +++ b/src/common/EventBus.ts @@ -35,4 +35,5 @@ export namespace EventNamesDefine { export const DropToWall = "onDropToWall"; export const RefreshJointActionEquipmentList = "onRefreshJointActionEquipmentList"; + export const CheckDebug = "CheckDebug"; } diff --git a/src/components/SystemSettingDialog.vue b/src/components/SystemSettingDialog.vue index aad6aa5..7fbe327 100644 --- a/src/components/SystemSettingDialog.vue +++ b/src/components/SystemSettingDialog.vue @@ -56,7 +56,7 @@ :disable="loading" /> diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 208449e..b631c44 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -143,6 +143,10 @@ export default defineComponent({ show_back.value = true; }); + if ($store.state.advanced_debug) { + EventBus.getInstance().emit(EventNamesDefine.CheckDebug); + } + return { landspace, show_back,