From e5ef89c939d4f4ae31614bd06262c152b75637ea Mon Sep 17 00:00:00 2001 From: fangxiang Date: Tue, 10 Aug 2021 11:22:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Ddiv=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=E7=AA=97=E5=8F=A3=E4=B8=8D=E7=BC=A9?= =?UTF-8?q?=E6=94=BE=E7=9A=84=E9=97=AE=E9=A2=98=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BF=A1=E5=8F=B7=E6=BA=90=E7=BB=84=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 + src/common/ClientConnection.ts | 36 +++-- src/common/EventBus.ts | 1 + src/components/GroupDialog.vue | 214 ++++++++++++++++++++++++++ src/components/SignalSourceDialog.vue | 18 +++ src/components/Window.vue | 35 ++++- src/css/app.scss | 4 + src/entities/WSProtocol.ts | 27 ++++ src/i18n/zh-CN/index.ts | 16 ++ src/layouts/MainLayout.vue | 6 +- src/pages/LeftToolBar.vue | 88 ++++++----- src/pages/Login.vue | 1 - src/pages/WallPage.vue | 26 ++-- yarn.lock | 17 ++ 14 files changed, 420 insertions(+), 71 deletions(-) create mode 100644 src/components/GroupDialog.vue create mode 100644 src/components/SignalSourceDialog.vue diff --git a/package.json b/package.json index 26c328c..8028276 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,10 @@ }, "dependencies": { "@quasar/extras": "^1.0.0", + "@types/element-resize-detector": "^1.1.3", "axios": "^0.21.1", "core-js": "^3.6.5", + "element-resize-detector": "^1.2.3", "quasar": "^2.0.0", "vue-i18n": "^9.0.0-beta.0", "vuex": "^4.0.1" diff --git a/src/common/ClientConnection.ts b/src/common/ClientConnection.ts index 8ae5169..c4046d0 100644 --- a/src/common/ClientConnection.ts +++ b/src/common/ClientConnection.ts @@ -191,8 +191,8 @@ export default class ClientConnection { } } - public async doRpc<_RequestType extends Protocol.PacketEntity, _ResponseType>( - RequestType: new () => _RequestType + public async doRpc<_ResponseType>( + request: Protocol.PacketEntity ): Promise<_ResponseType | null> { return new Promise((resolve, reject) => { const rpc_id = ++this._rpc_id_counter; @@ -203,7 +203,6 @@ export default class ClientConnection { this.rpc_map.delete(rpc_id); } } - let request: _RequestType = new RequestType(); request.rpc_id = rpc_id; this.ws?.send(JSON.stringify(request)); this.rpc_map.set( @@ -230,10 +229,9 @@ export default class ClientConnection { public async getSignalSources() { try { - return await this.doRpc< - Protocol.GetSignalSourcesRequest, - Protocol.GetSignalSourcesResponse - >(Protocol.GetSignalSourcesRequest); + return await this.doRpc( + new Protocol.GetSignalSourcesRequest() + ); } catch (e) { console.error(e); } @@ -241,10 +239,9 @@ export default class ClientConnection { public async getApplicationSettins() { try { - return await this.doRpc< - Protocol.GetApplicationConfigRequestEntity, - Protocol.GetApplicationConfigResponseEntity - >(Protocol.GetApplicationConfigRequestEntity); + return await this.doRpc( + new Protocol.GetApplicationConfigRequestEntity() + ); } catch (e) { console.error(e); } @@ -252,10 +249,9 @@ export default class ClientConnection { public async getWindows() { try { - return await this.doRpc< - Protocol.GetWindowsRequestEntity, - Protocol.GetWindowsResponseEntity - >(Protocol.GetWindowsRequestEntity); + return await this.doRpc( + new Protocol.GetWindowsRequestEntity() + ); } catch (e) { console.error(e); } @@ -296,6 +292,16 @@ export default class ClientConnection { ); } + public async addSignalSourceGroup(parent_uuid: string, name: string) { + try { + return await this.doRpc( + new Protocol.AddSignalSourcesGroupRequestEntity(0, parent_uuid, name) + ); + } catch (e) { + console.error(e); + } + } + private _destoryed = false; public destory() { this._destoryed = true; diff --git a/src/common/EventBus.ts b/src/common/EventBus.ts index 90668a2..7538a1c 100644 --- a/src/common/EventBus.ts +++ b/src/common/EventBus.ts @@ -18,6 +18,7 @@ export default class EventBus extends EventEmitter { export namespace EventNamesDefine { export const UnSelectAllWindows = "onUnSelectAllWindows"; + export const UnFocusAllWindows = "onUnFocusAllWindows"; export const WindowResize = "onWindowResize"; export const ResponseMessage = "onResponseData"; export const WebSocketClose = "onWebSocketClose"; diff --git a/src/components/GroupDialog.vue b/src/components/GroupDialog.vue new file mode 100644 index 0000000..0155137 --- /dev/null +++ b/src/components/GroupDialog.vue @@ -0,0 +1,214 @@ + + + + + diff --git a/src/components/SignalSourceDialog.vue b/src/components/SignalSourceDialog.vue new file mode 100644 index 0000000..4f78966 --- /dev/null +++ b/src/components/SignalSourceDialog.vue @@ -0,0 +1,18 @@ + + + diff --git a/src/components/Window.vue b/src/components/Window.vue index b03f9ff..45d5e39 100644 --- a/src/components/Window.vue +++ b/src/components/Window.vue @@ -1,7 +1,11 @@ +