主持人富文本、leave meeting after close the browser

This commit is contained in:
cxc
2022-06-10 14:26:07 +08:00
parent 39975bd3b6
commit 9cfd6df649
4 changed files with 62 additions and 19 deletions

View File

@ -25,15 +25,28 @@
</div> </div>
</div> </div>
<div class="input-bar"> <div class="input-bar">
<div <!-- <div
v-if="isRich" v-if="isHost"
@click="openRichMessageEditor" @click="openRichMessageEditor"
v-html="editingMessage" v-html="editingMessage"
class="display-message" class="display-message"
:style="`border-color: ${ :style="`border-color: ${
showRichEditor === true ? '#409eff' : '#c0c4cc' showRichEditor === true ? '#409eff' : '#c0c4cc'
}`" }`"
></div> ></div> -->
<wangEditor
v-if="isHost"
class="rich-editor"
v-model="editingMessage"
width="100%"
height="200px"
></wangEditor>
<!-- <el-input v-if="isHost" v-model="editingMessage" class="message-input">
<template #prepend>
<el-button :icon="Expand" />
</template>
</el-input> -->
<el-input <el-input
v-else v-else
v-model="editingMessage" v-model="editingMessage"
@ -60,10 +73,10 @@ import { ref, toRefs } from "vue";
import { uniqueId } from "lodash"; import { uniqueId } from "lodash";
import dayjs from "dayjs"; import dayjs from "dayjs";
import wangEditor from "@/components/wangEditor"; import wangEditor from "@/components/wangEditor";
import { Expand } from "@element-plus/icons-vue";
const emit = defineEmits(["send"]); const emit = defineEmits(["send"]);
const props = defineProps({ const props = defineProps({
isRich: { isHost: {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
@ -80,7 +93,7 @@ const props = defineProps({
required: true, required: true,
}, },
}); });
const { isRich, messageList, account } = toRefs(props); const { isHost, messageList, account } = toRefs(props);
/* 聊天功能 */ /* 聊天功能 */
const editingMessage = ref(""); // 正在编辑的内容 const editingMessage = ref(""); // 正在编辑的内容
@ -171,7 +184,8 @@ const sendMessage = () => {
} }
.input-bar { .input-bar {
display: flex; display: flex;
margin: 0 5px; margin: 5px;
align-items: center;
.message-input { .message-input {
margin-right: 5px; margin-right: 5px;
} }

View File

@ -7,7 +7,7 @@
:mode="mode" :mode="mode"
/> />
<Editor <Editor
:style="`min-height: ${height}; overflow-y: hidden`" :style="`min-height: ${minHeight}; height: ${height} overflow-y: hidden`"
v-model="valueHtml" v-model="valueHtml"
:defaultConfig="editorConfig" :defaultConfig="editorConfig"
:mode="mode" :mode="mode"
@ -29,6 +29,10 @@ export default {
type: String, type: String,
default: "", default: "",
}, },
minHeight: {
type: String,
default: "150px",
},
height: { height: {
type: String, type: String,
default: "320px", default: "320px",
@ -41,6 +45,10 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
mode: {
type: String,
default: "default",
},
}, },
setup(props, context) { setup(props, context) {
// 编辑器实例,必须用 shallowRef // 编辑器实例,必须用 shallowRef
@ -66,9 +74,9 @@ export default {
"fontSize", "fontSize",
"fontFamily", "fontFamily",
"lineHeight", "lineHeight",
"emotion", // "emotion",
"redo", // "redo",
"undo", // "undo",
], ],
}; };
const editorConfig = { const editorConfig = {

View File

@ -64,8 +64,9 @@ router.beforeEach(async (to) => {
// 前往主持人页面 // 前往主持人页面
if (to.name === "Host") { if (to.name === "Host") {
console.log("host"); console.log("host");
// const bytes = cryptoJs.AES.decrypt(to.params.hostinfo, "secret"); if (to.params.meetingId !== store.state.joinUser.meetingId) {
// const decryptedData = JSON.parse(bytes.toString(cryptoJs.enc.Utf8)); store.commit("setMessagesList", []);
}
store.commit("setJoinUser", { store.commit("setJoinUser", {
nickname: to.params.nickname, nickname: to.params.nickname,
username: to.params.username, username: to.params.username,

View File

@ -32,9 +32,9 @@
></el-button> ></el-button>
</div> </div>
</div> </div>
<div id="right-chat"> <div id="right-chat" ref="rightChatRef">
<Chat <Chat
:is-rich="route.name === 'Host'" :is-host="route.name === 'Host'"
place="right" place="right"
:account="joinName" :account="joinName"
:message-list="messages" :message-list="messages"
@ -57,7 +57,7 @@
></el-tab-pane> ></el-tab-pane>
<el-tab-pane label="聊天" class="chat-pane" v-if="screenWidth < 900"> <el-tab-pane label="聊天" class="chat-pane" v-if="screenWidth < 900">
<Chat <Chat
:is-rich="route.name === 'Host'" :is-host="route.name === 'Host'"
place="bottom" place="bottom"
:account="joinName" :account="joinName"
:message-list="messages" :message-list="messages"
@ -646,6 +646,7 @@ const getStageQuestionnaireAnswer = (val) => {
}; };
const isFullScreen = ref(false); const isFullScreen = ref(false);
const rightChatRef = ref(null);
onMounted(() => { onMounted(() => {
meetingContainerRef.value.style.background = ` url(${ meetingContainerRef.value.style.background = ` url(${
store.getters.templateBackgroundPic || store.getters.defaultBackground store.getters.templateBackgroundPic || store.getters.defaultBackground
@ -654,7 +655,9 @@ onMounted(() => {
meetingHeight.value = (meetingWidth.value * 9) / 16; meetingHeight.value = (meetingWidth.value * 9) / 16;
videoElementRef.value.style.height = `${meetingHeight.value + 42}px`; videoElementRef.value.style.height = `${meetingHeight.value + 42}px`;
rightChatRef.value.style.height = `${
meetingContainerRef.value.offsetWidth * 0.08 + meetingHeight.value + 42
}px`;
const handleFullscreenChange = () => { const handleFullscreenChange = () => {
if (document.fullscreenElement) { if (document.fullscreenElement) {
isFullScreen.value = true; isFullScreen.value = true;
@ -729,6 +732,7 @@ const leaveConference = () => {
meetingConfig.client.leaveMeeting(); meetingConfig.client.leaveMeeting();
}; };
window.addEventListener("beforeunload", leaveConference); window.addEventListener("beforeunload", leaveConference);
window.addEventListener("unload", leaveConference);
onUnmounted(() => { onUnmounted(() => {
window.removeEventListener("beforeunload", leaveConference); window.removeEventListener("beforeunload", leaveConference);
}); });
@ -742,7 +746,9 @@ $meetingBackgroundWidth: 80vw; //会议背景宽度
$meetingBackgroundHeight: 80vw * 9 / 16; $meetingBackgroundHeight: 80vw * 9 / 16;
:deep(#right-chat .chat-container .message-list) { :deep(#right-chat .chat-container .message-list) {
height: $meetingComponentWitdh * 9 / 16; // height: $meetingComponentWitdh * 9 / 16;
// height: 100%;
flex-grow: 1;
overflow-y: scroll; overflow-y: scroll;
} }
@ -750,6 +756,9 @@ $meetingBackgroundHeight: 80vw * 9 / 16;
#meeting-chat-row { #meeting-chat-row {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
:deep(.rich-editor) {
width: 14vw !important;
}
#meeting-container { #meeting-container {
box-sizing: border-box; box-sizing: border-box;
padding-top: calc(80vw * 0.08); padding-top: calc(80vw * 0.08);
@ -896,6 +905,10 @@ $meetingBackgroundHeight: 80vw * 9 / 16;
#meeting-container { #meeting-container {
padding-top: calc(100vw * 0.08); padding-top: calc(100vw * 0.08);
width: 100vw; width: 100vw;
.text-label-container {
width: 100vw;
// height: 100%;
}
#video-element { #video-element {
width: 96vw; width: 96vw;
:deep(div[id*="suspension-view-tabpanel"] :deep(div[id*="suspension-view-tabpanel"]
@ -952,6 +965,10 @@ $meetingBackgroundHeight: 80vw * 9 / 16;
} }
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
.text-label-container {
width: 100vw;
height: 100%;
}
#video-element { #video-element {
width: $meetingComponentWitdh; width: $meetingComponentWitdh;
} }
@ -1027,7 +1044,10 @@ $meetingBackgroundHeight: 80vw * 9 / 16;
left: 100vw; left: 100vw;
width: 100vh !important; width: 100vh !important;
height: 100vw; height: 100vw;
.text-label-container {
width: 100vh;
height: 100vw;
}
#video-element { #video-element {
width: $meetingComponentWitdh; width: $meetingComponentWitdh;
:deep(div[id*="suspension-view-tabpanel"] :deep(div[id*="suspension-view-tabpanel"]