2021-08-05 14:23:45 +08:00
|
|
|
<template>
|
2021-08-06 10:54:03 +08:00
|
|
|
<div class="fit">
|
|
|
|
<q-ajax-bar position="top" color="accent" size="5px" skip-hijack />
|
2022-04-15 15:39:45 +08:00
|
|
|
<q-menu context-menu />
|
2021-08-06 10:54:03 +08:00
|
|
|
<router-view />
|
|
|
|
</div>
|
2021-08-05 14:23:45 +08:00
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
2022-04-21 15:12:00 +08:00
|
|
|
import { SessionStorage, Cookies, useQuasar, setCssVar } from "quasar";
|
2021-08-05 17:26:27 +08:00
|
|
|
import { defineComponent } from "vue";
|
|
|
|
import { useI18n } from "vue-i18n";
|
2021-08-06 10:54:03 +08:00
|
|
|
import EventBus, { EventNamesDefine } from "src/common/EventBus";
|
2021-12-23 17:08:21 +08:00
|
|
|
import { useStore } from "src/store";
|
2021-08-05 14:23:45 +08:00
|
|
|
|
2022-04-15 16:53:00 +08:00
|
|
|
import VConsole from "vconsole";
|
|
|
|
|
2022-04-18 17:08:40 +08:00
|
|
|
// 根据条件加载 vConsole
|
2022-04-15 16:53:00 +08:00
|
|
|
{
|
|
|
|
if (window.location.href.indexOf("__showDebug__=_1025_") != -1) {
|
|
|
|
new VConsole();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-05 14:23:45 +08:00
|
|
|
export default defineComponent({
|
2021-08-05 17:26:27 +08:00
|
|
|
name: "App",
|
2021-08-05 14:23:45 +08:00
|
|
|
|
|
|
|
setup() {
|
|
|
|
const $t = useI18n();
|
2022-04-20 08:25:38 +08:00
|
|
|
const $store = useStore();
|
|
|
|
const $q = useQuasar();
|
2022-04-15 16:53:00 +08:00
|
|
|
|
2021-08-05 17:26:27 +08:00
|
|
|
document.title = $t.t("title");
|
|
|
|
|
|
|
|
window.onresize = (evt: any) =>
|
2021-08-06 10:54:03 +08:00
|
|
|
EventBus.getInstance().emit(EventNamesDefine.WindowResize, evt);
|
2021-08-09 15:05:14 +08:00
|
|
|
|
2022-02-10 10:22:05 +08:00
|
|
|
window.onmousedown = (evt: MouseEvent) => {
|
2022-01-25 11:34:07 +08:00
|
|
|
EventBus.getInstance().emit(EventNamesDefine.WindowMouseDown, evt);
|
2022-02-10 10:22:05 +08:00
|
|
|
};
|
|
|
|
window.onmousemove = (evt: any) => {
|
2022-01-25 11:34:07 +08:00
|
|
|
EventBus.getInstance().emit(EventNamesDefine.WindowMouseMove, evt);
|
2022-02-10 10:22:05 +08:00
|
|
|
};
|
|
|
|
window.onmouseup = (evt: any) => {
|
2022-01-25 11:34:07 +08:00
|
|
|
EventBus.getInstance().emit(EventNamesDefine.WindowMouseUp, evt);
|
2022-02-10 10:22:05 +08:00
|
|
|
};
|
|
|
|
window.onmouseout = (evt: any) => {
|
2022-01-25 11:34:07 +08:00
|
|
|
EventBus.getInstance().emit(EventNamesDefine.WindowMouseOut, evt);
|
2022-02-10 10:22:05 +08:00
|
|
|
};
|
2022-01-25 11:34:07 +08:00
|
|
|
|
2022-02-10 10:22:05 +08:00
|
|
|
window.document.body.onclick = (evt: any) => {
|
2022-04-15 15:39:45 +08:00
|
|
|
if ((<any>window).touchPriority) {
|
|
|
|
return;
|
|
|
|
}
|
2021-08-27 17:15:31 +08:00
|
|
|
EventBus.getInstance().emit(EventNamesDefine.DocumentBodyClick, evt);
|
2022-02-10 10:22:05 +08:00
|
|
|
};
|
2021-08-27 17:15:31 +08:00
|
|
|
|
2022-04-15 15:39:45 +08:00
|
|
|
if ("ontouchstart" in document.documentElement === true) {
|
|
|
|
window.document.body.ontouchstart = (evt: any) => {
|
|
|
|
if ((<any>window).touchPriority) {
|
|
|
|
EventBus.getInstance().emit(EventNamesDefine.DocumentBodyClick, evt);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-08-09 15:05:14 +08:00
|
|
|
document.body.classList.add("overflow-hidden");
|
2021-12-23 17:08:21 +08:00
|
|
|
|
2022-03-17 19:14:51 +08:00
|
|
|
(window as any).controlLogout = () => {
|
|
|
|
Cookies.remove("auto_login");
|
|
|
|
SessionStorage.clear();
|
2022-04-24 11:25:33 +08:00
|
|
|
try {
|
|
|
|
$q.fullscreen.exit();
|
|
|
|
} catch {}
|
2022-03-17 19:14:51 +08:00
|
|
|
window.location.reload();
|
|
|
|
};
|
|
|
|
|
2022-04-21 15:12:00 +08:00
|
|
|
(window as any).setPcTheme = () => {
|
|
|
|
setCssVar("primary", "#4aa1ce");
|
|
|
|
setCssVar("secondary", "#26a69a");
|
|
|
|
setCssVar("accent", "#9c27b0");
|
|
|
|
setCssVar("dark", "#1d1d1d");
|
|
|
|
setCssVar("positive", "#21ba45");
|
|
|
|
setCssVar("negative", "#c10015");
|
|
|
|
setCssVar("info", "#31ccec");
|
|
|
|
setCssVar("warning", "#f2c037");
|
|
|
|
setCssVar("dark-page", "#121212");
|
|
|
|
};
|
|
|
|
|
|
|
|
(window as any).setPadTheme = () => {
|
|
|
|
setCssVar("primary", "#0b3536");
|
|
|
|
setCssVar("secondary", "#ffffff");
|
|
|
|
setCssVar("accent", "#2fa39b");
|
|
|
|
setCssVar("dark", "#000000");
|
|
|
|
setCssVar("positive", "#21ba45");
|
|
|
|
setCssVar("negative", "#c10015");
|
|
|
|
setCssVar("info", "#31ccec");
|
|
|
|
setCssVar("warning", "#f2c037");
|
|
|
|
setCssVar("dark-page", "#121212");
|
|
|
|
};
|
|
|
|
|
2022-04-20 08:25:38 +08:00
|
|
|
const landspace = () => {
|
|
|
|
let landspace = false;
|
2022-04-21 15:12:00 +08:00
|
|
|
landspace = window.innerWidth > innerHeight;
|
|
|
|
|
|
|
|
if ($q.platform.is.ipad) {
|
2022-04-20 08:25:38 +08:00
|
|
|
landspace = window.screen.width > window.screen.height;
|
2022-04-21 15:12:00 +08:00
|
|
|
|
|
|
|
if (Math.abs(window.orientation) == 90) {
|
|
|
|
landspace = !landspace;
|
|
|
|
}
|
|
|
|
if (window.location.href.indexOf("___debug_ipad___") != -1) {
|
|
|
|
landspace = !landspace;
|
|
|
|
}
|
2022-04-20 08:25:38 +08:00
|
|
|
}
|
2022-04-21 15:12:00 +08:00
|
|
|
if (window.innerHeight < 600) {
|
|
|
|
// TODO fix android
|
2022-04-20 08:25:38 +08:00
|
|
|
}
|
|
|
|
return landspace;
|
|
|
|
};
|
|
|
|
(<any>window).landspace = landspace;
|
|
|
|
|
|
|
|
window.onorientationchange = () => {
|
|
|
|
$store.commit("updateLandspace", landspace());
|
|
|
|
};
|
|
|
|
|
|
|
|
$store.commit("updateLandspace", landspace());
|
|
|
|
|
2021-08-05 14:23:45 +08:00
|
|
|
return {};
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|