Commit 8769bfef by Lin

fix: 样式交互对齐优化

1 parent 8a9475de
<template>
<div class="flex items-center h-[42px] mb-4 border-b border-gray-100">
<div class="flex align-center items-center h-[42px] mb-4">
<img src="/images/icon-title.png" alt="title" class="w-[4px] h-[18px] rounded-sm">
<p class="text-[14px] font-medium text-[#2F3133] ml-[12px]">{{ title }}</p>
</div>
......
......@@ -15,7 +15,7 @@
<div class="group relative flex items-start">
<!-- 步骤数字 -->
<span
class="flex h-7 w-7 items-center justify-center rounded-full border border-blue-100 bg-blue-50 ring-4 ring-white"
class="flex h-7 w-7 items-center justify-center rounded-full bg-blue-50 ring-4 ring-white"
>
<span class="text-sm font-bold text-blue-600">{{ index + 1 }}</span>
</span>
......
......@@ -311,7 +311,7 @@ const handleFileChange = async (file) => {
validation: {
allowedTypes: ['application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
allowedExtensions: ['pdf', 'doc', 'docx'],
maxSize: 10 * 1024 * 1024, // 10MB
maxSize: 10 * 1024 * 1024, // 50MB
errorMessage: '文件格式错误,仅支持 PDF、Word 格式',
},
onSuccess: (url) => {
......@@ -538,11 +538,13 @@ const cancel = () => {
<img src="/images/icon-upload.png" alt="upload-file" class="w-[16px] h-[16px] mr-[4px]"> <span>选择文件</span>
</div>
</el-upload>
<div class="mt-[5px] text-xs text-[#909399]">支持pdf, word格式,大小在10M以内</div>
<div class="mt-[5px] text-[12px] text-[#909399]">支持pdf, word格式,大小在10M以内</div>
<!-- 已上传文件显示 -->
<div v-if="fileInfo.name" class="mt-2 flex items-center gap-2">
<el-icon class="text-[#409eff]"><Document /></el-icon>
<span class="text-sm text-[#606266]">{{ fileInfo.name }}</span>
<div class="flex items-center gap-2 w-[376px] bg-[#F5F7FA] px-[10px] rounded-[4px]">
<el-icon class="text-[#9BA3AD]"><Document /></el-icon>
<span class="text-[12px] w-[376px] text-[#606266]">{{ fileInfo.name }}</span>
</div>
<el-button
type="danger"
link
......@@ -550,7 +552,7 @@ const cancel = () => {
@click="removeFile"
class="ml-2"
>
<el-icon><Delete /></el-icon>
<el-icon class="text-[#9BA3AD]"><Delete /></el-icon>
</el-button>
</div>
</div>
......@@ -610,7 +612,7 @@ const cancel = () => {
<style scoped lang="scss">
/* 覆盖 Element Plus 一些默认样式以更贴合设计图 */
:deep(.el-form-item__label) {
font-weight: 500;
font-weight: normal;
color: #565C66;
}
......
......@@ -8,7 +8,7 @@
<CustomHeaderTitle title="智能体概况"/>
<!-- 卡片内容 -->
<div class="rounded-lg p-6 shadow-[0_4px_12px_0_#525b6629] transition-shadow">
<div class="rounded-[8px] p-6 shadow-[0_4px_12px_0_#525b6629] transition-shadow">
<div class="flex items-center">
<img src="/images/icon-agentic-practice.png" class="h-[32px] w-[32px] mr-[12px] rounded-full bg-red-200" />
<div>
......
......@@ -8,7 +8,7 @@
<CustomHeaderTitle title="智能体概况"/>
<!-- 文本内容 -->
<div class="rounded-lg p-6 shadow-[0_4px_12px_0_#525b6629] transition-shadow">
<div class="rounded-[8px] p-6 shadow-[0_4px_12px_0_#525b6629] transition-shadow">
<div class="flex items-center">
<img src="/images/icon-agentic-quality.png" class="h-[32px] w-[32px] mr-[12px] rounded-full bg-red-200" />
<div>
......
......@@ -7,7 +7,7 @@
<!-- 标题头 -->
<CustomHeaderTitle title="智能体概况"/>
<!-- 卡片内容 -->
<div class="rounded-lg p-6 shadow-[0_4px_12px_0_#525b6629] transition-shadow">
<div class="rounded-[8px] p-6 shadow-[0_4px_12px_0_#525b6629] transition-shadow">
<div class="flex items-center">
<img src="/images/icon-agentic-replay.png" class="h-[32px] w-[32px] mr-[12px] rounded-full bg-red-200" />
<div>
......@@ -56,7 +56,7 @@
:placeholder="isEditing ? '请输入复盘提示词模板' : ''"
:autosize="{ minRows: 2, maxRows: 4 }"
/>
<p class="text-[12px] text-[#969AA3] font-normal mt-[4px]">提示词将指导AI如何进行对话分析,可根据需求调整分析重点和输出格式</p>
<p class="text-[12px] text-[#969AA3] font-normal mt-[8px]">提示词将指导AI如何进行对话分析,可根据需求调整分析重点和输出格式</p>
<div class="btn-group flex items-center gap-[12px] mt-[32px]" v-if="isEditing">
<el-button type="primary" @click="updatePromptTemplateList">保存</el-button>
<!-- <el-button @click="toggleEdit">取消</el-button> -->
......
......@@ -83,7 +83,7 @@
<!-- 5. 智能体主动联系 -->
<el-form-item label="学员无应答时,智能体是否主动联系" prop="proactiveContactEnabled">
<el-radio-group v-model="formData.proactiveContactEnabled">
<el-radio-group v-model="formData.proactiveContactEnabled" class="compact-radio-group">
<el-radio :label="true">是</el-radio>
<el-radio :label="false">否</el-radio>
</el-radio-group>
......@@ -314,4 +314,9 @@ defineExpose({
:deep(.el-radio__input.is-checked + .el-radio__label) {
color: #606266 !important;
}
/* 缩小 radio-group 中 radio 之间的间距 */
:deep(.compact-radio-group .el-radio) {
margin-right: 24px;
}
</style>
<script setup>
import { ref } from 'vue';
import { ref, onMounted, onUnmounted, nextTick, watch } from 'vue';
import {
ChatDotRound,
......@@ -20,6 +20,87 @@ import AgenticTrain from './components/AgenticTrain.vue';
// 状态
const activeMenu = ref(0);
// 容器引用
const scrollContainerRef = ref(null);
// 滚动数据
const scrollData = ref({
scrollTop: 0,
scrollLeft: 0,
scrollHeight: 0,
clientHeight: 0,
scrollWidth: 0,
clientWidth: 0,
});
// 处理滚动事件
const handleScroll = (event) => {
const target = event?.target || event?.currentTarget || scrollContainerRef.value;
if (!target) return;
scrollData.value = {
scrollTop: target.scrollTop,
scrollLeft: target.scrollLeft,
scrollHeight: target.scrollHeight,
clientHeight: target.clientHeight,
scrollWidth: target.scrollWidth,
clientWidth: target.clientWidth,
};
// 调试信息,可以在控制台查看滚动数据
console.log('滚动事件触发:', {
scrollTop: scrollData.value.scrollTop,
scrollHeight: scrollData.value.scrollHeight,
clientHeight: scrollData.value.clientHeight,
});
};
// 初始化滚动监听
const initScrollListener = async () => {
await nextTick();
if (scrollContainerRef.value) {
// 先移除旧的监听器(如果存在)
scrollContainerRef.value.removeEventListener('scroll', handleScroll);
// 添加新的监听器
scrollContainerRef.value.addEventListener('scroll', handleScroll, { passive: true });
console.log('滚动监听器已绑定');
} else {
console.warn('滚动容器引用未找到');
}
};
// 组件挂载后添加事件监听
onMounted(() => {
initScrollListener();
});
// 监听 activeMenu 变化,当切换组件时重新初始化监听
watch(activeMenu, () => {
initScrollListener();
});
// 菜单点击切换时重置滚动条
const handleMenuClick = async (index) => {
activeMenu.value = index;
// 等待组件内容渲染完毕
await nextTick();
// 再通过 requestAnimationFrame 确保 DOM 布局完成后再滚动
requestAnimationFrame(() => {
const el = scrollContainerRef.value;
if (!el) return;
el.scrollTo({ top: 0, left: 0, behavior: 'auto' });
// 更新一次滚动数据,保持同步
handleScroll({ target: el });
});
};
// 组件卸载前移除事件监听
onUnmounted(() => {
if (scrollContainerRef.value) {
scrollContainerRef.value.removeEventListener('scroll', handleScroll);
}
});
// 数据源:侧边栏
const sidebarItems = [
{
......@@ -73,8 +154,8 @@ const sidebarItems = [
<div
v-for="(item, index) in sidebarItems"
:key="index"
@click="activeMenu = index"
class="group flex cursor-pointer items-center rounded-xl p-4 transition-all duration-200"
@click="handleMenuClick(index)"
class="group flex cursor-pointer items-center rounded-[8px] p-4 transition-all duration-200"
:class="activeMenu === index ? 'bg-[#eef6ff]' : 'hover:bg-gray-50'"
>
<!-- 图标容器 -->
......@@ -90,12 +171,11 @@ const sidebarItems = [
<!-- 文本 -->
<div class="flex flex-col">
<span
class="mb-0.5 text-base font-medium"
:class="activeMenu === index ? 'text-gray-900' : 'text-gray-700'"
class="mb-0.5 text-base font-medium text-[#2F3133]"
>
{{ item.title }}
</span>
<span class="text-[12px] font-light text-gray-400">{{
<span class="text-[12px] text-[#969AA3]">{{
item.desc
}}</span>
</div>
......@@ -104,7 +184,12 @@ const sidebarItems = [
</aside>
<!-- 右侧主要内容区 -->
<section class="h-full flex-1 overflow-y-auto scroll-smooth bg-white pr-[24px] pb-[94px]">
<section
ref="scrollContainerRef"
class="flex-1 overflow-y-auto scroll-smooth bg-white pr-[24px] pb-[94px]"
:style="{ height: 'calc(100vh - 60px)' }"
@scroll="handleScroll"
>
<AgenticQuality v-if="activeMenu === 0" />
<AgenticPractice v-if="activeMenu === 1" />
<AgenticReplay v-if="activeMenu === 2" />
......
......@@ -38,8 +38,8 @@
:on-remove="handleFileRemove"
>
<div class="flex flex-col items-center justify-center h-full w-full">
<el-icon class="el-icon--upload !text-4xl !text-gray-400 mb-2"><UploadFilled /></el-icon>
<div class="el-upload__text text-gray-400">
<el-icon class="el-icon--upload !text-4xl !text-gray-400"><UploadFilled /></el-icon>
<div class="el-upload__text text-gray-400 mt-[-8px]">
点击上传 / 拖拽文件到处
</div>
</div>
......@@ -161,7 +161,7 @@
<div
v-for="node in selectedNodes"
:key="node.id"
class="flex justify-between items-center px-3 py-2 rounded group transition"
class="flex justify-between items-center px-3 py-1 rounded group transition"
>
<div class="flex items-center gap-2">
<span class="text-[14px] text-[#2F3133] font-normal">{{ getNodeDisplayText(node) }}</span>
......
......@@ -290,24 +290,27 @@ const getCardStyle = (type) => {
const styles = {
1: { // 文档
cardBg: 'bg-[#f0f9f8]', // 极浅绿背景
cardBgStyle: 'background: linear-gradient(56.9deg, #e6faf7 0%, #f5fffe 28.999999999999996%, #f5fffe 60%, #eefcfb 100%)', // 渐变背景
iconBg: 'bg-[#d5eee6]', // 图标浅绿底
iconColor: 'text-[#4bb79d]', // 图标深绿
tagColor: 'text-[#4bb79d]', // 标签文字色
},
2: { // 图片
cardBg: 'bg-[#f2f4fc]', // 极浅蓝背景
cardBgStyle: 'background: linear-gradient(56.9deg, #ebf2ff 0%, #f5f8ff 28.999999999999996%, #f5f8ff 61%, #f0f4ff 100%)', // 渐变背景
iconBg: 'bg-[#dcecff]',
iconColor: 'text-[#6eb0f7]',
tagColor: 'text-[#6eb0f7]',
},
3: { // 视频
cardBg: 'bg-[#f0f8ff]', // 极浅紫背景
cardBgStyle: 'background: linear-gradient(56.9deg, #ebf8ff 0%, #f5fbff 28.999999999999996%, #f5fbff 60%, #f0faff 100%)', // 渐变背景
iconBg: 'bg-[#dbe4fd]',
iconColor: 'text-[#738cdd]',
tagColor: 'text-[#738cdd]',
},
4: { // 其他
cardBg: 'bg-[#f5f5f5]', // 极浅灰背景
cardBgStyle: 'background: linear-gradient(56.9deg, #e6faf7 0%, #f5fffe 28.999999999999996%, #f5fffe 60%, #eefcfb 100%)', // 渐变背景
iconBg: 'bg-[#e0e0e0]',
iconColor: 'text-[#757575]',
tagColor: 'text-[#757575]',
......@@ -653,7 +656,7 @@ onMounted(() => {
<h1 class="mb-5 text-lg font-semibold text-gray-800">知识管理</h1>
<div class="flex gap-8">
<div
class="cursor-pointer border-b-2 border-[#E1E3E6] pb-3 text-[14px] font-medium text-[#1956FE]"
class="cursor-pointer border-b-2 border-[#1956FE] pb-3 text-[14px] font-medium text-[#1956FE]"
>
素材库
</div>
......@@ -668,7 +671,7 @@ onMounted(() => {
<div class="flex flex-1 overflow-hidden bg-white p-6">
<!-- 左侧侧边栏 -->
<aside
class="mr-6 flex h-[calc(100%-40px)] w-[278px] flex-shrink-0 flex-col rounded-[12px] border border-[#E1E3E6] p-[16px]"
class="flex h-[calc(100%-40px)] w-[278px] flex-shrink-0 flex-col rounded-[12px] border border-[#E1E3E6] p-[16px]"
>
<div class="flex items-center justify-between mb-3 flex-shrink-0">
<p class="text-[14px] font-normal text-[#2F3133]">
......@@ -763,7 +766,7 @@ onMounted(() => {
<!-- 右侧内容区 -->
<main class="flex flex-1 flex-col overflow-hidden">
<!-- 筛选栏 -->
<div class="mb-5 flex flex-shrink-0 items-center justify-between">
<div class="mx-6 mb-5 flex flex-shrink-0 items-center justify-between">
<div class="flex items-center gap-3">
<div class="flex items-center gap-3">
<span class="whitespace-nowrap text-[14px] text-gray-600"
......@@ -818,12 +821,13 @@ onMounted(() => {
<div class="flex justify-end items-center mb-4 bg-white">
<el-button type="primary" :icon="Upload" @click="handleEditMaterial({})">上传素材</el-button>
</div>
<div class="mb-6 grid grid-cols-3 gap-6 py-[24px]">
<div class="mx-6 mb-6 grid grid-cols-3 gap-6 py-[24px] materials-grid">
<div
v-for="item in materials"
:key="item.id"
class="relative flex min-w-[278px] h-[148px] flex-col rounded-[10px] px-5 mb-[24px] transition-shadow duration-300 hover:shadow-[0_8px_24px_#525b663d]"
:class="getCardStyle(item.knowledgeType).cardBg"
:class="getCardStyle(item.knowledgeType).cardBgStyle ? '' : getCardStyle(item.knowledgeType).cardBg"
:style="getCardStyle(item.knowledgeType).cardBgStyle"
>
<!-- 卡片图标区域 -->
<div class="mb-4 absolute top-[-16px] left-[24px]">
......@@ -833,6 +837,7 @@ onMounted(() => {
getCardStyle(item.knowledgeType).iconBg,
getCardStyle(item.knowledgeType).iconColor,
]"
style=" box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);"
>
<img src="/images/icon-know-doc.png" v-if="item.knowledgeType == 1 || item.knowledgeType === 'doc'" alt="" srcset="">
<img v-else-if="item.knowledgeType == 3 || item.knowledgeType === 'video'" src="/images/icon-know-video.png" alt="" srcset="">
......@@ -910,7 +915,7 @@ onMounted(() => {
<!-- 分页 -->
<div class="flex flex-shrink-0 items-center justify-between pt-5 pb-10 bg-white border-t border-gray-100">
<div class="mx-6 flex flex-shrink-0 items-center justify-between pt-5 pb-10 bg-white border-t border-gray-100">
<div class="text-[14px] text-[#777C85]">共 {{ pagination.total }} 项数据</div>
<div class="flex items-center gap-2">
<el-select
......@@ -1027,4 +1032,11 @@ onMounted(() => {
:deep(.el-select-dropdown__item.selected) {
color: #1956FE !important;
}
/* 素材卡片网格布局:屏幕宽度大于1742px时显示4列 */
@media (min-width: 1742px) {
.materials-grid {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
}
</style>
......@@ -419,7 +419,7 @@ watch(
gap: 8px;
align-items: center;
width: 228px;
height: 56px;
height: 55px;
padding-left: 24px;
font-size: 20px;
font-weight: 600;
......@@ -450,6 +450,7 @@ watch(
height: 56px;
padding: 0 24px;
background: #fff;
border-bottom: 1px solid #F2F4F7;
}
/* 主体区域 */
......
......@@ -560,12 +560,14 @@ const handleChildClick = (child: MenuItem) => {
.popover-menu-item:hover {
color: #1956fe;
background-color: #f0f4ff;
border-radius: 4px;
}
.popover-menu-item.active {
color: #1956fe;
background-color: #e8f0ff;
font-weight: 500;
border-radius: 4px;
}
.popover-menu-title {
......
......@@ -84,7 +84,7 @@ const handleLogin = async () => {
// 验证表单
if (!isFormValid.value) {
if (!loginForm.username.trim()) {
usernameError.value = '请输入用户名';
usernameError.value = '请输入账户';
}
if (!loginForm.password.trim()) {
passwordError.value = '请输入密码';
......@@ -115,7 +115,7 @@ const handleLogin = async () => {
if (code == 0) {
// 登录成功,处理记住密码逻辑
if (loginForm.rememberMe) {
// 保存用户名和密码(使用 base64 简单编码)
// 保存账户和密码(使用 base64 简单编码)
localStorage.setItem('rememberedUsername', loginForm.username);
localStorage.setItem('rememberedPassword', btoa(loginForm.password));
localStorage.setItem('rememberMe', 'true');
......@@ -193,7 +193,7 @@ const handleRememberMeChange = () => {
if (!loginForm.rememberMe) {
// 取消勾选时,清除保存的密码信息
const savedUsername = localStorage.getItem('rememberedUsername');
// 如果当前用户名与保存的用户名一致,清空密码字段
// 如果当前账户与保存的用户名一致,清空密码字段
if (savedUsername === loginForm.username) {
loginForm.password = '';
}
......@@ -560,8 +560,6 @@ onMounted(() => {
display: flex;
flex-direction: column;
gap: 4px;
margin-bottom: 4px;
.input-icon {
width: 18px;
height: 18px;
......@@ -798,7 +796,7 @@ onMounted(() => {
width: 100% !important;
height: $input-height !important;
padding: 0 !important;
margin-top: 28px;
margin-top: 20px;
font-size: $font-size-lg !important;
font-weight: 600 !important;
color: #fff !important;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!