From 6e09e21b98b487621e7f19e1b91012a0e9e617ed Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期五, 21 三月 2025 13:06:26 +0800 Subject: [PATCH] z-index: 1; --- src/components/chat/components/ChatContainer.vue | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/components/chat/components/ChatContainer.vue b/src/components/chat/components/ChatContainer.vue index e4c8c8e..f04733c 100644 --- a/src/components/chat/components/ChatContainer.vue +++ b/src/components/chat/components/ChatContainer.vue @@ -2,7 +2,7 @@ <div class="flex h-full"> <div class="flex flex-col h-full flex-auto relative"> <!-- 娑堟伅鍒楄〃鍖哄煙 --> - <div ref="chatListDom" class="relative h-full flex flex-col items-center overflow-y-auto" style="height: calc(100% - 50px)"> + <div v-resize="updateChatWidth" ref="chatListDom" class="relative h-full flex flex-col items-center overflow-y-auto flex-auto"> <span class="more-loading absolute text-blue-400 left-[50%] translate-x-[-50%] cursor-pointer w-10" v-loading="moreIsLoading" @@ -14,7 +14,7 @@ </div> <!-- 鍥炲埌搴曢儴鎸夐挳 --> - <div class="absolute right-28 bottom-40" v-if="!isBottom"> + <div class="absolute right-28 bottom-56" v-if="!isBottom"> <div class="flex items-center justify-center size-[38px] cursor-pointer hover:text-[#0284ff] border rounded-full hover:bg-[#f6f7f9] shadow bg-white" @click="scrollToBottom" @@ -24,9 +24,21 @@ </div> <!-- 杈撳叆鍖哄煙 --> - <div class="sticky bottom-0 w-full px-6 pt-12 pb-6 bg-[rgb(247,248,250)] flex justify-center" v-if="!isSharePage"> + <div class="w-full px-6 pb-6 bg-[rgb(247,248,250)] flex justify-center z-[1] flex-0" v-if="!isSharePage"> <slot name="input-area" /> </div> + </div> + + <div class="w-[30%] flex-0 flex flex-col" v-if="fileContentIsShow"> + <div class="bg-[#f9fbff] flex items-center justify-between p-4 border-b"> + <div class="text-lg font-medium">{{ fileContent.title }}</div> + <div class="cursor-pointer hover:text-[#0284ff]" @click="fileContentIsShow = false"> + <i class="ywifont ywicon-guanbi text-[20px]" /> + </div> + </div> + <span class="bg-[#edf2fb] flex-1 overflow-y-auto p-4 break-words whitespace-pre-wrap"> + {{ fileContent.content }} + </span> </div> <slot name="drawer" /> @@ -34,14 +46,15 @@ </template> <script setup lang="ts"> -import { ref } from 'vue'; +import { onActivated, onDeactivated, ref } from 'vue'; +import { useChatWidth } from '../hooks/useChatWidth'; import { useScroll } from '../hooks/useScroll'; +import emitter from '/@/utils/mitt'; const props = defineProps<{ loading?: boolean; moreIsLoading?: boolean; isSharePage?: boolean; - chatWidth?: string; }>(); const chatListDom = ref<HTMLDivElement>(); @@ -50,9 +63,32 @@ chatListDom, }); +const fileContentIsShow = ref(false); + +const fileContent = ref({ + title: '', + content: '', +}); + +const setFileContent = (data: { title: string; content: string }) => { + fileContentIsShow.value = true; + fileContent.value = data; +}; + +onActivated(() => { + emitter.on('setFileContent', setFileContent); +}); + +onDeactivated(() => { + emitter.off('setFileContent', setFileContent); +}); + +const { updateChatWidth, chatWidth } = useChatWidth(); + defineExpose({ chatListDom, scrollToBottom, + chatWidth, }); </script> -- Gitblit v1.9.3