media_player_client/src/pages/Index.vue

77 lines
2.1 KiB
Vue
Raw Normal View History

2021-08-05 14:23:45 +08:00
<template>
<q-page class="row items-center justify-evenly">
<wall-page />
2022-01-18 16:09:15 +08:00
<media-control-page />
2021-08-05 14:23:45 +08:00
</q-page>
</template>
<script lang="ts">
2022-03-09 15:42:05 +08:00
import { defineComponent, Ref, ref } from "vue";
2021-08-07 11:04:39 +08:00
import WallPage from "src/pages/WallPage.vue";
2022-01-18 16:09:15 +08:00
import MediaControlPage from "src/pages/MediaControlPage.vue";
2021-08-07 11:04:39 +08:00
import EventBus, { EventNamesDefine } from "src/common/EventBus";
import { useQuasar } from "quasar";
import { useI18n } from "vue-i18n";
2021-08-26 11:19:31 +08:00
import { useStore } from "src/store";
2021-08-26 15:42:34 +08:00
import Initializer from "src/common/Initializer";
2021-08-26 11:19:31 +08:00
import GlobalData from "src/common/GlobalData";
2021-08-26 15:42:34 +08:00
import RemoteDataExangeProcesser from "src/common/RemoteDataExangeProcesser";
2021-08-05 14:23:45 +08:00
export default defineComponent({
2021-08-07 11:04:39 +08:00
name: "PageIndex",
2022-03-12 20:01:32 +08:00
components: { WallPage, MediaControlPage },
2021-08-05 14:23:45 +08:00
setup() {
2021-08-26 11:19:31 +08:00
const $store = useStore();
2021-08-07 11:04:39 +08:00
const $q = useQuasar();
const $t = useI18n();
2021-08-26 15:42:34 +08:00
const options = {
$t,
$store,
$q,
};
new Initializer(options).initialize().then(() => {
$store.commit("setInitialized");
});
const remote_data_exange_processer = new RemoteDataExangeProcesser(options);
remote_data_exange_processer.enable();
2021-08-07 11:04:39 +08:00
EventBus.getInstance().on(EventNamesDefine.CurrentConnectDisconnect, () => {
$q.loading.show({
2022-03-17 19:14:51 +08:00
html: true,
2021-08-07 11:04:39 +08:00
message:
2022-03-17 19:14:51 +08:00
$t.t("network disconnect!") +
$t.t("wait reconnection") +
"..." +
"<br />" +
"<a href='javascript:void(0);' OnClick='window.controlLogout()'>" +
$t.t("back to login page") +
"</a>",
2021-08-07 11:04:39 +08:00
});
});
EventBus.getInstance().on(EventNamesDefine.CurrentConnectConnected, () => {
$q.loading.hide();
setTimeout(() => {
new Initializer(options).initialize().then(() => {
$store.commit("setInitialized");
});
}, 500);
2021-08-07 11:04:39 +08:00
});
2021-08-25 17:30:02 +08:00
2021-12-18 16:41:47 +08:00
$store.commit(
"setDeviceIpAddress",
GlobalData.getInstance().getCurrentClientName()
);
2022-04-04 18:01:56 +08:00
EventBus.getInstance().on(EventNamesDefine.CurrentClientChanged, () => {
new Initializer(options).initialize();
});
2022-03-12 20:01:32 +08:00
return {};
2021-08-05 14:23:45 +08:00
},
});
</script>