From cbbb8122127fa54f10943d681c6a5b851ccb0934 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Tue, 2 Aug 2022 19:22:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96=E4=BA=A7?= =?UTF-8?q?=E5=93=81=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=20SpecialVideo?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E7=AA=97=E5=8F=A3=E5=A4=A7=E5=B0=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=8C=89=E9=92=AE=E5=92=8C=E5=AD=97=E5=B9=95=E6=8C=89?= =?UTF-8?q?=E9=92=AE=20SpecialVideo=E4=BF=AE=E5=A4=8D=E6=8C=89ALT=E5=BC=80?= =?UTF-8?q?=E7=AA=97=E6=97=B6=E6=98=BE=E7=A4=BA=E7=9A=84=E6=A1=8C=E9=9D=A2?= =?UTF-8?q?=E5=88=86=E8=BE=A8=E7=8E=87=E9=94=99=E8=AF=AF=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 11 ++++++ src/common/SpecialVideoHelper.ts | 36 ++++++++++++++++++++ src/components/AboutDialog.vue | 21 ++++++++++++ src/components/SystemSettingDialog.vue | 1 + src/components/Window.vue | 1 + src/components/WindowRectEditDialog.vue | 32 ++++++++++++++++-- src/pages/TopToolBar.vue | 2 ++ src/pages/WallPage.vue | 45 +++++++++++++++---------- 8 files changed, 129 insertions(+), 20 deletions(-) create mode 100644 src/common/SpecialVideoHelper.ts diff --git a/src/App.vue b/src/App.vue index b39c411..e884948 100644 --- a/src/App.vue +++ b/src/App.vue @@ -56,6 +56,17 @@ export default defineComponent({ console.log((window).media_control_client_product); $store.commit("setProductName", (window).media_control_client_product); + // 设置标题 + if ( + (window).media_control_client_product == EProductNames.LED_PLAYER + ) { + document.title = $t.t("LedPlayer") + "WebApp"; + } else if ( + (window).media_control_client_product == EProductNames.SPECIAL_VIDEO + ) { + document.title = $t.t("SpecialVideo") + "WebApp"; + } + // 设置 AXIOS 默认请求头 { api.defaults.headers.common["X-Product-Name"] = (( diff --git a/src/common/SpecialVideoHelper.ts b/src/common/SpecialVideoHelper.ts new file mode 100644 index 0000000..3409791 --- /dev/null +++ b/src/common/SpecialVideoHelper.ts @@ -0,0 +1,36 @@ +export interface IScreenInfo { + screen_width: number; + screen_height: number; + unit_width: number; + unit_height: number; + wall_rows: number; + wall_cols: number; + desktop_col: number; +} + +export class SpecialVideoHelper { + private static kScreenWidth = 3840; + private static kScreenHeight = 2160; + + public static getScreenInfo( + wall_cols: number, + wall_rows: number + ): IScreenInfo { + const desktp_row = Math.ceil(Math.sqrt(wall_rows * wall_cols)); + const desktop_col = desktp_row; + const unit_width = SpecialVideoHelper.kScreenWidth / desktop_col; + const unit_height = SpecialVideoHelper.kScreenHeight / desktp_row; + const screen_width = wall_cols * unit_width; + const screen_height = wall_rows * unit_height; + console.log(screen_width); + return { + screen_width, + screen_height, + unit_width, + unit_height, + wall_rows, + wall_cols, + desktop_col, + }; + } +} diff --git a/src/components/AboutDialog.vue b/src/components/AboutDialog.vue index ee914e0..0cc721f 100644 --- a/src/components/AboutDialog.vue +++ b/src/components/AboutDialog.vue @@ -91,6 +91,14 @@ > + + + +
+ {{ product }} +
+
+
@@ -107,6 +115,7 @@ import { useI18n } from "vue-i18n"; import version from "../../package.json"; import GlobalData from "src/common/GlobalData"; +import { EProductNames } from "src/entities/ProductNames"; export default defineComponent({ name: "ComponentAboutDialog", @@ -120,6 +129,17 @@ export default defineComponent({ let click_count = ref(0); const target_click_count = ref(30); + const product = ref(""); + if ( + (window).media_control_client_product == EProductNames.LED_PLAYER + ) { + product.value = "LedPlayer"; + } else if ( + (window).media_control_client_product == EProductNames.SPECIAL_VIDEO + ) { + product.value = "SpecialVideo"; + } + let client_version = ref(version); let server_version = ref("unknow"); let server_commit_hash = ref("unknow"); @@ -139,6 +159,7 @@ export default defineComponent({ server_branch_name, kernel_version, rootfs_version, + product, async showDialog() { click_count.value = 0; diff --git a/src/components/SystemSettingDialog.vue b/src/components/SystemSettingDialog.vue index bb2d3b9..76da32e 100644 --- a/src/components/SystemSettingDialog.vue +++ b/src/components/SystemSettingDialog.vue @@ -56,6 +56,7 @@ :disable="loading" /> diff --git a/src/components/WindowRectEditDialog.vue b/src/components/WindowRectEditDialog.vue index e33d527..fcd83d8 100644 --- a/src/components/WindowRectEditDialog.vue +++ b/src/components/WindowRectEditDialog.vue @@ -45,7 +45,7 @@ {{ $t("desktop width") }}: - {{ $store.state.device_screen_width }} + {{ screen_width }} {{ $t("px") }} @@ -54,7 +54,7 @@ {{ $t("desktop height") }}: - {{ $store.state.device_screen_height }} + {{ screen_height }} {{ $t("px") }} @@ -225,6 +225,7 @@ import { useStore } from "src/store"; import { useQuasar } from "quasar"; import { useI18n } from "vue-i18n"; import GlobalData from "src/common/GlobalData"; +import { SpecialVideoHelper } from "src/common/SpecialVideoHelper"; export default defineComponent({ name: "ComponentWindowRectEditDialog", @@ -237,6 +238,18 @@ export default defineComponent({ let show_dialog = ref(false); let loading = ref(false); + const screen_width = ref($store.state.device_screen_width); + const screen_height = ref($store.state.device_screen_height); + + if ($store.state.isSpecialVideo()) { + const screen_info = SpecialVideoHelper.getScreenInfo( + $store.state.wall_col, + $store.state.wall_row + ); + screen_width.value = screen_info.screen_width; + screen_height.value = screen_info.screen_height; + } + const window_rect = reactive({ x: 0, y: 0, @@ -276,6 +289,8 @@ export default defineComponent({ show_dialog, loading, window_rect, + screen_height, + screen_width, showDialog() { throw "please use showDialogAsync function"; @@ -283,6 +298,19 @@ export default defineComponent({ showDialogAsync(x: number, y: number, width: number, height: number) { return new Promise((resolve, reject) => { clean_promise(); + + screen_width.value = $store.state.device_screen_width; + screen_height.value = $store.state.device_screen_height; + + if ($store.state.isSpecialVideo()) { + const screen_info = SpecialVideoHelper.getScreenInfo( + $store.state.wall_col, + $store.state.wall_row + ); + screen_width.value = screen_info.screen_width; + screen_height.value = screen_info.screen_height; + } + window_rect.clean(); window_rect.x = Math.round(x); window_rect.y = Math.round(y); diff --git a/src/pages/TopToolBar.vue b/src/pages/TopToolBar.vue index 87f5e16..5647047 100644 --- a/src/pages/TopToolBar.vue +++ b/src/pages/TopToolBar.vue @@ -109,6 +109,7 @@ />