| 
					
				 | 
			
			
				@@ -8,6 +8,17 @@ import Empty from "../empty"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import LookModel from './model/look-model'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import JoinModel from './model/join-model'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import MessageModel from './model/message-model'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { state } from '/src/state' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const svg = ` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <path class="path" d=" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          M 30 15 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          L 28 17 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          M 25.61 25.61 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          A 15 15, 0, 0, 1, 15 30 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          A 15 15, 0, 1, 1, 27.99 7.5 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          L 15 15 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      ` 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 type itemType = 'message' | 'join' | 'look' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -20,52 +31,99 @@ export default defineComponent({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   data() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      lookList: [] as any[], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      messageList: [] as any[], // 回复学生列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      joinList: [] as any[], // 连麦学生列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      lookList: [] as any[], // 观看学生列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   mounted() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     event.on(LIVE_EVENT_MESSAGE["RC:Chatroom:Welcome"], this.onWelcome); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    event.on(LIVE_EVENT_MESSAGE["RC:TxtMsg"], this.onmessage); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    event.on(LIVE_EVENT_MESSAGE["RC:TxtMsg"], this.onMessage); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   methods: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    onmessage(val: any) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      console.log(val); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    onMessage(value: any) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (value && value.user) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log(state.user) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log(value) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const sendTime = dayjs(value.$EventMessage.sentTime || new Date()).format('HH:mm:ss') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let tempObj = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          name: value.user?.name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          id: value.user.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          isSelf: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          content: value.content, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          sendTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 判断是否是主播 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (value.user.id === state.user.id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          tempObj.isSelf = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.messageList.push(tempObj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log(this.messageList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     onWelcome(value: any) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       console.log(value) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      const sendTime = dayjs(value.$EventMessage.sentTime || new Date()).format('HH:mm:ss') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      let tempObj = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        name: value.user.name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        id: value.user.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sendTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (value && value.user) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const sendTime = dayjs(value.$EventMessage.sentTime || new Date()).format('HH:mm:ss') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let tempObj = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          name: value.user.name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          id: value.user.id, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          sendTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 判断是否有同一个人 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        let isExist = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.lookList.forEach((item: any) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (item.id === tempObj.id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            isExist = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!isExist) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.lookList.push(tempObj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.lookList.push(tempObj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   beforeUnmount() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     event.off(LIVE_EVENT_MESSAGE["RC:Chatroom:Welcome"], this.onmessage); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     event.off(LIVE_EVENT_MESSAGE["RC:TxtMsg"], this.onmessage); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  computed: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    loading() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      switch (this.type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        case 'message': 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          return this.messageList.length === 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        case 'join': 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          return this.joinList.length === 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        case 'look': 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          return this.lookList.length === 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        default: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          return false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   render() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { this.type === 'message' ? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          this.lookList && this.lookList.length > 0 ? this.lookList.map(item => ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <MessageModel /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          )) : <Empty text="暂无学员互动!" icon="noData-no-message" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        : null } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <div style={{ minHeight: '100%' }} v-loading={this.loading} element-loading-spinner={svg} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        element-loading-svg-view-box="-10, -10, 50, 50" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        element-loading-background="rgba(0, 0, 0, 0.8)"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        {this.type === 'message' ? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.messageList && this.messageList.length > 0 ? this.messageList.map(item => ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <MessageModel data={this.messageList} /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          )) : this.loading ? null : <Empty text="暂无学员互动!" icon="noData-no-message" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          : null} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { this.type === 'join' ? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          this.lookList && this.lookList.length > 0 ? this.lookList.map(item => ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <JoinModel /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          )) : <Empty text="暂无学员发起连麦!" icon="noData-no-join" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        : null } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        {this.type === 'join' ? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.joinList && this.joinList.length > 0 ? this.joinList.map(item => ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <JoinModel data={this.joinList} /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          )) : this.loading ? null : <Empty text="暂无学员发起连麦!" icon="noData-no-join" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          : null} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { this.type === 'look' ? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        {this.type === 'look' ? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           this.lookList && this.lookList.length > 0 ? this.lookList.map(item => ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <LookModel data={this.lookList} /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          )) : <Empty text="暂无学员观看!" icon="noData-no-user" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        : null } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          )) : this.loading ? null : <Empty text="暂无学员观看!" icon="noData-no-user" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          : null} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 |