| 
					
				 | 
			
			
				@@ -4,6 +4,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  import {parseJsonStr} from '@/utils/common' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     name: 'msg', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     data () { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -14,8 +15,13 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     computed: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 监听消息变化 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       listenWebsocket () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return this.$store.state.websocket.message 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      // 监听已读消息数量变化 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      listenCnt () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return this.$store.state.common.msgCollection.length 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     watch: { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -24,11 +30,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         const h = this.$createElement 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let newMsgCollections = JSON.parse(data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        console.log('newMsgCollections = ' + JSON.stringify(newMsgCollections)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let newMsgCollections = parseJsonStr(data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // console.log('newMsgCollections = ' + JSON.stringify(newMsgCollections)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (newMsgCollections) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           this.updateMsgCollections(newMsgCollections) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          this.$emit('noticeAdded', this.$store.state.common.msgCollection.length) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           if (newMsgCollections.length <= 5) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             newMsgCollections.forEach((item) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				               this.$notify({ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -42,62 +47,11 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // 刷新消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        this.$store.dispatch('websocket/WEBSOCKET_SEND', 'refreshMessage') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // const newmsg = JSON.parse(newstr) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // if (newstr && newstr.indexOf('[') === -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   // 收到信消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   this.$notification.open({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //     message: newmsg.objName, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //     description: newmsg.title 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // // 刷新消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      // this.$store.dispatch('websocket/WEBSOCKET_SEND', 'refreshMessage') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   this.noticeData = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   this.messageData = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   this.msgCount = newmsg.length 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   for (var i = 0; i < newmsg.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //     var m = newmsg[i] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //     m.createDate = m.objName + ' · ' + this.nowTimeAgo(m.createDate) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //     if (m.messageType.indexOf('Notice') !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //       this.noticeData.push(m) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //     if (m.messageType.indexOf('Message') !== -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //       this.messageData.push(m) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  //   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      listenCnt: function (cnt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.$emit('noticeAdded', cnt) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // mounted () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   const that = this 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   const h = this.$createElement 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   this.$nextTick(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //     this.$store.state.websocket.webSocket.onmessage = async function (event) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //       if (!event || !event.data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //         return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //       let json = JSON.parse(event.data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //       console.log('json = ' + JSON.stringify(json)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //       if (json) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //         that.$emit('noticeAdded', json.length) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //         json.forEach((item) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //           that.$notify({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //             title: item.title, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //             // dangerouslyUseHTMLString: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //             // message: h('i', {style: 'color: teal'}, item.content), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //             message: h('div', {}, [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //               h('p', {}, '消息类别:' + that.getMsgType(item.type)), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //               h('p', {}, '消息内容:' + item.content) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //             ]), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //             duration: 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //           }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    //   }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     methods: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       getMsgType (type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!type) return '未知消息类型' 
			 |