|
@@ -1,6 +1,9 @@
|
|
|
<template>
|
|
|
<!-- 主区域 start -->
|
|
|
<div id="PageRtcLive">
|
|
|
+ <chat v-show="true" :chatList="chatList"></chat>
|
|
|
+
|
|
|
+ <!-- 控制条 start -->
|
|
|
<div class="controlBar" v-if="!showInput">
|
|
|
<div class="saySomething" @click="onFocus">
|
|
|
<!-- <i class="speakIcon"
|
|
@@ -29,7 +32,7 @@
|
|
|
<div class="exit"></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
+ <!-- 控制条 start -->
|
|
|
<!-- 主区域 end -->
|
|
|
<!-- 输入框 start-->
|
|
|
<div class="layer" v-if="showInput" @click.stop="closeText">
|
|
@@ -59,15 +62,19 @@
|
|
|
import { computed, nextTick, onMounted, ref } from "vue";
|
|
|
import { getApp } from "/@/hooks/userApp";
|
|
|
import { initSocketEvent } from "./roomControl";
|
|
|
-import { createSocket } from "/@/hooks/userRoom";
|
|
|
+import { createSocket } from "/@/hooks/userSocket";
|
|
|
import browser from "/@/utils/browser";
|
|
|
import { useRtcStore } from "/@/store/modules/rtc";
|
|
|
import type { SocketParams, RoleType } from "/@/store/modules/rtc";
|
|
|
+import chat from "./chat.vue";
|
|
|
+import consola from "consola";
|
|
|
+
|
|
|
const rtcStore = useRtcStore();
|
|
|
const isNativeLeader = computed(() => rtcStore.role == "leader");
|
|
|
const showInput = ref(false);
|
|
|
const text = ref<string>("");
|
|
|
-
|
|
|
+const chatList = computed(() => rtcStore.chatList);
|
|
|
+const userInfo = computed(() => rtcStore.chatList);
|
|
|
//设置socket 参数
|
|
|
const initParams: SocketParams = {
|
|
|
userId:
|
|
@@ -83,7 +90,10 @@ const initParams: SocketParams = {
|
|
|
nickname: browser.getURLParam("name"),
|
|
|
mode: browser.getURLParam("mode"),
|
|
|
};
|
|
|
-
|
|
|
+consola.info({
|
|
|
+ message: initParams,
|
|
|
+ tag: "socket参数",
|
|
|
+});
|
|
|
rtcStore.setSocketParams(initParams);
|
|
|
|
|
|
const socket = createSocket();
|
|
@@ -110,11 +120,15 @@ function sendText(): void {
|
|
|
UserId: rtcStore.userId,
|
|
|
text: text.value,
|
|
|
};
|
|
|
+ consola.info({
|
|
|
+ message: data,
|
|
|
+ tag: "发送信息",
|
|
|
+ });
|
|
|
socket.emit("action", {
|
|
|
type: "danmumsg",
|
|
|
data,
|
|
|
});
|
|
|
- rtcStore.addChat(data);
|
|
|
+ rtcStore.addToChatList(data);
|
|
|
document.getElementById("input_msg")?.blur();
|
|
|
closeText();
|
|
|
}
|