添加点击就置顶窗口的功能

添加查看设备时间信息的功能
This commit is contained in:
fangxiang 2022-02-15 19:08:08 +08:00
parent baddae8bba
commit 899690e180
8 changed files with 101 additions and 23 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "media_player_client", "name": "media_player_client",
"version": "1.2.2", "version": "1.2.3",
"description": "A Quasar Framework app", "description": "A Quasar Framework app",
"productName": "MediaPlayerClient", "productName": "MediaPlayerClient",
"author": "fangxiang <fangxiang@cloudview.work>", "author": "fangxiang <fangxiang@cloudview.work>",

View File

@ -734,6 +734,11 @@ export default class ClientConnection {
); );
} }
public async getSystemTimes() {
return await this.doRpc<Protocol.GetSystemTimesResponseEntity>(
new Protocol.GetSystemTimesRequestEntity(0)
);
}
public restartDevice(delay_ms?: number) { public restartDevice(delay_ms?: number) {
this.ws?.send( this.ws?.send(
JSON.stringify(new Protocol.RestartDeviceRequestEntity(delay_ms)) JSON.stringify(new Protocol.RestartDeviceRequestEntity(delay_ms))

View File

@ -402,9 +402,6 @@ export default class RemoteDataExangeProcesser {
} }
} }
break; break;
default:
console.log(notify.data);
break;
} }
} catch {} } catch {}
} }

View File

@ -290,6 +290,12 @@ export default defineComponent({
return signal_source.value.window_type == "EwindowType::Clock"; return signal_source.value.window_type == "EwindowType::Clock";
}); });
watch(
() => props.window,
(n, o) => {
reload_signal_source();
}
);
reload_signal_source(); reload_signal_source();
const flags = new _Flags(); const flags = new _Flags();
@ -317,6 +323,11 @@ export default defineComponent({
} }
if (!props.mouse_area_flag) { if (!props.mouse_area_flag) {
evt.stopPropagation(); evt.stopPropagation();
if (props.window.uuid != $store.state.selected_window) {
GlobalData.getInstance()
.getCurrentClient()
?.focusIn(props.window.window_id);
}
$store.commit("setSelectedWindow", props.window.uuid); $store.commit("setSelectedWindow", props.window.uuid);
} }
}, },

View File

@ -289,6 +289,10 @@ export namespace Protocol {
return Commands.PROTOCOL_PREFIX + "DesktopDisconnectNotify"; return Commands.PROTOCOL_PREFIX + "DesktopDisconnectNotify";
} }
public static get kRpcGetSystemTimes() {
return Commands.PROTOCOL_PREFIX + "RpcGetSystemTimes";
}
static _all_commands = new Set([ static _all_commands = new Set([
Commands.kUnKnowCommand, Commands.kUnKnowCommand,
Commands.kSearchDevice, Commands.kSearchDevice,
@ -359,6 +363,7 @@ export namespace Protocol {
Commands.kPollingStateChanged, Commands.kPollingStateChanged,
Commands.kDesktopResolutionChangedNotify, Commands.kDesktopResolutionChangedNotify,
Commands.kDesktopDisconnectNotify, Commands.kDesktopDisconnectNotify,
Commands.kRpcGetSystemTimes,
]); ]);
public static get AllCommands() { public static get AllCommands() {
@ -1677,4 +1682,27 @@ export namespace Protocol {
this.command = Commands.kDesktopDisconnectNotify; this.command = Commands.kDesktopDisconnectNotify;
} }
} }
export class GetSystemTimesRequestEntity extends PacketEntity {
timestamp = new Date().getMilliseconds();
constructor(rpcid?: number) {
super();
this.rpc_id = rpcid ?? 0;
this.command = Commands.kRpcGetSystemTimes;
}
}
export class GetSystemTimesResponseEntity extends PacketEntity {
system_run_time: number = 0;
system_idle_time: number = 0;
current_system_time: number = 0;
server_run_time: number = 0;
server_all_run_time: number = 0;
constructor() {
super();
this.command = Commands.kRpcGetSystemTimes;
}
}
} }

View File

@ -323,4 +323,10 @@ export default {
"are you sure about the update": "确定更新吗", "are you sure about the update": "确定更新吗",
"device info": "设备信息", "device info": "设备信息",
resolution: "分辨率", resolution: "分辨率",
"system run time": "系统运行时间",
"system idle time": "系统空闲时间",
"system idle rate": "系统空闲率",
"server run time": "服务运行时间",
"current server system time": "当前服务系统时间",
"server all run time": "服务总运行时间",
}; };

