mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-08-06 02:47:29 +08:00
移除直播中控台消息发送按钮
This commit is contained in:
@@ -27,18 +27,6 @@
|
||||
<div v-if="unreadCount > 0" class="chat-unread" @click="scrollToBottomAndClearUnread">
|
||||
{{ unreadCount }} 条新消息
|
||||
</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>
|
||||
</template>
|
||||
|
||||
@@ -144,9 +132,6 @@ export default {
|
||||
this.cleanup();
|
||||
},
|
||||
methods: {
|
||||
handleSend() {
|
||||
this.createTextMessageByInput();
|
||||
},
|
||||
async bootstrapChat() {
|
||||
if (!this.liveId || this.chatInited || this.initializing || !this.canInitChat) {
|
||||
return;
|
||||
@@ -259,7 +244,7 @@ export default {
|
||||
.chat-unread {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
bottom: 56px;
|
||||
bottom: 12px;
|
||||
transform: translateX(-50%);
|
||||
padding: 4px 12px;
|
||||
background: $theme_color;
|
||||
@@ -270,13 +255,4 @@ export default {
|
||||
z-index: 2;
|
||||
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>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/* eslint-disable no-console */
|
||||
import { nextTick, ref, unref, watch } from "vue";
|
||||
import { postSendMessage } from "@/api/live";
|
||||
import { Message } from "@/utils/message";
|
||||
import TencentCloudChat from "@tencentcloud/chat";
|
||||
import { resolveImConfigFromDetail } from "./useLiveSetting";
|
||||
import { genTestUserSig } from "../utils/GenerateTestUserSig";
|
||||
@@ -13,7 +11,6 @@ export function useChat(liveId, userInfo, liveDetail) {
|
||||
const chat = ref(null);
|
||||
const groupID = ref("");
|
||||
const messageList = ref([]);
|
||||
const messageContent = ref("");
|
||||
const chatListRef = ref(null);
|
||||
const bottomAnchorRef = ref(null);
|
||||
const isAtBottom = ref(true);
|
||||
@@ -346,33 +343,6 @@ export function useChat(liveId, userInfo, liveDetail) {
|
||||
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) {
|
||||
if (!force && !isAtBottom.value) {
|
||||
return;
|
||||
@@ -458,7 +428,6 @@ export function useChat(liveId, userInfo, liveDetail) {
|
||||
chat,
|
||||
groupID,
|
||||
messageList,
|
||||
messageContent,
|
||||
chatListRef,
|
||||
bottomAnchorRef,
|
||||
isAtBottom,
|
||||
@@ -468,7 +437,6 @@ export function useChat(liveId, userInfo, liveDetail) {
|
||||
imReady,
|
||||
initError,
|
||||
initTencentIm,
|
||||
createTextMessageByInput,
|
||||
scrollToBottom,
|
||||
scrollToBottomAndClearUnread,
|
||||
onScroll,
|
||||
|
||||
Reference in New Issue
Block a user