|
|
@@ -30,6 +30,15 @@
|
|
|
@click="show = true"
|
|
|
>
|
|
|
<el-button icon="Search" circle color="#C1C4CB" />
|
|
|
+
|
|
|
+ <el-badge :value="2" :max="99" class="ml-20">
|
|
|
+ <el-button
|
|
|
+ icon="Bell"
|
|
|
+ circle
|
|
|
+ color="#C1C4CB"
|
|
|
+ @click="$router.push('/msg')"
|
|
|
+ />
|
|
|
+ </el-badge>
|
|
|
</div>
|
|
|
<div class="padding flex flex-align-center pointer">
|
|
|
<el-avatar
|
|
|
@@ -69,6 +78,7 @@ import { useStore } from '../store/user.js'
|
|
|
import permissionStore from '@/store/permission.js'
|
|
|
import search from './search/index.vue'
|
|
|
import config from '../config/website.js'
|
|
|
+import { ElNotification } from 'element-plus'
|
|
|
|
|
|
export default {
|
|
|
name: 'top',
|
|
|
@@ -154,6 +164,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
initWebSocket() {
|
|
|
+ console.log(333)
|
|
|
const wsuri = 'ws://192.168.31.83:8200/websocket/' + this.user.info.userId
|
|
|
this.websock = new WebSocket(wsuri)
|
|
|
this.websock.onmessage = this.websocketonmessage
|
|
|
@@ -168,11 +179,11 @@ export default {
|
|
|
// 开启心跳
|
|
|
this.start()
|
|
|
// 连接建立之后执行send方法发送数据
|
|
|
- const actions = {
|
|
|
- room: '007854ce7b93476487c7ca8826d17eba',
|
|
|
- info: '1121212'
|
|
|
- }
|
|
|
- this.websocketsend(JSON.stringify(actions))
|
|
|
+ // const actions = {
|
|
|
+ // room: '007854ce7b93476487c7ca8826d17eba',
|
|
|
+ // info: '1121212'
|
|
|
+ // }
|
|
|
+ // this.websocketsend(JSON.stringify(actions))
|
|
|
},
|
|
|
// 通信发生错误时触发
|
|
|
websocketonerror() {
|
|
|
@@ -182,6 +193,12 @@ export default {
|
|
|
// 客户端接收服务端数据时触发
|
|
|
websocketonmessage(e) {
|
|
|
console.log(e.data)
|
|
|
+ ElNotification({
|
|
|
+ title: 'Warning',
|
|
|
+ message: e.data,
|
|
|
+ type: 'success',
|
|
|
+ offset: 100
|
|
|
+ })
|
|
|
// 收到服务器信息,心跳重置
|
|
|
this.reset()
|
|
|
},
|