diff --git a/src/boot/axios.ts b/src/boot/axios.ts index 4c08488..5d2e9c2 100644 --- a/src/boot/axios.ts +++ b/src/boot/axios.ts @@ -15,7 +15,7 @@ declare module "@vue/runtime-core" { // for each client) const api = axios.create({ baseURL: "https://" + window.location.hostname, - timeout: 10000, + timeout: 15000, }); api.defaults.headers.common["X-Product-Name"] = "RK_3568"; diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index c60b50c..ff9dcab 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -627,8 +627,10 @@ export default class ClientConnection { } } - public restartDevice() { - this.ws?.send(JSON.stringify(new Protocol.RestartDeviceRequestEntity())); + public restartDevice(delay_ms?: number) { + this.ws?.send( + JSON.stringify(new Protocol.RestartDeviceRequestEntity(delay_ms)) + ); } public destory() { diff --git a/src/components/SignalSourceGroupDialog.vue b/src/components/SignalSourceGroupDialog.vue index fe4fd70..d040eeb 100644 --- a/src/components/SignalSourceGroupDialog.vue +++ b/src/components/SignalSourceGroupDialog.vue @@ -194,7 +194,7 @@ export default defineComponent({ (response.success ? $t.t("success") : $t.t("fail")) + "!", position: "top", - timeout: 1000, + timeout: 1500, }); } }; @@ -212,7 +212,7 @@ export default defineComponent({ (response.success ? $t.t("success") : $t.t("fail")) + "!", position: "top", - timeout: 1000, + timeout: 1500, }); } }; diff --git a/src/components/SystemSettingDialog.vue b/src/components/SystemSettingDialog.vue index 656093d..5e44853 100644 --- a/src/components/SystemSettingDialog.vue +++ b/src/components/SystemSettingDialog.vue @@ -876,6 +876,7 @@ export default defineComponent({ ); device_resolution.value = val ?? device_resolution_options.value[0]; + old_resolution = device_resolution.value; } } }, 1); @@ -885,8 +886,6 @@ export default defineComponent({ hue.value = parseInt(config.graphics_hue.toString()); device_rotate.value = parseInt(config.device_rotate.toString()); - - old_resolution = device_resolution.value; old_rotate = device_rotate.value; } }; @@ -946,6 +945,14 @@ export default defineComponent({ refresh_output_board(); }; + const wait_for = async (delay_ms: number) => { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(null); + }, delay_ms); + }); + }; + const applyNetwork = async () => { loading.value = true; const request = new Protocol.SetSystemNetworkRequestEntity(); @@ -989,6 +996,7 @@ export default defineComponent({ }); loading.value = false; }; + const applyGraphics = async () => { loading.value = true; const request = new Protocol.SetSystemGraphicsRequestEntity(); @@ -1004,6 +1012,7 @@ export default defineComponent({ await GlobalData.getInstance() .getCurrentClient() ?.setSystemGraphics(request); + await wait_for(1000 * 3); success = true; } catch {} $q.notify({ @@ -1029,11 +1038,27 @@ export default defineComponent({ ) + "?", cancel: true, persistent: true, - }).onOk(() => { - GlobalData.getInstance().getCurrentClient()?.restartDevice(); + }).onOk(async () => { + await GlobalData.getInstance() + .getCurrentClient() + ?.restartDevice(1000 * 3); + $q.notify({ + color: "positive", + icon: "done", + message: + $t.t("restart command send") + + $t.t("success") + + "!" + + $t.t("the system will reboot after the setup is complete") + + "!", + position: "top", + timeout: 2500, + }); }); } catch {} } + old_resolution = device_resolution.value; + old_rotate = device_rotate.value; loading.value = false; }; diff --git a/src/components/UpgradeDialog.vue b/src/components/UpgradeDialog.vue index 0092f6c..a4fd783 100644 --- a/src/components/UpgradeDialog.vue +++ b/src/components/UpgradeDialog.vue @@ -235,18 +235,18 @@ export default defineComponent({ "the system automatically restarts after the upgrade is complete" ), position: "top", - timeout: 1000, + timeout: 1500, }); setTimeout(() => { window.location.reload(); - }, 1500); + }, 2000); }, onFailed(info: any) { $q.notify({ type: "warning", message: $t.t("update file upload") + $t.t("fail") + "!", position: "top", - timeout: 1000, + timeout: 1500, }); loading.value = false; }, diff --git a/src/entities/WSProtocol.ts b/src/entities/WSProtocol.ts index 86d75c1..1720b82 100644 --- a/src/entities/WSProtocol.ts +++ b/src/entities/WSProtocol.ts @@ -1075,12 +1075,20 @@ export namespace Protocol { export class RestartDeviceRequestEntity extends Protocol.PacketEntity { timestamp: number; - constructor() { + delay_ms: number = 0; + constructor(delay_ms?: number) { super(); this.timestamp = new Date().getUTCMilliseconds(); this.command = Protocol.Commands.kRestartDeviceCommand; this.flag = Protocol.PacketEntity.FLAG_REQUEST; this.rpc_id = 0; + if ( + delay_ms != null && + delay_ms != undefined && + !isNaN(parseInt(delay_ms.toString())) + ) { + this.delay_ms = parseInt(delay_ms.toString()); + } } } diff --git a/src/i18n/zh-CN/index.ts b/src/i18n/zh-CN/index.ts index f9bce8a..0c50024 100644 --- a/src/i18n/zh-CN/index.ts +++ b/src/i18n/zh-CN/index.ts @@ -265,4 +265,7 @@ export default { "重要图形参数已更改,需要重启后生效,是否重启", "output audio card": "输出声卡", muted: "静音", + "the system will reboot after the setup is complete": + "系统将在设置完成后重启", + "restart command send": "重启指令发送", }; diff --git a/src/pages/TopToolBar.vue b/src/pages/TopToolBar.vue index 24fb629..9217246 100644 --- a/src/pages/TopToolBar.vue +++ b/src/pages/TopToolBar.vue @@ -230,7 +230,7 @@ export default defineComponent({ type: "warning", message: $t.t("data export ") + $t.t("fail") + "!", position: "top", - timeout: 1000, + timeout: 1500, }); } }