up. ws update.
This commit is contained in:
parent
a4768d49b0
commit
8a6772daad
@ -76,6 +76,8 @@ class Worker extends Command
|
|||||||
'client_id' => $connection->clientId,
|
'client_id' => $connection->clientId,
|
||||||
'client_name'=> $connection->clientName
|
'client_name'=> $connection->clientName
|
||||||
])->update(['is_lock'=>1,'lock_password'=>$lock_password,'lock_time'=>date('Y-m-d H:i:s')]);
|
])->update(['is_lock'=>1,'lock_password'=>$lock_password,'lock_time'=>date('Y-m-d H:i:s')]);
|
||||||
|
// 锁定屏幕
|
||||||
|
$connection->send(json_encode(['event'=>'lock_client_screen_run']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,20 +10,19 @@
|
|||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
|
:fullscreen="true"
|
||||||
>
|
>
|
||||||
|
屏幕已锁定
|
||||||
</ele-modal>
|
</ele-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {computed, inject} from 'vue';
|
import { ref } from 'vue';
|
||||||
import {ConnectionStatus} from "@/plugins/webSocket_plugin";
|
import { WsEvent, wsEventManager } from '@/plugins/websocket';
|
||||||
import {useUserStore} from "@/store/modules/user";
|
|
||||||
const { connectionStatus } = <any>inject('websocket');
|
|
||||||
const userStore = useUserStore();
|
|
||||||
|
|
||||||
const visible = computed<boolean>(()=> {
|
const visible = ref(false);
|
||||||
return (connectionStatus.value != ConnectionStatus.CONNECTED && userStore.info)
|
|
||||||
});
|
|
||||||
|
|
||||||
|
wsEventManager.subscribe(WsEvent.LOCK_CLIENT_SCREEN, () => {
|
||||||
|
visible.value = true;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -43,5 +43,6 @@
|
|||||||
wsInstance.sendMessage(WsSendEventType.LOCK_CLIENT_SCREEN, {
|
wsInstance.sendMessage(WsSendEventType.LOCK_CLIENT_SCREEN, {
|
||||||
lockPassword: lockPassword.value
|
lockPassword: lockPassword.value
|
||||||
});
|
});
|
||||||
|
visible.value = false;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -45,8 +45,15 @@ export function createWsInstance(config: WsConfig): WsInstance {
|
|||||||
wsEventManager.emit(WsEvent.CONNECTED, e);
|
wsEventManager.emit(WsEvent.CONNECTED, e);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMessage = (e: MessageEvent) =>
|
const handleMessage = (e: MessageEvent) =>{
|
||||||
addMessage(e.data, WsMessageType.INCOMING);
|
addMessage(e.data, WsMessageType.INCOMING);
|
||||||
|
const jsonData = JSON.parse(e.data);
|
||||||
|
if (jsonData.event == WsEvent.LOCK_CLIENT_SCREEN) {
|
||||||
|
// 锁屏
|
||||||
|
wsEventManager.emit(WsEvent.LOCK_CLIENT_SCREEN, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const handleError = (e: Event) => {
|
const handleError = (e: Event) => {
|
||||||
isConnecting.value = false;
|
isConnecting.value = false;
|
||||||
|
|||||||
@ -2,7 +2,8 @@ import type { Ref } from 'vue';
|
|||||||
import { WsEventManager } from '@/plugins/websocket/core/event-manager';
|
import { WsEventManager } from '@/plugins/websocket/core/event-manager';
|
||||||
|
|
||||||
export enum WsEvent {
|
export enum WsEvent {
|
||||||
CONNECTED = 'CONNECTED'
|
CONNECTED = 'CONNECTED',
|
||||||
|
LOCK_CLIENT_SCREEN = 'LOCK_CLIENT_SCREEN'
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum WsSendEventType {
|
export enum WsSendEventType {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user