View File

@ -256,7 +256,7 @@ import { Protocol } from "src/entities/WSProtocol";
import GlobalData from "src/common/GlobalData"; import GlobalData from "src/common/GlobalData";
import { api } from "boot/axios"; import { api } from "boot/axios";
import { HttpProtocol } from "src/entities/HttpProtocol"; import { HttpProtocol } from "src/entities/HttpProtocol";
import { SessionStorage, openURL, useQuasar } from "quasar"; import { SessionStorage, openURL, useQuasar, date as $date } from "quasar";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { NotifyMessage } from "src/common/ClientConnection"; import { NotifyMessage } from "src/common/ClientConnection";
@ -281,6 +281,12 @@ export default defineComponent({
let show_advanced_menu = ref(true); let show_advanced_menu = ref(true);
let system_run_time = 0;
let system_idle_time = 0;
let current_system_time = 0;
let server_run_time = 0;
let server_all_run_time = 0;
const plan_running = computed( const plan_running = computed(
() => $store.state.current_running_plan.trim() != "" () => $store.state.current_running_plan.trim() != ""
); );
@ -363,17 +369,42 @@ export default defineComponent({
SessionStorage.clear(); SessionStorage.clear();
window.location.reload(); window.location.reload();
}, },
showDeviceInfo() { async showDeviceInfo() {
try {
const response = await GlobalData.getInstance()
.getCurrentClient()
?.getSystemTimes();
if (response) {
system_run_time = response.system_run_time;
system_idle_time = response.system_idle_time;
current_system_time = response.current_system_time;
server_run_time = response.server_run_time;
server_all_run_time = response.server_all_run_time;
}
} catch (e) {
console.log(e);
}
$q.dialog({ $q.dialog({
title: $t.t("device info"), html: true,
message: title: "<div class='text-h4'>" + $t.t("device info") + "</div>",
$t.t("resolution") + message: `<div class="text-h6">
": " + ${$t.t("device resolution")} : ${$store.state.device_screen_width}X${
$store.state.device_screen_width + $store.state.device_screen_height
"X" + }@${$store.state.device_screen_refresh_rate}<br />
$store.state.device_screen_height + ${$t.t("system run time")} : ${system_run_time} ${$t.t("s")} <br />
"@" + ${$t.t("system idle rate")} : ${(
$store.state.device_screen_refresh_rate, system_idle_time /
(system_run_time * 4)
).toFixed(2)} % <br />
${$t.t("current server system time")} : ${$date.formatDate(
new Date(current_system_time),
"YYYY-MM-DD HH:mm:ss"
)}<br />
${$t.t("server run time")} : ${server_run_time} ${$t.t("s")} <br />
${$t.t("server all run time")} : ${server_all_run_time} ${$t.t(
"s"
)} <br />
</div>`,
}); });
}, },
}; };

View File

@ -10,17 +10,17 @@
> >
<div id="windows" style="position: absolute"> <div id="windows" style="position: absolute">
<vue3-resize-drag <vue3-resize-drag
:w="item.width * $refs.wall.clientWidth" :w="item.width * ($refs.wall?.clientWidth ?? 0)"
:h="item.height * $refs.wall.clientHeight" :h="item.height * ($refs.wall?.clientHeight ?? 0)"
:x=" :x="
($refs.wall.parentElement?.offsetLeft ?? 0) + ($refs.wall?.parentElement?.offsetLeft ?? 0) +
$refs.wall.offsetLeft + ($refs.wall?.offsetLeft ?? 0) +
item.x * $refs.wall.clientWidth item.x * ($refs.wall?.clientWidth ?? 0)
" "
:y=" :y="
($refs.wall.parentElement?.offsetTop ?? 0) + ($refs.wall?.parentElement?.offsetTop ?? 0) +
$refs.wall.offsetTop + ($refs.wall?.offsetTop ?? 0) +
item.y * $refs.wall.clientHeight item.y * ($refs.wall?.clientHeight ?? 0)
" "
:zIndex=" :zIndex="
$store.state.windows_sort.findIndex((element) => element == item.uuid) $store.state.windows_sort.findIndex((element) => element == item.uuid)