media_player_client/src/App.vue

77 lines
2.0 KiB
Vue
Raw Normal View History

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-03-17 19:14:51 +08:00
import { SessionStorage, Cookies } 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";
import GlobalData from "./common/GlobalData";
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";
// 根据调价加载 vConsole
{
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();
const $q = useStore();
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
window.onmousedown = (evt: MouseEvent) => {
2022-01-25 11:34:07 +08:00
EventBus.getInstance().emit(EventNamesDefine.WindowMouseDown, evt);
};
window.onmousemove = (evt: any) => {
2022-01-25 11:34:07 +08:00
EventBus.getInstance().emit(EventNamesDefine.WindowMouseMove, evt);
};
window.onmouseup = (evt: any) => {
2022-01-25 11:34:07 +08:00
EventBus.getInstance().emit(EventNamesDefine.WindowMouseUp, evt);
};
window.onmouseout = (evt: any) => {
2022-01-25 11:34:07 +08:00
EventBus.getInstance().emit(EventNamesDefine.WindowMouseOut, evt);
};
2022-01-25 11:34:07 +08:00
window.document.body.onclick = (evt: any) => {
2022-04-15 15:39:45 +08:00
if ((<any>window).touchPriority) {
return;
}
EventBus.getInstance().emit(EventNamesDefine.DocumentBodyClick, evt);
};
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");
2022-03-17 19:14:51 +08:00
(window as any).controlLogout = () => {
Cookies.remove("auto_login");
SessionStorage.clear();
window.location.reload();
};
2021-08-05 14:23:45 +08:00
return {};
},
});
</script>