|
@@ -33,13 +33,25 @@ export default defineComponent({
|
|
},
|
|
},
|
|
},
|
|
},
|
|
mounted() {
|
|
mounted() {
|
|
|
|
+ // userRoomType
|
|
|
|
+ // 1 普通
|
|
|
|
+ // 2 老师邀请
|
|
|
|
+ // 3 学生申请
|
|
|
|
+ // 4 连麦中
|
|
event.on(LIVE_EVENT_MESSAGE['RC:Chatroom:SeatApply'], this.onSeatApply);
|
|
event.on(LIVE_EVENT_MESSAGE['RC:Chatroom:SeatApply'], this.onSeatApply);
|
|
event.on(LIVE_EVENT_MESSAGE['RC:Chatroom:SeatResponse'], this.onSeatApply);
|
|
event.on(LIVE_EVENT_MESSAGE['RC:Chatroom:SeatResponse'], this.onSeatApply);
|
|
event.on(LIVE_EVENT_MESSAGE['RM:RTC:UserLeave'], this.onSeatApply);
|
|
event.on(LIVE_EVENT_MESSAGE['RM:RTC:UserLeave'], this.onSeatApply);
|
|
event.on(LIVE_EVENT_MESSAGE['RM:RTC:SwitchRole'], this.onSwitchRole);
|
|
event.on(LIVE_EVENT_MESSAGE['RM:RTC:SwitchRole'], this.onSwitchRole);
|
|
|
|
+ event.on(LIVE_EVENT_MESSAGE['RC:Chatroom:Leave'], this.onLeave);
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ onLeave(value: any) {
|
|
|
|
+ // console.log(value)
|
|
|
|
+ RuntimeModelUtils.removeJoin(value.userId)
|
|
|
|
+ RuntimeModelUtils.removeLook(value.userId)
|
|
|
|
+ },
|
|
onSeatApply(evt: any) {
|
|
onSeatApply(evt: any) {
|
|
|
|
+ console.log(evt, 'onSeatApply joinModel')
|
|
if (Array.isArray(evt)) {
|
|
if (Array.isArray(evt)) {
|
|
for (const id of evt) {
|
|
for (const id of evt) {
|
|
console.log('onSeatApply', id)
|
|
console.log('onSeatApply', id)
|
|
@@ -47,19 +59,31 @@ export default defineComponent({
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ const response = evt.$EventMessage.messageType === 'RC:Chatroom:SeatResponse'
|
|
|
|
+ const userRoomType = response ? 4 : 3
|
|
|
|
+ // if(evt.$EventMessage.messageType === 'RC:Chatroom:SeatResponse')
|
|
// 申请连麦
|
|
// 申请连麦
|
|
if (evt.type === 3) {
|
|
if (evt.type === 3) {
|
|
- RuntimeModelUtils.addJoin(evt.audienceId, {
|
|
|
|
|
|
+ const params = {
|
|
name: evt.audienceName,
|
|
name: evt.audienceName,
|
|
id: evt.audienceId,
|
|
id: evt.audienceId,
|
|
|
|
+ userRoomType: userRoomType,
|
|
type: evt.type,
|
|
type: evt.type,
|
|
- })
|
|
|
|
|
|
+ }
|
|
|
|
+ RuntimeModelUtils.addJoin(evt.audienceId, params)
|
|
|
|
+ RuntimeModelUtils.addLook(evt.audienceId, params)
|
|
}
|
|
}
|
|
// 取消连麦
|
|
// 取消连麦
|
|
if (evt.type === 4) {
|
|
if (evt.type === 4) {
|
|
|
|
+ console.log(evt, '取消连麦')
|
|
if (runtimeModel.joinList[evt.audienceId]) {
|
|
if (runtimeModel.joinList[evt.audienceId]) {
|
|
RuntimeModelUtils.removeJoin(evt.audienceId)
|
|
RuntimeModelUtils.removeJoin(evt.audienceId)
|
|
}
|
|
}
|
|
|
|
+ if (runtimeModel.lookList[evt.audienceId]) {
|
|
|
|
+ let userLook = runtimeModel.lookList[evt.audienceId]
|
|
|
|
+ userLook.userRoomType = 1
|
|
|
|
+ RuntimeModelUtils.addLook(evt.audienceId, userLook)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
agree(item: any) {
|
|
agree(item: any) {
|
|
@@ -72,9 +96,11 @@ export default defineComponent({
|
|
audienceId: item.id,
|
|
audienceId: item.id,
|
|
teacherId: state.user?.id,
|
|
teacherId: state.user?.id,
|
|
teacherName: state.user?.speakerName,
|
|
teacherName: state.user?.speakerName,
|
|
|
|
+ userRoomType: 4,
|
|
type: 1,
|
|
type: 1,
|
|
}
|
|
}
|
|
RuntimeModelUtils.addJoin(item.id, data)
|
|
RuntimeModelUtils.addJoin(item.id, data)
|
|
|
|
+ RuntimeModelUtils.addLook(item.id, data)
|
|
RuntimeUtils.sendMessage(data, 'SeatResponse')
|
|
RuntimeUtils.sendMessage(data, 'SeatResponse')
|
|
},
|
|
},
|
|
refuse(item: any) {
|
|
refuse(item: any) {
|
|
@@ -84,15 +110,22 @@ export default defineComponent({
|
|
audienceId: item.id,
|
|
audienceId: item.id,
|
|
teacherId: state.user?.id,
|
|
teacherId: state.user?.id,
|
|
teacherName: state.user?.speakerName,
|
|
teacherName: state.user?.speakerName,
|
|
|
|
+ userRoomType: 4,
|
|
type: 5,
|
|
type: 5,
|
|
}
|
|
}
|
|
RuntimeModelUtils.addJoin(item.id, data)
|
|
RuntimeModelUtils.addJoin(item.id, data)
|
|
RuntimeUtils.sendMessage(data, 'SeatApply')
|
|
RuntimeUtils.sendMessage(data, 'SeatApply')
|
|
},
|
|
},
|
|
onSwitchRole(evt: any) {
|
|
onSwitchRole(evt: any) {
|
|
|
|
+ console.log(evt, 'onSwitchRole')
|
|
if (runtimeModel.joinList[evt.userId] && evt.role === 2) {
|
|
if (runtimeModel.joinList[evt.userId] && evt.role === 2) {
|
|
RuntimeModelUtils.removeJoin(evt.userId)
|
|
RuntimeModelUtils.removeJoin(evt.userId)
|
|
}
|
|
}
|
|
|
|
+ if (runtimeModel.lookList[evt.userId] && evt.role === 2) {
|
|
|
|
+ let userLook = runtimeModel.lookList[evt.userId]
|
|
|
|
+ userLook.userRoomType = 1
|
|
|
|
+ RuntimeModelUtils.addLook(evt.userId, userLook)
|
|
|
|
+ }
|
|
}
|
|
}
|
|
},
|
|
},
|
|
render() {
|
|
render() {
|
|
@@ -105,9 +138,9 @@ export default defineComponent({
|
|
<div class={styles.itemName}>
|
|
<div class={styles.itemName}>
|
|
<p class={styles.userName}>
|
|
<p class={styles.userName}>
|
|
<span class={styles['name-style']}>{item.name}</span>
|
|
<span class={styles['name-style']}>{item.name}</span>
|
|
- {item.type === 3 ? <p style={{ paddingLeft: '10px' }}>申请连麦</p> : <p style={{ paddingLeft: '10px', color: 'var(--live-text-color)' }}>正在连麦</p>}
|
|
|
|
|
|
+ {item.userRoomType !== 4 ? <span style={{ paddingLeft: '10px' }}>申请连麦</span> : <span style={{ paddingLeft: '10px', color: 'var(--live-text-color)' }}>正在连麦</span>}
|
|
</p>
|
|
</p>
|
|
- {item.type === 3 ? (
|
|
|
|
|
|
+ {item.userRoomType !== 4 ? (
|
|
<div class={styles.joinText}>
|
|
<div class={styles.joinText}>
|
|
<div class={styles.join}>
|
|
<div class={styles.join}>
|
|
{/* 申请连麦 */}
|
|
{/* 申请连麦 */}
|