From 0ebd503ddac0ce84565243bb8783eac566d40e9b Mon Sep 17 00:00:00 2001 From: fangxiang Date: Fri, 14 Oct 2022 14:51:56 +0800 Subject: [PATCH] =?UTF-8?q?special=5Fvideo=20=E6=94=B9=E4=B8=BA=E8=87=AA?= =?UTF-8?q?=E7=94=B1=E8=AE=BE=E7=BD=AE=E5=AE=AB=E6=A0=BC=E8=A1=8C=E5=88=97?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=AA=97=E5=8F=A3=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AF=B9=E8=AF=9D=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SpecialVideoGridSettingDialog.vue | 133 +++++++++++------- src/components/Window.vue | 1 - src/i18n/en-US/index.ts | 2 + src/i18n/zh-CN/index.ts | 2 + src/pad/TopToolbar.vue | 1 - src/pages/TopToolBar.vue | 1 - 6 files changed, 87 insertions(+), 53 deletions(-) diff --git a/src/components/SpecialVideoGridSettingDialog.vue b/src/components/SpecialVideoGridSettingDialog.vue index 920619a..33497b6 100644 --- a/src/components/SpecialVideoGridSettingDialog.vue +++ b/src/components/SpecialVideoGridSettingDialog.vue @@ -44,9 +44,23 @@ + + + + + + @@ -109,31 +123,10 @@ export default defineComponent({ let show_dialog = ref(false); let loading = ref(false); - let layout = ref("1X3"); - - const row_values: number[] = []; - const col_values: number[] = []; - const select_options: string[] = []; - - // 生成布局选项 - { - const target_row_col_values = [3, 4, 5, 6]; - for (let i = 0; i < target_row_col_values.length; ++i) { - row_values.push(1); - col_values.push(target_row_col_values[i]); - select_options.push(row_values[i] + "X" + col_values[i]); - } - - for (let i = 0; i < target_row_col_values.length; ++i) { - row_values.push(target_row_col_values[i]); - col_values.push(1); - select_options.push( - row_values[target_row_col_values.length + i] + - "X" + - col_values[target_row_col_values.length + i] - ); - } - } + const wall_row = ref(1); + const wall_col = ref(4); + const has_error = ref(false); + const error_message = ref(""); const rotation_options = ref(["0", "90", "180", "270"]); const rotation = ref("0"); @@ -142,37 +135,79 @@ export default defineComponent({ GlobalData.getInstance()?.applicationConfig ?.special_video_layout_rotation ?? "0"; + const check_wall_col_row = ( + col: number, + row: number, + show_tooltip: boolean = true + ) => { + if (col * row > 9) { + if (show_tooltip) { + const message = + $t.t("row multiply column should be less than or equal to ") + + 9 + + "!"; + + $q.notify({ + type: "warning", + message: message, + position: "top", + timeout: 2000, + }); + has_error.value = true; + error_message.value = message; + } + return false; + } + return true; + }; + + watch( + () => wall_row.value, + (nv, ov) => { + if (check_wall_col_row(wall_col.value, nv, false)) { + if (has_error.value) { + has_error.value = false; + } + } + } + ); + + watch( + () => wall_col.value, + (nv, ov) => { + if (check_wall_col_row(nv, wall_row.value, false)) { + if (has_error.value) { + has_error.value = false; + } + } + } + ); + return { show_dialog, loading, - layout, - select_options, + wall_row, + wall_col, rotation_options, rotation, + has_error, + error_message, showDialog() { show_dialog.value = true; - let col = parseInt( + wall_col.value = parseInt( (GlobalData.getInstance().applicationConfig?.wall_col ?? 1).toString() ); - if (isNaN(col)) { - col = 1; + if (isNaN(wall_col.value)) { + wall_col.value = 1; } - let row = parseInt( + wall_row.value = parseInt( (GlobalData.getInstance().applicationConfig?.wall_row ?? 4).toString() ); - if (isNaN(row)) { - row = 4; - } - - layout.value = row + "X" + col; - const v = select_options.find( - (element) => element && element == layout.value - ); - if (!v) { - layout.value = "1X4"; + if (isNaN(wall_row.value)) { + wall_row.value = 4; } rotation.value = @@ -186,12 +221,10 @@ export default defineComponent({ async onSubmit() { loading.value = true; try { - const index = select_options.findIndex((e) => e && e == layout.value); - if (index != -1) { - // console.log(row_values[index] + "X" + col_values[index]); + if (check_wall_col_row(wall_col.value, wall_row.value)) { GlobalData.getInstance() .getCurrentClient() - ?.setWallRowCol(row_values[index], col_values[index]); + ?.setWallRowCol(wall_row.value, wall_col.value); switch (rotation.value) { case "0": case "90": @@ -207,9 +240,9 @@ export default defineComponent({ ?.setSpecialVideoLayoutRotation("0"); break; } - } - show_dialog.value = false; + show_dialog.value = false; + } } catch {} loading.value = false; }, diff --git a/src/components/Window.vue b/src/components/Window.vue index 46a3a47..4452e56 100644 --- a/src/components/Window.vue +++ b/src/components/Window.vue @@ -46,7 +46,6 @@ diff --git a/src/i18n/en-US/index.ts b/src/i18n/en-US/index.ts index b664815..33bae1e 100644 --- a/src/i18n/en-US/index.ts +++ b/src/i18n/en-US/index.ts @@ -373,4 +373,6 @@ export default { system: "System", "clean browser cache command send success": "Clean Browser Cache Command Send Success", + "row multiply column should be less than or equal to ": + "Row Multiply Column Should Be Less Than Or Equal To ", }; diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index 21b6fc6..658a360 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -645,4 +645,6 @@ export default { "clean browser cache": "清空浏览器缓存", system: "系统", "clean browser cache command send success": "清除浏览器缓存指令发送成功", + "row multiply column should be less than or equal to ": + "行乘以列的值不能大于", }; diff --git a/src/pad/TopToolbar.vue b/src/pad/TopToolbar.vue index bb09c0f..786ba8c 100644 --- a/src/pad/TopToolbar.vue +++ b/src/pad/TopToolbar.vue @@ -141,7 +141,6 @@ icon="img:pad/toolbar/edit_window_rect.png" :label="$t('toolbar edit window rect')" class="col-auto" - v-if="!$store.state.isSpecialVideo()" @click="editRect" /> diff --git a/src/pages/TopToolBar.vue b/src/pages/TopToolBar.vue index 105f8de..1074a12 100644 --- a/src/pages/TopToolBar.vue +++ b/src/pages/TopToolBar.vue @@ -183,7 +183,6 @@ stretch no-caps flat - v-if="!$store.state.isSpecialVideo()" stack :disable="plan_running || !$store.state.power_state" :icon="/*vertical_align_bottom*/ 'img:new_icon/edit_window_rect.png'"