待机时显示提示。不发送窗口相关消息。
This commit is contained in:
parent
3c193859c7
commit
e03bb2515b
|
@ -1074,6 +1074,16 @@ export default class ClientConnection {
|
|||
}
|
||||
}
|
||||
|
||||
public async getPowerState() {
|
||||
try {
|
||||
return await this.doRpc<Protocol.GetPowerStateResponseEntity>(
|
||||
new Protocol.GetPowerStateRequestEntity()
|
||||
);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public destory() {
|
||||
if (this.ws) {
|
||||
this.ws.onclose = null;
|
||||
|
|
|
@ -165,6 +165,9 @@ export default class Initializer {
|
|||
}
|
||||
|
||||
async initialize() {
|
||||
const options = this.options;
|
||||
const $store = options.$store;
|
||||
|
||||
const global_data = GlobalData.getInstance();
|
||||
let client = global_data.getCurrentClient();
|
||||
if (client) {
|
||||
|
@ -172,18 +175,28 @@ export default class Initializer {
|
|||
await Common.waitFor(100);
|
||||
}
|
||||
|
||||
await this.getApplicationConfig();
|
||||
|
||||
// get device attribute
|
||||
{
|
||||
await this.getApplicationConfig();
|
||||
GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.getDeviceAttribute()
|
||||
.then((response) => {
|
||||
if (response && typeof response.attribute != "undefined") {
|
||||
this.options.$store.commit(
|
||||
"setDeviceAttribute",
|
||||
response.attribute
|
||||
);
|
||||
$store.commit("setDeviceAttribute", response.attribute);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// get power state
|
||||
{
|
||||
GlobalData.getInstance()
|
||||
.getCurrentClient()
|
||||
?.getPowerState()
|
||||
.then((response) => {
|
||||
if (response) {
|
||||
$store.commit("setPowerState", response.is_power_on);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -48,12 +48,21 @@ export default class RemoteDataExangeProcesser {
|
|||
if (temp) {
|
||||
let global_data = GlobalData.getInstance();
|
||||
if (global_data && global_data.applicationConfig) {
|
||||
if (temp.key == "registered") {
|
||||
switch (temp.key) {
|
||||
case "power_state":
|
||||
$store.commit("setPowerState", temp.value == "on");
|
||||
break;
|
||||
case "registered":
|
||||
{
|
||||
global_data.applicationConfig.registered = JSON.parse(
|
||||
temp.value
|
||||
);
|
||||
} else {
|
||||
(<any>global_data.applicationConfig)[temp.key] = temp.value;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
(<any>global_data.applicationConfig)[temp.key] =
|
||||
temp.value;
|
||||
$store.commit(
|
||||
"setWallCol",
|
||||
global_data.applicationConfig.wall_col
|
||||
|
@ -67,6 +76,8 @@ export default class RemoteDataExangeProcesser {
|
|||
global_data.applicationConfig.power_on_plan
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
clickable
|
||||
@dblclick="
|
||||
(evt) => {
|
||||
if (!$store.state.power_state) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
$store.state.current_running_plan.trim() == '' &&
|
||||
!prop.node.is_group
|
||||
|
|
|
@ -248,6 +248,9 @@ export default defineComponent({
|
|||
});
|
||||
},
|
||||
runPlan(item: PlanEntity) {
|
||||
if (!$store.state.power_state) {
|
||||
return;
|
||||
}
|
||||
GlobalData.getInstance().getCurrentClient()?.runPlan(item.uuid);
|
||||
$q.notify({
|
||||
color: "positive",
|
||||
|
|
|
@ -428,6 +428,10 @@ export namespace Protocol {
|
|||
return Commands.PROTOCOL_PREFIX + "RpcGetCityList";
|
||||
}
|
||||
|
||||
public static get kRpcGetPowerState() {
|
||||
return Commands.PROTOCOL_PREFIX + "RpcGetPowerState";
|
||||
}
|
||||
|
||||
static _all_commands = new Set([
|
||||
Commands.kUnKnowCommand,
|
||||
Commands.kSearchDevice,
|
||||
|
@ -534,6 +538,7 @@ export namespace Protocol {
|
|||
Commands.kRpcGetSystemNetworkInfo,
|
||||
Commands.kRpcSetHdmiInDecodeType,
|
||||
Commands.kRpcGetCityList,
|
||||
Commands.kRpcGetPowerState,
|
||||
]);
|
||||
public static get AllCommands() {
|
||||
return this._all_commands;
|
||||
|
@ -2719,4 +2724,23 @@ export namespace Protocol {
|
|||
|
||||
city_list = [];
|
||||
}
|
||||
|
||||
export class GetPowerStateRequestEntity extends PacketEntity {
|
||||
constructor(rpc_id = 0) {
|
||||
super();
|
||||
super.command = Commands.kRpcGetPowerState;
|
||||
super.flag = PacketEntity.FLAG_REQUEST;
|
||||
super.rpc_id = rpc_id;
|
||||
}
|
||||
timestamp = Date.now();
|
||||
}
|
||||
|
||||
export class GetPowerStateResponseEntity extends PacketEntity {
|
||||
constructor() {
|
||||
super();
|
||||
super.flag = PacketEntity.FLAG_RESPONSE;
|
||||
}
|
||||
|
||||
is_power_on = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -545,4 +545,5 @@ export default {
|
|||
city_area: "区",
|
||||
location: "位置",
|
||||
city_city_area: "市区",
|
||||
"device standby mode": "设备已休眠",
|
||||
};
|
||||
|
|
|
@ -3,6 +3,15 @@
|
|||
ref="wall"
|
||||
class="fit bg-white q-py-md q-mx-sm row items-center justify-evenly wall"
|
||||
>
|
||||
<div
|
||||
v-if="!$store.state.power_state"
|
||||
style="position: absolute"
|
||||
class="full-width text-center"
|
||||
>
|
||||
<span class="text-h5" style="z-index: 999; background: white">
|
||||
{{ $t("device standby mode") }}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
ref="wall_content"
|
||||
:style="{
|
||||
|
@ -67,6 +76,7 @@
|
|||
</vue3-resize-drag>
|
||||
</div>
|
||||
<div
|
||||
v-show="$store.state.power_state"
|
||||
ref="wall_grids"
|
||||
@touchstart="$store.commit('setSelectedWindow', '')"
|
||||
>
|
||||
|
@ -805,6 +815,9 @@ export default defineComponent({
|
|||
EventBus.getInstance().on(
|
||||
EventNamesDefine.DropToWall,
|
||||
(evt: _IDropToWall) => {
|
||||
if (!$store.state.power_state) {
|
||||
return;
|
||||
}
|
||||
if (evt && evt.data) {
|
||||
switch (evt.type) {
|
||||
case "signal_source":
|
||||
|
|
|
@ -8,6 +8,15 @@
|
|||
@drop="onDrop"
|
||||
style="background-color: #bce0f0"
|
||||
>
|
||||
<div
|
||||
v-if="!$store.state.power_state"
|
||||
style="position: absolute; top: -15%"
|
||||
class="full-width text-center"
|
||||
>
|
||||
<span class="text-h5">
|
||||
{{ $t("device standby mode") }}
|
||||
</span>
|
||||
</div>
|
||||
<div id="windows" style="position: absolute">
|
||||
<vue3-resize-drag
|
||||
:w="item.width * ($refs.wall?.clientWidth ?? 0)"
|
||||
|
@ -94,7 +103,7 @@
|
|||
>
|
||||
<q-list>
|
||||
<q-item
|
||||
:disable="plan_running"
|
||||
:disable="plan_running || !$store.state.power_state"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="openWindowByLocalFile($event)"
|
||||
|
@ -105,7 +114,7 @@
|
|||
<q-item-section> {{ $t("open window") }} </q-item-section>
|
||||
</q-item>
|
||||
<q-item
|
||||
:disable="plan_running"
|
||||
:disable="plan_running || !$store.state.power_state"
|
||||
clickable
|
||||
v-close-popup
|
||||
@click="closeAllWindows"
|
||||
|
@ -922,7 +931,7 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
onDragOver(e: DragEvent) {
|
||||
if (!plan_running.value) {
|
||||
if (!plan_running.value && $store.state.power_state) {
|
||||
e.preventDefault();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -62,6 +62,7 @@ export interface StateInterface {
|
|||
signal_sources: SignalSourceEntity[];
|
||||
landspace: boolean;
|
||||
device_attribute: number;
|
||||
power_state: boolean;
|
||||
}
|
||||
|
||||
// provide typings for `this.$store`
|
||||
|
@ -310,6 +311,7 @@ export default store(function (/* { ssrContext } */) {
|
|||
signal_sources: [],
|
||||
landspace: window.innerWidth > window.innerHeight,
|
||||
device_attribute: 0,
|
||||
power_state: false,
|
||||
},
|
||||
|
||||
mutations: {
|
||||
|
@ -321,6 +323,9 @@ export default store(function (/* { ssrContext } */) {
|
|||
state.landspace = playload;
|
||||
}
|
||||
},
|
||||
setPowerState(state: StateInterface, playload: boolean) {
|
||||
state.power_state = playload;
|
||||
},
|
||||
setDeviceAttribute(state: StateInterface, playload?: any) {
|
||||
const num = parseInt(playload);
|
||||
if (!isNaN(num) && num >= 0) {
|
||||
|
|
Loading…
Reference in New Issue