mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-08-06 10:57:26 +08:00
移除直播中控台消息发送按钮
This commit is contained in:
@@ -27,18 +27,6 @@
|
|||||||
<div v-if="unreadCount > 0" class="chat-unread" @click="scrollToBottomAndClearUnread">
|
<div v-if="unreadCount > 0" class="chat-unread" @click="scrollToBottomAndClearUnread">
|
||||||
{{ unreadCount }} 条新消息
|
{{ unreadCount }} 条新消息
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="chat-input-bar">
|
|
||||||
<el-input
|
|
||||||
v-model="messageContent"
|
|
||||||
placeholder="发送消息到直播间..."
|
|
||||||
maxlength="200"
|
|
||||||
@keyup.enter="createTextMessageByInput"
|
|
||||||
/>
|
|
||||||
<el-button type="primary" :disabled="!messageContent.trim()" @click="handleSend">
|
|
||||||
发送
|
|
||||||
</el-button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -144,9 +132,6 @@ export default {
|
|||||||
this.cleanup();
|
this.cleanup();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleSend() {
|
|
||||||
this.createTextMessageByInput();
|
|
||||||
},
|
|
||||||
async bootstrapChat() {
|
async bootstrapChat() {
|
||||||
if (!this.liveId || this.chatInited || this.initializing || !this.canInitChat) {
|
if (!this.liveId || this.chatInited || this.initializing || !this.canInitChat) {
|
||||||
return;
|
return;
|
||||||
@@ -259,7 +244,7 @@ export default {
|
|||||||
.chat-unread {
|
.chat-unread {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
bottom: 56px;
|
bottom: 12px;
|
||||||
transform: translateX(-50%);
|
transform: translateX(-50%);
|
||||||
padding: 4px 12px;
|
padding: 4px 12px;
|
||||||
background: $theme_color;
|
background: $theme_color;
|
||||||
@@ -270,13 +255,4 @@ export default {
|
|||||||
z-index: 2;
|
z-index: 2;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-input-bar {
|
|
||||||
flex-shrink: 0;
|
|
||||||
display: flex;
|
|
||||||
gap: 8px;
|
|
||||||
padding-top: 12px;
|
|
||||||
border-top: 1px solid #ebeef5;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
import { nextTick, ref, unref, watch } from "vue";
|
import { nextTick, ref, unref, watch } from "vue";
|
||||||
import { postSendMessage } from "@/api/live";
|
|
||||||
import { Message } from "@/utils/message";
|
|
||||||
import TencentCloudChat from "@tencentcloud/chat";
|
import TencentCloudChat from "@tencentcloud/chat";
|
||||||
import { resolveImConfigFromDetail } from "./useLiveSetting";
|
import { resolveImConfigFromDetail } from "./useLiveSetting";
|
||||||
import { genTestUserSig } from "../utils/GenerateTestUserSig";
|
import { genTestUserSig } from "../utils/GenerateTestUserSig";
|
||||||
@@ -13,7 +11,6 @@ export function useChat(liveId, userInfo, liveDetail) {
|
|||||||
const chat = ref(null);
|
const chat = ref(null);
|
||||||
const groupID = ref("");
|
const groupID = ref("");
|
||||||
const messageList = ref([]);
|
const messageList = ref([]);
|
||||||
const messageContent = ref("");
|
|
||||||
const chatListRef = ref(null);
|
const chatListRef = ref(null);
|
||||||
const bottomAnchorRef = ref(null);
|
const bottomAnchorRef = ref(null);
|
||||||
const isAtBottom = ref(true);
|
const isAtBottom = ref(true);
|
||||||
@@ -346,33 +343,6 @@ export function useChat(liveId, userInfo, liveDetail) {
|
|||||||
messageList.value.sort((a, b) => a.time - b.time);
|
messageList.value.sort((a, b) => a.time - b.time);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createTextMessageByInput() {
|
|
||||||
const content = messageContent.value.trim();
|
|
||||||
if (!content) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!imReady.value) {
|
|
||||||
Message.error("IM 未就绪,请稍后再试");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const res = await postSendMessage({
|
|
||||||
liveRoomId: unref(liveId),
|
|
||||||
message: content,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (res?.success) {
|
|
||||||
messageContent.value = "";
|
|
||||||
isAtBottom.value = true;
|
|
||||||
unreadCount.value = 0;
|
|
||||||
scrollToBottom(true);
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
Message.error("发送失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function scrollToBottom(force = false) {
|
function scrollToBottom(force = false) {
|
||||||
if (!force && !isAtBottom.value) {
|
if (!force && !isAtBottom.value) {
|
||||||
return;
|
return;
|
||||||
@@ -458,7 +428,6 @@ export function useChat(liveId, userInfo, liveDetail) {
|
|||||||
chat,
|
chat,
|
||||||
groupID,
|
groupID,
|
||||||
messageList,
|
messageList,
|
||||||
messageContent,
|
|
||||||
chatListRef,
|
chatListRef,
|
||||||
bottomAnchorRef,
|
bottomAnchorRef,
|
||||||
isAtBottom,
|
isAtBottom,
|
||||||
@@ -468,7 +437,6 @@ export function useChat(liveId, userInfo, liveDetail) {
|
|||||||
imReady,
|
imReady,
|
||||||
initError,
|
initError,
|
||||||
initTencentIm,
|
initTencentIm,
|
||||||
createTextMessageByInput,
|
|
||||||
scrollToBottom,
|
scrollToBottom,
|
||||||
scrollToBottomAndClearUnread,
|
scrollToBottomAndClearUnread,
|
||||||
onScroll,
|
onScroll,
|
||||||
|
|||||||
Reference in New Issue
Block a user