修复数据修改提示重启不出现的BUG

This commit is contained in:
fangxiang 2021-12-22 14:09:59 +08:00
parent f908813a49
commit 6e29a5350c
8 changed files with 52 additions and 14 deletions

View File

@ -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";

View File

@ -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() {

View File

@ -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,
});
}
};

View File

@ -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;
};

View File

@ -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;
},

View File

@ -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());
}
}
}

View File

@ -265,4 +265,7 @@ export default {
"重要图形参数已更改,需要重启后生效,是否重启",
"output audio card": "输出声卡",
muted: "静音",
"the system will reboot after the setup is complete":
"系统将在设置完成后重启",
"restart command send": "重启指令发送",
};

View File

@ -230,7 +230,7 @@ export default defineComponent({
type: "warning",
message: $t.t("data export ") + $t.t("fail") + "!",
position: "top",
timeout: 1000,
timeout: 1500,
});
}
}