|
|
@@ -38,10 +38,15 @@ export default defineComponent({
|
|
|
await this._init()
|
|
|
this.loadingLook = true
|
|
|
event.on(LIVE_EVENT_MESSAGE["RC:Chatroom:Welcome"], this.onWelcome);
|
|
|
+ event.on(LIVE_EVENT_MESSAGE["RC:Chatroom:MemberCount"], this.onMemberCount);
|
|
|
setTimeout(() => {
|
|
|
this.loadingLook = false;
|
|
|
})
|
|
|
},
|
|
|
+ beforeUnmount() {
|
|
|
+ event.off(LIVE_EVENT_MESSAGE["RC:Chatroom:Welcome"], this.onWelcome);
|
|
|
+ event.off(LIVE_EVENT_MESSAGE["RC:Chatroom:MemberCount"], this.onMemberCount);
|
|
|
+ },
|
|
|
methods: {
|
|
|
async _init() {
|
|
|
try {
|
|
|
@@ -68,6 +73,13 @@ export default defineComponent({
|
|
|
//
|
|
|
}
|
|
|
},
|
|
|
+ /**
|
|
|
+ * 当后端发送人数消息时,更新人数
|
|
|
+ */
|
|
|
+ onMemberCount(evt: any) {
|
|
|
+ runtime.lookCount = evt.content.count || 0
|
|
|
+ RuntimeUtils.sendMessage({ count: runtime.lookCount }, 'MemberCount')
|
|
|
+ },
|
|
|
async onWelcome(value: any) {
|
|
|
// console.log(value)
|
|
|
if (value && value.user) {
|