up. ws update.
This commit is contained in:
parent
9419f2cf51
commit
b14fcbf06d
@ -67,6 +67,14 @@ class Worker extends Command
|
||||
$connection->clientVersion = $clientVersion;
|
||||
// 绑定成功通知
|
||||
$connection->send(json_encode(['event'=>'BIND_USER_SUCCESS','userId'=>$auth->userId]));
|
||||
$client = SysUserClient::where([
|
||||
'client_id' => $connection->clientId,
|
||||
'client_name'=> $connection->clientName
|
||||
])->find();
|
||||
if($client && $client['is_lock']) {
|
||||
// 锁定屏幕
|
||||
$connection->send(json_encode(['event'=>'LOCK_CLIENT_SCREEN']));
|
||||
}
|
||||
}
|
||||
if ($messageJson['event'] == 'lock_client_screen') {
|
||||
if($connection->userId) {
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
<router-view />
|
||||
</ele-app>
|
||||
<websocket-state />
|
||||
<lock-screen-state />
|
||||
</ele-config-provider>
|
||||
</el-config-provider>
|
||||
</template>
|
||||
@ -20,6 +21,7 @@
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { useLocale } from '@/i18n/use-locale';
|
||||
import WebsocketState from '@/components/WebsocketState/index.vue';
|
||||
import LockScreenState from '@/components/LockScreenState/index.vue';
|
||||
|
||||
/** 组件全局配置 */
|
||||
const { tableConfig } = useGlobalConfig();
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
const visible = ref(false);
|
||||
|
||||
wsEventManager.subscribe(WsEvent.LOCK_CLIENT_SCREEN, () => {
|
||||
console.log("LOCK_CLIENT_SCREEN->")
|
||||
visible.value = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -26,7 +26,7 @@ export class WsEventManagerImpl implements WsEventManager {
|
||||
remove: () => this.unsubscribe(event, listenerId)
|
||||
});
|
||||
}
|
||||
|
||||
console.log("添加事件去了", event)
|
||||
return {
|
||||
id: listenerId,
|
||||
remove: () => this.unsubscribe(event, listenerId)
|
||||
@ -41,7 +41,7 @@ export class WsEventManagerImpl implements WsEventManager {
|
||||
emit(event: WsEvent, data?: any): void {
|
||||
console.debug(`[WS Event] Emitting: ${event}`);
|
||||
const listeners = this.listeners[event] || [];
|
||||
|
||||
console.log("事件lieb", listeners)
|
||||
// 安全遍历
|
||||
listeners.forEach((listener) => {
|
||||
const context: WsEventContext = {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user