feat: 调整

This commit is contained in:
2026-01-22 00:08:44 +08:00
parent 8714478587
commit 47a361e78b
6 changed files with 116 additions and 78 deletions

View File

@@ -2,6 +2,14 @@
<!-- 页面根 -->
<div class="h-full overflow-hidden flex flex-col">
<div class="border-box px-6 pt-40 pb-6 ">
<h1 class="text-[28px] font-bold mb-7 leading-tight">
你好<br />
我今天能帮你什么
</h1>
</div>
<!-- 消息列表唯一滚动区 -->
<div ref="listRef" class="flex-1 overflow-y-auto px-6 py-6 space-y-6">
<div v-for="msg in chatMsgList" :key="msg.messageId" class="flex items-start gap-3"
@@ -50,31 +58,18 @@
智能问数
</div>
<div class="h-[174px] bg-white rounded-lg border border-[#eef2f6]
shadow-[0_1px_0_rgba(0,0,0,0.03)]
p-[18px] mt-[8px] flex flex-col justify-between">
<textarea rows="2" placeholder="给我发布或者布置任务" class="flex-1 resize-none outline-none text-sm"
v-model="inputMessage" @keydown.enter="handleKeydownEnter" />
<div class="flex justify-between items-end">
<button @click="addAttachmentAction()">
<RiLink />
</button>
<button class="w-[48px] h-[48px] bg-[#F5F7FA] px-2.5 py-1.5 rounded-md flex items-center justify-center"
@click="sendMessageAction()">
<RiStopFill v-if="isSendingMessage" />
<RiSendPlaneFill v-else />
</button>
</div>
</div>
<ChatInputArea v-model="inputMessage" :isSendingMessage="isSendingMessage" @send="sendMessageAction"
@attach="addAttachmentAction" />
</div>
<!-- 任务中心 -->
<TaskCenter />
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { RiLink, RiSendPlaneFill, RiStopFill } from '@remixicon/vue'
import { onMounted, nextTick, onUnmounted } from "vue";
import { WebSocketManager } from "@common/WebSocketManager";
import { MessageRole, ChatMessage } from "./model/ChatModel";
@@ -86,12 +81,17 @@ import ChatRoleMe from './components/ChatRoleMe.vue';
import ChatAIMark from './components/ChatAIMark.vue';
import ChatNameTime from './components/ChatNameTime.vue';
import ChatAttach from './components/ChatAttach.vue';
import ChatInputArea from './components/ChatInputArea.vue';
import TaskCenter from './TaskCenter.vue';
import { Session } from '../../utils/storage';
import userAvatar from '@assets/images/login/user_icon.png';
import aiAvatar from '@assets/images/login/blue_logo.png';
/// 是否是引导页
const isGuidePage = ref(true);
// 列表滚动容器引用
const listRef = ref<HTMLElement | null>(null);
@@ -217,16 +217,6 @@ const sendMessageAction = () => {
setTimeoutScrollToBottom();
};
// 处理在 textarea 中按 EnterShift+Enter 保留换行,单按 Enter 发送并阻止默认换行行为
const handleKeydownEnter = (e: KeyboardEvent) => {
if ((e as KeyboardEvent).shiftKey) {
// 允许插入换行
return;
}
e.preventDefault();
sendMessageAction();
};
// 停止发送消息事件
const sendStopAction = () => {
console.log("停止发送消息");