From 529f48641122af7c0aec185e4283d02e97aa0f89 Mon Sep 17 00:00:00 2001 From: shikeying <pxzsky@163.com> Date: 星期三, 19 四月 2023 14:40:51 +0800 Subject: [PATCH] 增加 websocket --- src/layout/index.vue | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/src/layout/index.vue b/src/layout/index.vue index 0a47150..c9032db 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -52,8 +52,37 @@ }, variables() { return variables; + }, + + // 2023-04-17锛屽畾涔夋帴鏀秝ebsocket娑堟伅 + getWsMsg (){ + // return this.$store.websocket.state.webSocketMsg; + return this.$store.state.user.webSocketMsg; } }, + // 2023-04-17 + watch: { + getWsMsg:{ + handler: function(newVal) { + // console.log(newVal) + // alert('鎺ユ敹鍒皐ebSocket鎺ㄩ��:'+ newVal); + this.$notify({ + title: '鏂版秷鎭彁閱掞細', //鏍囬 + // message: '杩欐槸涓�鏉′笉浼氳嚜鍔ㄥ叧闂殑娑堟伅', //鍐呭 + duration: 0, //璁剧疆寮规娑堝け浜嬩欢 + position:'bottom-right', // 璁剧疆寮规鍦ㄥ睆骞曠殑鍝釜瑙掑脊鍑猴紙鍙兘璁剧疆4涓锛� + type: 'info', //缁欐爣棰樺墠鍔犱竴涓皬鍥炬爣 + offset: 100, //鍋忕Щ閲忥細璺濈鍥涗釜瑙掔殑鍋忕Щ绋嬪害锛堥粯璁ゅ亸绉讳簡16px锛� + dangerouslyUseHTMLString: true, //鏄惁鏀寔寮瑰嚭妗嗗唴浼犲叆 HTML 鐗囨 + message: '<strong>杩欐槸 <i>HTML</i> 鐗囨</strong>' + newVal, //寮�鍚悗锛岃繖閲屽彲浠ュ啓html + showClose: true, //闅愯棌鍏抽棴鎸夐挳锛堝彸涓婅鐨剎 榛樿涓簍rue锛屾樉绀猴級 + onClose() {console.log('鍏抽棴鍟�', event)}, // 鎵嬪姩鍏抽棴鏃剁殑鍥炶皟鍑芥暟 + }); + this.$store.state.app.tts.speak("鏈夋柊娑堟伅鎻愰啋锛岃鐐瑰嚮鏌ョ湅"); + } + } + }, + methods: { handleClickOutside() { this.$store.dispatch('app/closeSideBar', { withoutAnimation: false }) -- Gitblit v1.9.1