|
@@ -1,8 +1,11 @@
|
|
|
<template>
|
|
|
<!-- 主区域 start -->
|
|
|
<div id="PageRtcLive">
|
|
|
- <chat v-show="true" :chatList="chatList"></chat>
|
|
|
-
|
|
|
+ <chat
|
|
|
+ v-show="chatShow"
|
|
|
+ :chatList="chatList"
|
|
|
+ :currentUser="currentUser"
|
|
|
+ ></chat>
|
|
|
<!-- 控制条 start -->
|
|
|
<div class="controlBar" v-if="!showInput">
|
|
|
<div class="saySomething" @click="onFocus">
|
|
@@ -11,19 +14,31 @@
|
|
|
<span>说点什么~</span>
|
|
|
<!-- <span>已被禁言</span> -->
|
|
|
|
|
|
- <div class="disSpeakBtn"></div>
|
|
|
+ <div
|
|
|
+ class="disSpeakBtn"
|
|
|
+ @click.stop="chatShow = !chatShow"
|
|
|
+ :class="{ dis: !chatShow }"
|
|
|
+ ></div>
|
|
|
</div>
|
|
|
<!-- <div style="text-align: right; width: 100%">连接中...</div> -->
|
|
|
<div class="control_btn">
|
|
|
- <div class="brushesBack"></div>
|
|
|
- <div class="brushes"></div>
|
|
|
+ <div
|
|
|
+ class="brushesBack"
|
|
|
+ @click="onDrawUndo"
|
|
|
+ v-if="unref(isBrushes) && isNativeLeader"
|
|
|
+ ></div>
|
|
|
+ <div
|
|
|
+ class="brushes"
|
|
|
+ v-if="isNativeLeader"
|
|
|
+ @click="onDraw(!isBrushes)"
|
|
|
+ ></div>
|
|
|
|
|
|
<div class="invitation"></div>
|
|
|
+ <!-- @click="openMember" -->
|
|
|
<div v-if="isNativeLeader" class="members" @click="openMember"></div>
|
|
|
- <template>
|
|
|
- <div class="mic_on"></div>
|
|
|
- <div class="mic_no"></div>
|
|
|
- leader
|
|
|
+ <template v-if="isNativeLeader">
|
|
|
+ <div class="mic_on" v-if="unref(disableMic)"></div>
|
|
|
+ <div class="mic_no" v-if="!unref(disableMic)"></div>
|
|
|
</template>
|
|
|
|
|
|
<!-- <div style="font-size: 0.65rem">
|
|
@@ -55,26 +70,43 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 输入框 end-->
|
|
|
+ <!-- 用户列表 start -->
|
|
|
+ <memberList
|
|
|
+ :data="[]"
|
|
|
+ :show="showMember"
|
|
|
+ :animateActive="animateActive"
|
|
|
+ @close-member="closeMember"
|
|
|
+ />
|
|
|
+ <!-- 用户列表 end -->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { computed, nextTick, onMounted, ref } from "vue";
|
|
|
-import { getApp } from "/@/hooks/userApp";
|
|
|
+import { computed, nextTick, onMounted, ref, unref } from "vue";
|
|
|
+import { getApp, useApp } from "/@/hooks/userApp";
|
|
|
import { initSocketEvent } from "./roomControl";
|
|
|
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 memberList from "./memberList.vue";
|
|
|
import consola from "consola";
|
|
|
|
|
|
const rtcStore = useRtcStore();
|
|
|
const isNativeLeader = computed(() => rtcStore.role == "leader");
|
|
|
const showInput = ref(false);
|
|
|
+const chatShow = ref(true);
|
|
|
+const isBrushes = ref(false);
|
|
|
+const canUndo = ref(false);
|
|
|
+const animateActive = ref(false);
|
|
|
+const showMember = ref(false);
|
|
|
+const disableMic = ref(false);
|
|
|
+const role = computed(() => rtcStore.role);
|
|
|
const text = ref<string>("");
|
|
|
const chatList = computed(() => rtcStore.chatList);
|
|
|
-const userInfo = computed(() => rtcStore.chatList);
|
|
|
+const currentUser = computed(() => rtcStore.userId);
|
|
|
+
|
|
|
//设置socket 参数
|
|
|
const initParams: SocketParams = {
|
|
|
userId:
|
|
@@ -99,11 +131,40 @@ rtcStore.setSocketParams(initParams);
|
|
|
const socket = createSocket();
|
|
|
initSocketEvent(socket);
|
|
|
|
|
|
-onMounted(() => {
|
|
|
- const app = getApp();
|
|
|
-});
|
|
|
+// onMounted(() => {
|
|
|
+// const app = getApp();
|
|
|
+// });
|
|
|
|
|
|
/* method */
|
|
|
+const onDrawUndo = async () => {
|
|
|
+ let app = getApp();
|
|
|
+ app.Connect.paint.undo();
|
|
|
+ canUndo.value = app.Connect.paint.records.length > 0;
|
|
|
+
|
|
|
+ console.log(app.Connect.paint.records, "app.Connect.paint.records");
|
|
|
+};
|
|
|
+
|
|
|
+const onDraw = async (status) => {
|
|
|
+ isBrushes.value = status;
|
|
|
+
|
|
|
+ if (unref(isBrushes)) {
|
|
|
+ const app = await useApp();
|
|
|
+ app.Connect.paint.show({
|
|
|
+ role: unref(role),
|
|
|
+ paint: isNativeLeader ? true : false,
|
|
|
+ });
|
|
|
+ if (unref(role) == "leader") {
|
|
|
+ socket.emit("action", { type: "user-paint", open: true });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const app = await useApp();
|
|
|
+ app.Connect.paint.hide();
|
|
|
+ if (unref(role) == "leader") {
|
|
|
+ socket.emit("action", { type: "user-paint", open: false });
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
function closeText(): void {
|
|
|
showInput.value = false;
|
|
|
text.value = "";
|
|
@@ -138,7 +199,17 @@ function onFocus(): void {
|
|
|
document.getElementById("input_msg")?.focus();
|
|
|
});
|
|
|
}
|
|
|
-function openMember(): void {}
|
|
|
+const openMember = () => {
|
|
|
+ showMember.value = true;
|
|
|
+ animateActive.value = true;
|
|
|
+};
|
|
|
+const closeMember = () => {
|
|
|
+ animateActive.value = false;
|
|
|
+ let t = setTimeout(() => {
|
|
|
+ clearTimeout(t);
|
|
|
+ showMember.value = false;
|
|
|
+ }, 200);
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|