Commit 8769bfef by Lin

fix: 样式交互对齐优化

1 parent 8a9475de
<template> <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"> <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> <p class="text-[14px] font-medium text-[#2F3133] ml-[12px]">{{ title }}</p>
</div> </div>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<div class="group relative flex items-start"> <div class="group relative flex items-start">
<!-- 步骤数字 --> <!-- 步骤数字 -->
<span <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 class="text-sm font-bold text-blue-600">{{ index + 1 }}</span>
</span> </span>
......
<script setup> <script setup>
import { ref, computed, watch } from 'vue'; import { computed, nextTick, ref, watch } from 'vue';
import { ElMessage } from 'element-plus';
import { ZoomIn, ZoomOut, Download } from '@element-plus/icons-vue'; import { ZoomIn, ZoomOut } from '@element-plus/icons-vue';
import VueOfficeDocx from '@vue-office/docx'; import VueOfficeDocx from '@vue-office/docx';
import '@vue-office/docx/lib/index.css';
import VueOfficePdf from '@vue-office/pdf';
import VueOfficeExcel from '@vue-office/excel'; import VueOfficeExcel from '@vue-office/excel';
import VueOfficePdf from '@vue-office/pdf';
import { ElMessage } from 'element-plus';
import '@vue-office/docx/lib/index.css';
import '@vue-office/excel/lib/index.css'; import '@vue-office/excel/lib/index.css';
import VueOfficePptx from '@vue-office/pptx';
// Props // Props
const props = defineProps({ const props = defineProps({
...@@ -30,6 +31,8 @@ const scale = ref(1); ...@@ -30,6 +31,8 @@ const scale = ref(1);
const pdfScale = ref(1); const pdfScale = ref(1);
// 旋转角度 // 旋转角度
const rotate = ref(0); const rotate = ref(0);
// 视频元素引用
const videoRef = ref(null);
// 计算属性:是否显示弹框 // 计算属性:是否显示弹框
const dialogVisible = computed({ const dialogVisible = computed({
...@@ -110,10 +113,57 @@ const resetTransform = () => { ...@@ -110,10 +113,57 @@ const resetTransform = () => {
rotate.value = 0; rotate.value = 0;
}; };
// 重置视频
const resetVideo = () => {
if (materialType.value === 'video' && videoRef.value) {
try {
videoRef.value.pause();
videoRef.value.currentTime = 0;
// 移除 src 属性并重新加载,确保视频完全重置
videoRef.value.src = '';
videoRef.value.load();
// 如果需要,可以重新设置 src
if (props.material?.filePath) {
videoRef.value.src = props.material.filePath;
}
} catch (error) {
console.error('重置视频失败:', error);
}
}
};
// 重置所有数据(统一的重置函数)
const resetAll = () => {
// 重置图片和PDF的缩放、旋转
resetTransform();
// 重置视频
resetVideo();
// 重置文档滚动位置(通过查找滚动容器)
nextTick(() => {
try {
const scrollContainers = document.querySelectorAll(
'.preview-material-dialog .overflow-auto',
);
scrollContainers.forEach((container) => {
if (container.scrollTop > 0 || container.scrollLeft > 0) {
container.scrollTop = 0;
container.scrollLeft = 0;
}
});
} catch (error) {
console.error('重置滚动位置失败:', error);
}
});
};
// 监听弹框显示状态,每次打开时重置 // 监听弹框显示状态,每次打开时重置
watch(dialogVisible, (newVal) => { watch(dialogVisible, (newVal) => {
if (newVal) { if (newVal) {
resetTransform(); // 打开时重置所有状态
resetAll();
} else {
// 关闭时也重置所有状态,确保数据完全清理
resetAll();
} }
}); });
...@@ -180,9 +230,9 @@ const handleDownload = async () => { ...@@ -180,9 +230,9 @@ const handleDownload = async () => {
const link = document.createElement('a'); const link = document.createElement('a');
link.href = url; link.href = url;
link.download = props.material.name || 'download'; link.download = props.material.name || 'download';
document.body.appendChild(link); document.body.append(link);
link.click(); link.click();
document.body.removeChild(link); link.remove();
window.URL.revokeObjectURL(url); window.URL.revokeObjectURL(url);
ElMessage.success('下载成功'); ElMessage.success('下载成功');
} catch (error) { } catch (error) {
...@@ -193,6 +243,8 @@ const handleDownload = async () => { ...@@ -193,6 +243,8 @@ const handleDownload = async () => {
// 关闭弹框 // 关闭弹框
const handleClose = () => { const handleClose = () => {
// 重置所有数据
resetAll();
dialogVisible.value = false; dialogVisible.value = false;
emit('close'); emit('close');
}; };
...@@ -227,10 +279,13 @@ const handlePdfWheel = (event) => { ...@@ -227,10 +279,13 @@ const handlePdfWheel = (event) => {
:show-close="false" :show-close="false"
width="60%" width="60%"
class="preview-material-dialog" class="preview-material-dialog"
:destroy-on-close="true"
@close="handleClose" @close="handleClose"
> >
<!-- 关闭按钮 --> <!-- 关闭按钮 -->
<div class="absolute right-[-20%] top-[-15%] z-50 flex cursor-pointer items-center justify-center rounded-full backdrop-blur-sm transition-all"> <div
class="absolute right-[-20%] top-[-15%] z-50 flex cursor-pointer items-center justify-center rounded-full backdrop-blur-sm transition-all"
>
<img <img
src="/images/icon-preview-close.png" src="/images/icon-preview-close.png"
alt="关闭" alt="关闭"
...@@ -242,7 +297,10 @@ const handlePdfWheel = (event) => { ...@@ -242,7 +297,10 @@ const handlePdfWheel = (event) => {
<!-- 预览内容区 --> <!-- 预览内容区 -->
<div class="flex h-[70vh] flex-col overflow-hidden bg-[#E5E5E5] p-0"> <div class="flex h-[70vh] flex-col overflow-hidden bg-[#E5E5E5] p-0">
<!-- 图片预览 --> <!-- 图片预览 -->
<div v-if="materialType === 'image'" class="flex flex-1 items-center justify-center overflow-hidden p-6"> <div
v-if="materialType === 'image'"
class="flex flex-1 items-center justify-center overflow-hidden p-6"
>
<img <img
:src="material?.filePath" :src="material?.filePath"
:alt="material?.name" :alt="material?.name"
...@@ -252,8 +310,12 @@ const handlePdfWheel = (event) => { ...@@ -252,8 +310,12 @@ const handlePdfWheel = (event) => {
</div> </div>
<!-- 视频预览 --> <!-- 视频预览 -->
<div v-else-if="materialType === 'video'" class="flex flex-1 items-center justify-center overflow-hidden bg-black p-6"> <div
v-else-if="materialType === 'video'"
class="flex flex-1 items-center justify-center overflow-hidden bg-black p-6"
>
<video <video
ref="videoRef"
:src="material?.filePath" :src="material?.filePath"
controls controls
class="max-h-full max-w-full rounded-lg shadow-2xl" class="max-h-full max-w-full rounded-lg shadow-2xl"
...@@ -263,18 +325,27 @@ const handlePdfWheel = (event) => { ...@@ -263,18 +325,27 @@ const handlePdfWheel = (event) => {
</div> </div>
<!-- 文档预览 --> <!-- 文档预览 -->
<div v-else-if="materialType === 'document'" class="flex flex-1 flex-col overflow-hidden"> <div
v-else-if="materialType === 'document'"
class="flex flex-1 flex-col overflow-hidden"
>
<!-- PDF 预览 --> <!-- PDF 预览 -->
<div v-if="isPdf" class="relative h-full w-full overflow-auto bg-white" @wheel="handlePdfWheel"> <div
v-if="isPdf"
class="relative h-full w-full overflow-auto bg-white"
@wheel="handlePdfWheel"
>
<div class="pdf-container" :style="pdfTransformStyle"> <div class="pdf-container" :style="pdfTransformStyle">
<VueOfficePdf <VueOfficePdf
:src="material?.filePath" :src="material?.filePath"
style="width: 100%; height: 100%;" style="width: 100%; height: 100%"
@rendered="() => console.log('PDF 渲染完成')" @rendered="() => console.log('PDF 渲染完成')"
@error="(error) => { @error="
console.error('PDF 预览失败:', error); (error) => {
ElMessage.error('PDF 预览失败,请尝试下载后查看'); console.error('PDF 预览失败:', error);
}" ElMessage.error('PDF 预览失败,请尝试下载后查看');
}
"
/> />
</div> </div>
</div> </div>
...@@ -282,24 +353,32 @@ const handlePdfWheel = (event) => { ...@@ -282,24 +353,32 @@ const handlePdfWheel = (event) => {
<div v-else-if="isDocx" class="h-full w-full overflow-auto bg-white"> <div v-else-if="isDocx" class="h-full w-full overflow-auto bg-white">
<VueOfficeDocx <VueOfficeDocx
:src="material?.filePath" :src="material?.filePath"
style="width: 100%; height: 100%;" style="width: 100%; height: 100%"
@rendered="() => console.log('docx 渲染完成')" @rendered="() => console.log('docx 渲染完成')"
@error="(error) => { @error="
console.error('docx 预览失败:', error); (error) => {
ElMessage.error('文档预览失败,请尝试下载后查看'); console.error('docx 预览失败:', error);
}" ElMessage.error('文档预览失败,请尝试下载后查看');
}
"
/> />
</div> </div>
<!-- Excel 预览 --> <!-- Excel 预览 -->
<div v-else-if="isExcel" class="overflow-auto bg-white" style="width: 100%; height: 640px; margin: 0 auto;"> <div
v-else-if="isExcel"
class="overflow-auto bg-white"
style="width: 100%; height: 640px; margin: 0 auto"
>
<VueOfficeExcel <VueOfficeExcel
:src="material?.filePath" :src="material?.filePath"
style="height: 100%;" style="height: 100%"
@rendered="() => console.log('Excel 渲染完成')" @rendered="() => console.log('Excel 渲染完成')"
@error="(error) => { @error="
console.error('Excel 预览失败:', error); (error) => {
ElMessage.error('Excel 预览失败,请尝试下载后查看'); console.error('Excel 预览失败:', error);
}" ElMessage.error('Excel 预览失败,请尝试下载后查看');
}
"
/> />
</div> </div>
<!-- PPTX 预览 --> <!-- PPTX 预览 -->
...@@ -310,18 +389,34 @@ const handlePdfWheel = (event) => { ...@@ -310,18 +389,34 @@ const handlePdfWheel = (event) => {
frameborder="0" frameborder="0"
allowfullscreen allowfullscreen
@error="errorPptxHandler" @error="errorPptxHandler"
/> ></iframe>
</div> </div>
<!-- 其他文档类型 --> <!-- 其他文档类型 -->
<div v-else class="flex flex-1 items-center justify-center"> <div v-else class="flex flex-1 items-center justify-center">
<div class="flex flex-col items-center text-center"> <div class="flex flex-col items-center text-center">
<div class="mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-white shadow-lg"> <div
<svg class="h-10 w-10 text-[#4BB79D]" fill="none" viewBox="0 0 24 24" stroke="currentColor"> class="mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-white shadow-lg"
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" /> >
<svg
class="h-10 w-10 text-[#4BB79D]"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
/>
</svg> </svg>
</div> </div>
<p class="mb-3 text-base font-medium text-[#2F3133]">{{ material?.name }}</p> <p class="mb-3 text-base font-medium text-[#2F3133]">
<p class="text-sm text-[#777C85]">文档预览暂不支持在线查看,请下载后查看</p> {{ material?.name }}
</p>
<p class="text-sm text-[#777C85]">
文档预览暂不支持在线查看,请下载后查看
</p>
</div> </div>
</div> </div>
</div> </div>
...@@ -329,28 +424,45 @@ const handlePdfWheel = (event) => { ...@@ -329,28 +424,45 @@ const handlePdfWheel = (event) => {
<!-- 其他类型 --> <!-- 其他类型 -->
<div v-else class="flex flex-1 items-center justify-center"> <div v-else class="flex flex-1 items-center justify-center">
<div class="flex flex-col items-center text-center"> <div class="flex flex-col items-center text-center">
<div class="mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-white shadow-lg"> <div
<svg class="h-10 w-10 text-[#777C85]" fill="none" viewBox="0 0 24 24" stroke="currentColor"> class="mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-white shadow-lg"
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z" /> >
<svg
class="h-10 w-10 text-[#777C85]"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"
/>
</svg> </svg>
</div> </div>
<p class="mb-3 text-base font-medium text-[#2F3133]">{{ material?.name }}</p> <p class="mb-3 text-base font-medium text-[#2F3133]">
{{ material?.name }}
</p>
<p class="text-sm text-[#777C85]">该文件类型暂不支持预览</p> <p class="text-sm text-[#777C85]">该文件类型暂不支持预览</p>
</div> </div>
</div> </div>
<!-- 底部控制栏 --> <!-- 底部控制栏 -->
<div v-if="false" class="flex h-[60px] flex-shrink-0 items-center justify-center border-t border-[#E5E5E5] bg-white"> <div
v-if="false"
class="flex h-[60px] flex-shrink-0 items-center justify-center border-t border-[#E5E5E5] bg-white"
>
<div class="flex items-center justify-center gap-3"> <div class="flex items-center justify-center gap-3">
<!-- 放大 --> <!-- 放大 -->
<button <button
v-if="canScale" v-if="canScale"
:disabled="isPdf ? pdfScale >= 3 : scale >= 3" :disabled="isPdf ? pdfScale >= 3 : scale >= 3"
class="flex h-9 w-9 items-center justify-center rounded-lg border-none text-sm transition-all duration-200"
:class="[ :class="[
'flex h-9 w-9 items-center justify-center rounded-lg border-none text-sm transition-all duration-200',
(isPdf ? pdfScale >= 3 : scale >= 3) (isPdf ? pdfScale >= 3 : scale >= 3)
? 'cursor-not-allowed bg-[#F5F5F5] text-[#CCCCCC] opacity-50' ? 'cursor-not-allowed bg-[#F5F5F5] text-[#CCCCCC] opacity-50'
: 'cursor-pointer bg-[#F5F5F5] text-[#666666] hover:bg-[#E5E5E5] hover:text-[#1956FE] active:scale-95' : 'cursor-pointer bg-[#F5F5F5] text-[#666666] hover:bg-[#E5E5E5] hover:text-[#1956FE] active:scale-95',
]" ]"
@click="handleZoomIn" @click="handleZoomIn"
> >
...@@ -361,11 +473,11 @@ const handlePdfWheel = (event) => { ...@@ -361,11 +473,11 @@ const handlePdfWheel = (event) => {
<button <button
v-if="canScale" v-if="canScale"
:disabled="isPdf ? pdfScale <= 0.5 : scale <= 0.5" :disabled="isPdf ? pdfScale <= 0.5 : scale <= 0.5"
class="flex h-9 w-9 items-center justify-center rounded-lg border-none text-sm transition-all duration-200"
:class="[ :class="[
'flex h-9 w-9 items-center justify-center rounded-lg border-none text-sm transition-all duration-200',
(isPdf ? pdfScale <= 0.5 : scale <= 0.5) (isPdf ? pdfScale <= 0.5 : scale <= 0.5)
? 'cursor-not-allowed bg-[#F5F5F5] text-[#CCCCCC] opacity-50' ? 'cursor-not-allowed bg-[#F5F5F5] text-[#CCCCCC] opacity-50'
: 'cursor-pointer bg-[#F5F5F5] text-[#666666] hover:bg-[#E5E5E5] hover:text-[#1956FE] active:scale-95' : 'cursor-pointer bg-[#F5F5F5] text-[#666666] hover:bg-[#E5E5E5] hover:text-[#1956FE] active:scale-95',
]" ]"
@click="handleZoomOut" @click="handleZoomOut"
> >
...@@ -387,8 +499,20 @@ const handlePdfWheel = (event) => { ...@@ -387,8 +499,20 @@ const handlePdfWheel = (event) => {
class="flex h-9 w-9 cursor-pointer items-center justify-center rounded-lg border-none bg-[#F5F5F5] text-[#666666] transition-all duration-200 hover:bg-[#E5E5E5] hover:text-[#1956FE] active:scale-95" class="flex h-9 w-9 cursor-pointer items-center justify-center rounded-lg border-none bg-[#F5F5F5] text-[#666666] transition-all duration-200 hover:bg-[#E5E5E5] hover:text-[#1956FE] active:scale-95"
@click="handleFit" @click="handleFit"
> >
<svg class="h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor"> <svg
<rect x="3" y="3" width="18" height="18" rx="2" stroke-width="2" /> class="h-4 w-4"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
>
<rect
x="3"
y="3"
width="18"
height="18"
rx="2"
stroke-width="2"
/>
<path d="M9 3v18M15 3v18M3 9h18M3 15h18" stroke-width="2" /> <path d="M9 3v18M15 3v18M3 9h18M3 15h18" stroke-width="2" />
</svg> </svg>
</button> </button>
...@@ -414,7 +538,7 @@ const handlePdfWheel = (event) => { ...@@ -414,7 +538,7 @@ const handlePdfWheel = (event) => {
:deep(.preview-material-dialog) { :deep(.preview-material-dialog) {
border-radius: 12px; border-radius: 12px;
overflow: hidden; overflow: hidden;
background: #E5E5E5; background: #e5e5e5;
} }
:deep(.preview-material-dialog .el-dialog__header) { :deep(.preview-material-dialog .el-dialog__header) {
...@@ -441,4 +565,3 @@ const handlePdfWheel = (event) => { ...@@ -441,4 +565,3 @@ const handlePdfWheel = (event) => {
justify-content: flex-start; justify-content: flex-start;
} }
</style> </style>
...@@ -311,7 +311,7 @@ const handleFileChange = async (file) => { ...@@ -311,7 +311,7 @@ const handleFileChange = async (file) => {
validation: { validation: {
allowedTypes: ['application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'], allowedTypes: ['application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
allowedExtensions: ['pdf', 'doc', 'docx'], allowedExtensions: ['pdf', 'doc', 'docx'],
maxSize: 10 * 1024 * 1024, // 10MB maxSize: 10 * 1024 * 1024, // 50MB
errorMessage: '文件格式错误,仅支持 PDF、Word 格式', errorMessage: '文件格式错误,仅支持 PDF、Word 格式',
}, },
onSuccess: (url) => { onSuccess: (url) => {
...@@ -538,11 +538,13 @@ const cancel = () => { ...@@ -538,11 +538,13 @@ const cancel = () => {
<img src="/images/icon-upload.png" alt="upload-file" class="w-[16px] h-[16px] mr-[4px]"> <span>选择文件</span> <img src="/images/icon-upload.png" alt="upload-file" class="w-[16px] h-[16px] mr-[4px]"> <span>选择文件</span>
</div> </div>
</el-upload> </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"> <div v-if="fileInfo.name" class="mt-2 flex items-center gap-2">
<el-icon class="text-[#409eff]"><Document /></el-icon> <div class="flex items-center gap-2 w-[376px] bg-[#F5F7FA] px-[10px] rounded-[4px]">
<span class="text-sm text-[#606266]">{{ fileInfo.name }}</span> <el-icon class="text-[#9BA3AD]"><Document /></el-icon>
<span class="text-[12px] w-[376px] text-[#606266]">{{ fileInfo.name }}</span>
</div>
<el-button <el-button
type="danger" type="danger"
link link
...@@ -550,7 +552,7 @@ const cancel = () => { ...@@ -550,7 +552,7 @@ const cancel = () => {
@click="removeFile" @click="removeFile"
class="ml-2" class="ml-2"
> >
<el-icon><Delete /></el-icon> <el-icon class="text-[#9BA3AD]"><Delete /></el-icon>
</el-button> </el-button>
</div> </div>
</div> </div>
...@@ -610,7 +612,7 @@ const cancel = () => { ...@@ -610,7 +612,7 @@ const cancel = () => {
<style scoped lang="scss"> <style scoped lang="scss">
/* 覆盖 Element Plus 一些默认样式以更贴合设计图 */ /* 覆盖 Element Plus 一些默认样式以更贴合设计图 */
:deep(.el-form-item__label) { :deep(.el-form-item__label) {
font-weight: 500; font-weight: normal;
color: #565C66; color: #565C66;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<CustomHeaderTitle title="智能体概况"/> <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"> <div class="flex items-center">
<img src="/images/icon-agentic-practice.png" class="h-[32px] w-[32px] mr-[12px] rounded-full bg-red-200" /> <img src="/images/icon-agentic-practice.png" class="h-[32px] w-[32px] mr-[12px] rounded-full bg-red-200" />
<div> <div>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<CustomHeaderTitle title="智能体概况"/> <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"> <div class="flex items-center">
<img src="/images/icon-agentic-quality.png" class="h-[32px] w-[32px] mr-[12px] rounded-full bg-red-200" /> <img src="/images/icon-agentic-quality.png" class="h-[32px] w-[32px] mr-[12px] rounded-full bg-red-200" />
<div> <div>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<!-- 标题头 --> <!-- 标题头 -->
<CustomHeaderTitle title="智能体概况"/> <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"> <div class="flex items-center">
<img src="/images/icon-agentic-replay.png" class="h-[32px] w-[32px] mr-[12px] rounded-full bg-red-200" /> <img src="/images/icon-agentic-replay.png" class="h-[32px] w-[32px] mr-[12px] rounded-full bg-red-200" />
<div> <div>
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
:placeholder="isEditing ? '请输入复盘提示词模板' : ''" :placeholder="isEditing ? '请输入复盘提示词模板' : ''"
:autosize="{ minRows: 2, maxRows: 4 }" :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"> <div class="btn-group flex items-center gap-[12px] mt-[32px]" v-if="isEditing">
<el-button type="primary" @click="updatePromptTemplateList">保存</el-button> <el-button type="primary" @click="updatePromptTemplateList">保存</el-button>
<!-- <el-button @click="toggleEdit">取消</el-button> --> <!-- <el-button @click="toggleEdit">取消</el-button> -->
......
<template>
<div class="min-h-screen bg-white text-gray-800 font-sans pl-[24px]">
<div class="max-w-7xl mx-auto space-y-10">
<!-- ================= 1. 智能体概况 ================= -->
<section>
<!-- 标题头 -->
<CustomHeaderTitle title="智能体概况"/>
<!-- 卡片内容 -->
<div class="rounded-lg p-6 shadow-[0_4px_12px_0_#525b6629] transition-shadow">
<div class="flex items-center">
<img src="/images/icon-agentic-train.png" class="h-[32px] w-[32px] mr-[12px] rounded-full bg-red-200" />
<div>
<p class="text-[14px] font-medium text-[#2F3133]">培训智能体</p>
<p class="text-[12px] text-[#969AA3] font-normal mt-[4px]">员工产品知识培训</p>
</div>
</div>
<!-- 文本内容 -->
<p class="text-[14px] text-[#565C66] leading-relaxed max-w-4xl mt-[12px]">
培训智能体是一个基于AI的闭环式学习系统,专为销售人员设计。它通过知识结构化处理、个性化建模、精准推送、互动巩固和进度可视化,打造完整的学习成长链路,帮助销售快速掌握产品知识、谈判话术和销售技巧,提升成交能力。
</p>
</div>
</section>
<!-- ================= 2. 工作流程 ================= -->
<section>
<CustomHeaderTitle title="闭环式学习全链路"/>
<CustomWorkFlow :workflowSteps="workflowSteps" />
</section>
<!-- ================= 4. 核心功能 ================= -->
<section class="mt-[48px]">
<CustomHeaderTitle title="核心功能"/>
<CustomCardList :source="'train'" :data="coreFunctions" />
</section>
<section>
<CustomHeaderTitle title="培训计划管理"/>
<!-- 表格工具栏 -->
<div class="flex justify-end items-center mb-4 bg-white">
<el-button type="primary" :icon="Plus" @click="openDialog('create','template')">创建培训计划</el-button>
</div>
<!-- 模板表格 -->
<el-table
:data="tableData"
style="width: 100%"
:header-cell-style="{ background: '#f5f7fa', color: '#606266', fontWeight: '500' }"
class="custom-table mb-4"
>
<el-table-column prop="targetDeptName" label="面向部门" />
<el-table-column prop="knowledge" label="配置知识" />
<el-table-column prop="learningObjectivePrompt" label="学习目标" />
<el-table-column prop="proactiveContactEnabled" label="主动联系" >
<template #default="{ row }">
<div class="w-[28px] h-[24px] text-[#00A870] text-[12px] bg-[#E8F8F2] rounded-[3px] text-center items-center justify-center" v-if="row.proactiveContactEnabled">是</div>
<div class="w-[28px] h-[24px] text-[#777C85] text-[12px] bg-[#F0F2F5] rounded-[3px] text-center items-center justify-center" v-else>否</div>
</template>
</el-table-column>
<el-table-column prop="createdDate" label="创建时间" />
<el-table-column label="操作" width="100">
<template #default="{ row }">
<!-- <el-button link type="primary" @click="openDialog('edit', row)">编辑</el-button>
<el-button link type="primary" @click="deleteItem(row.id, row)">删除</el-button> -->
<span class="text-[#1956FE] cursor-pointer" @click="openDialog('edit', row)">编辑</span>
<span class="text-[#1956FE] cursor-pointer ml-[10px]" @click="deleteItem(row.id, row)">删除</span>
</template>
</el-table-column>
<template #empty>
<div class="flex flex-col items-center justify-center py-12">
<img
src="/images/icon-empty-list.png"
alt="暂无数据"
class="w-[120px] h-[76px] opacity-80"
/>
<span class="text-[14px] text-[#9CA0A8] font-normal">暂无数据</span>
</div>
</template>
</el-table>
<!-- 分页 -->
<div class="flex justify-between items-center text-gray-500 text-sm">
<span>共 {{ pageParams.total }} 项数据</span>
<el-pagination
v-model:current-page="pageParams.currentPage"
v-model:page-size="pageParams.pageSize"
:page-sizes="[10, 20, 30]"
layout="sizes, prev, pager, next, slot, jumper"
:total="pageParams.total"
background
@size-change="getTrainingPlanList"
@current-change="getTrainingPlanList"
>
<template #default>
<span class="ml-2">页</span>
</template>
</el-pagination>
</div>
</section>
</div>
</div>
<TrainDialog ref="trainDialogRef" @refresh="getTrainingPlanList" />
</template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, computed, onMounted } from 'vue'; import { computed, onMounted, reactive, ref } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import {
deleteTrainingPlan,
ftrainingPlanDetail,
trainingPlanList,
} from '@/api/agentic';
import { getImageUrl } from '@/utils/assets'; import { getImageUrl } from '@/utils/assets';
import TrainDialog from './TrainDialog.vue';
import { trainingPlanList, deleteTrainingPlan, ftrainingPlanDetail } from '@/api/agentic';
import { Plus } from '@element-plus/icons-vue'; import { Plus } from '@element-plus/icons-vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import TrainDialog from './TrainDialog.vue';
// 表格数据 // 表格数据
const tableData = ref<any[]>([]); const tableData = ref<any[]>([]);
const pageParams = reactive({ const pageParams = reactive({
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
total: 0 total: 0,
}); });
// 1. 工作流程数据 // 1. 工作流程数据
const workflowSteps = [ const workflowSteps = [
...@@ -123,57 +24,69 @@ const workflowSteps = [ ...@@ -123,57 +24,69 @@ const workflowSteps = [
title: '「前置准备」知识加工与个性化建模', title: '「前置准备」知识加工与个性化建模',
desc: [ desc: [
'知识结构化处理:将车型配置、报价策略、谈判话术等知识点,转化为 "钩子 + 案例 + 解析" 的营销式内容包', '知识结构化处理:将车型配置、报价策略、谈判话术等知识点,转化为 "钩子 + 案例 + 解析" 的营销式内容包',
'用户画像建模:通过销售历史交互数据、学习偏好反馈、理解习惯,构建个性化学习标签;结合成长路径,生成适配的阶段性学习计划' '用户画像建模:通过销售历史交互数据、学习偏好反馈、理解习惯,构建个性化学习标签;结合成长路径,生成适配的阶段性学习计划',
] ],
}, },
{ {
title: '场景化练习与举一反三', title: '场景化练习与举一反三',
desc: [ desc: [
'避免 "学用脱节",确保知识能落地到实战场景', '避免 "学用脱节",确保知识能落地到实战场景',
'实现主动触发练习、模拟真实销售场景、提供个性化优化建议和拓展同类场景引导迁移' '实现主动触发练习、模拟真实销售场景、提供个性化优化建议和拓展同类场景引导迁移',
] ],
}, },
{ {
title: '学习全记录与记忆', title: '学习全记录与记忆',
desc: [ desc: [
'实现 "持续跟踪学习轨迹",为个性化迭代提供数据支撑', '实现 "持续跟踪学习轨迹",为个性化迭代提供数据支撑',
'包括自动记录学习行为、记忆用户偏好与理解习惯、动态更新个人学习档案' '包括自动记录学习行为、记忆用户偏好与理解习惯、动态更新个人学习档案',
] ],
}, },
{ {
title: '知识图谱学习进度可视化', title: '知识图谱学习进度可视化',
desc: [ desc: [
'让销售与管理者清晰掌握学习成效,明确提升方向', '让销售与管理者清晰掌握学习成效,明确提升方向',
'包括基于知识图谱展示各模块掌握进度、生成阶段性进度报告、自动标注薄弱环节并关联补充学习内容' '包括基于知识图谱展示各模块掌握进度、生成阶段性进度报告、自动标注薄弱环节并关联补充学习内容',
] ],
} },
]; ];
const coreFunctions = [ const coreFunctions = [
{ {
name: '个性化内容加工与推送', name: '个性化内容加工与推送',
iconUrl: '/icon-agentic-core11.png', iconUrl: '/icon-agentic-core11.png',
desc: ['解决 "知识推送同质化、接收效率低" 痛点','实现营销式内容包装、多形态内容适配、碎片化定时推送和贴合成长路径的计划匹配'] desc: [
'解决 "知识推送同质化、接收效率低" 痛点',
'实现营销式内容包装、多形态内容适配、碎片化定时推送和贴合成长路径的计划匹配',
],
}, },
{ {
name: '场景化练习与举一反三', name: '场景化练习与举一反三',
iconUrl: '/icon-agentic-core12.png', iconUrl: '/icon-agentic-core12.png',
desc: ['避免 "学用脱节",确保知识能落地到实战场景','实现主动触发练习、模拟真实销售场景、提供个性化优化建议和拓展同类场景引导迁移'] desc: [
'避免 "学用脱节",确保知识能落地到实战场景',
'实现主动触发练习、模拟真实销售场景、提供个性化优化建议和拓展同类场景引导迁移',
],
}, },
{ {
name: '学习全记录与记忆', name: '学习全记录与记忆',
iconUrl: '/icon-agentic-core13.png', iconUrl: '/icon-agentic-core13.png',
desc: ['实现 "持续跟踪学习轨迹"实现 "持续跟踪学习轨迹",为个性化迭代提供数据支撑','包括自动记录学习行为、记忆用户偏好与理解习惯、动态更新个人学习档案'] desc: [
'实现 "持续跟踪学习轨迹"实现 "持续跟踪学习轨迹",为个性化迭代提供数据支撑',
'包括自动记录学习行为、记忆用户偏好与理解习惯、动态更新个人学习档案',
],
}, },
{ {
name: '知识图谱学习进度可视化', name: '知识图谱学习进度可视化',
iconUrl: '/icon-agentic-core14.png', iconUrl: '/icon-agentic-core14.png',
desc: ['让销售与管理者清晰掌握学习成效,明确提升方向','包括基于知识图谱展示各模块掌握进度、生成阶段性进度报告、自动标注薄弱环节并关联补充学习内容'] desc: [
} '让销售与管理者清晰掌握学习成效,明确提升方向',
'包括基于知识图谱展示各模块掌握进度、生成阶段性进度报告、自动标注薄弱环节并关联补充学习内容',
],
},
]; ];
const getTrainingPlanList = async () => { const getTrainingPlanList = async () => {
try { try {
const res = await trainingPlanList(pageParams); const res = await trainingPlanList(pageParams);
let { records, current, size, total } = res; const { records, current, size, total } = res;
tableData.value = records || []; tableData.value = records || [];
pageParams.total = total || 0; pageParams.total = total || 0;
pageParams.currentPage = current || 1; pageParams.currentPage = current || 1;
...@@ -182,11 +95,11 @@ const getTrainingPlanList = async () => { ...@@ -182,11 +95,11 @@ const getTrainingPlanList = async () => {
console.error('获取培训计划列表失败:', error); console.error('获取培训计划列表失败:', error);
ElMessage.error('获取培训计划列表失败,请稍后重试'); ElMessage.error('获取培训计划列表失败,请稍后重试');
} }
} };
const deleteItem = async (id: number, row: any) => { const deleteItem = async (id: number, row: any) => {
const planName = row.targetDeptName || '该培训计划'; const planName = row.targetDeptName || '该培训计划';
try { try {
await ElMessageBox.confirm( await ElMessageBox.confirm(
`确定要删除培训计划【${planName}】吗?`, `确定要删除培训计划【${planName}】吗?`,
...@@ -197,11 +110,11 @@ const deleteItem = async (id: number, row: any) => { ...@@ -197,11 +110,11 @@ const deleteItem = async (id: number, row: any) => {
type: 'warning', type: 'warning',
customClass: 'delete-confirm-dialog', customClass: 'delete-confirm-dialog',
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
} },
); );
// 用户确认后执行删除 // 用户确认后执行删除
await deleteTrainingPlan({ 'id': id }); await deleteTrainingPlan({ id });
ElMessage.success('删除培训计划成功'); ElMessage.success('删除培训计划成功');
getTrainingPlanList(); // 刷新列表 getTrainingPlanList(); // 刷新列表
} catch (error: any) { } catch (error: any) {
...@@ -210,7 +123,7 @@ const deleteItem = async (id: number, row: any) => { ...@@ -210,7 +123,7 @@ const deleteItem = async (id: number, row: any) => {
console.error('删除培训计划失败:', error); console.error('删除培训计划失败:', error);
} }
} }
} };
const trainDialogRef = ref<InstanceType<typeof TrainDialog>>(); const trainDialogRef = ref<InstanceType<typeof TrainDialog>>();
const openDialog = async (type: 'create' | 'edit', row: any) => { const openDialog = async (type: 'create' | 'edit', row: any) => {
// console.log("openDialog", toRaw(row)); // console.log("openDialog", toRaw(row));
...@@ -218,10 +131,10 @@ const openDialog = async (type: 'create' | 'edit', row: any) => { ...@@ -218,10 +131,10 @@ const openDialog = async (type: 'create' | 'edit', row: any) => {
if (type === 'edit') { if (type === 'edit') {
try { try {
const res = await ftrainingPlanDetail({ planId: row.id }); const res = await ftrainingPlanDetail({ planId: row.id });
console.log("ftrainingPlanDetail", res); console.log('ftrainingPlanDetail', res);
// 将详情数据传递给弹窗 // 将详情数据传递给弹窗
trainDialogRef.value.openDialog(type, res || row); trainDialogRef.value.openDialog(type, res || row);
} catch (error) { } catch {
ElMessage.error('获取培训计划详情失败,请稍后重试'); ElMessage.error('获取培训计划详情失败,请稍后重试');
// 如果获取详情失败,使用原始行数据 // 如果获取详情失败,使用原始行数据
trainDialogRef.value.openDialog(type, row); trainDialogRef.value.openDialog(type, row);
...@@ -232,20 +145,172 @@ const openDialog = async (type: 'create' | 'edit', row: any) => { ...@@ -232,20 +145,172 @@ const openDialog = async (type: 'create' | 'edit', row: any) => {
} else { } else {
console.error('trainDialogRef 未正确初始化'); console.error('trainDialogRef 未正确初始化');
} }
} };
onMounted(() => { onMounted(() => {
getTrainingPlanList(); getTrainingPlanList();
}) });
// 处理核心功能数据,确保图片 URL 使用子应用自己的域名 // 处理核心功能数据,确保图片 URL 使用子应用自己的域名
const processedCoreFunctions = computed(() => { const processedCoreFunctions = computed(() => {
console.log('[AgenticTrain] processedCoreFunctions', processedCoreFunctions); console.log('[AgenticTrain] processedCoreFunctions', processedCoreFunctions);
return coreFunctions.map(item => ({ return coreFunctions.map((item) => ({
...item, ...item,
iconUrl: getImageUrl(item.iconUrl) iconUrl: getImageUrl(item.iconUrl),
})) }));
}) });
</script> </script>
<template>
<div class="min-h-screen bg-white pl-[24px] font-sans text-gray-800">
<div class="mx-auto max-w-7xl space-y-10">
<!-- ================= 1. 智能体概况 ================= -->
<section>
<!-- 标题头 -->
<CustomHeaderTitle title="智能体概况" />
<!-- 卡片内容 -->
<div
class="rounded-[8px] p-6 shadow-[0_4px_12px_0_#525b6629] transition-shadow"
>
<div class="flex items-center">
<img
src="/images/icon-agentic-train.png"
class="mr-[12px] h-[32px] w-[32px] rounded-full bg-red-200"
/>
<div>
<p class="text-[14px] font-medium text-[#2F3133]">培训智能体</p>
<p class="mt-[4px] text-[12px] font-normal text-[#969AA3]">
员工产品知识培训
</p>
</div>
</div>
<!-- 文本内容 -->
<p
class="mt-[12px] max-w-4xl text-[14px] leading-relaxed text-[#565C66]"
>
培训智能体是一个基于AI的闭环式学习系统,专为销售人员设计。它通过知识结构化处理、个性化建模、精准推送、互动巩固和进度可视化,打造完整的学习成长链路,帮助销售快速掌握产品知识、谈判话术和销售技巧,提升成交能力。
</p>
</div>
</section>
<!-- ================= 2. 工作流程 ================= -->
<section>
<CustomHeaderTitle title="闭环式学习全链路" />
<CustomWorkFlow :workflow-steps="workflowSteps" />
</section>
<!-- ================= 4. 核心功能 ================= -->
<section class="mt-[48px]">
<CustomHeaderTitle title="核心功能" />
<CustomCardList source="train" :data="coreFunctions" />
</section>
<section>
<CustomHeaderTitle title="培训计划管理" />
<!-- 表格工具栏 -->
<div class="mb-4 flex items-center justify-end bg-white">
<el-button
type="primary"
:icon="Plus"
@click="openDialog('create', 'template')"
>
创建培训计划
</el-button>
</div>
<!-- 模板表格 -->
<el-table
:data="tableData"
style="width: 100%"
:header-cell-style="{
background: '#f5f7fa',
color: '#606266',
fontWeight: '500',
}"
class="custom-table mb-4"
>
<el-table-column prop="targetDeptName" label="面向部门" />
<el-table-column prop="knowledge" label="配置知识" />
<el-table-column prop="learningObjectivePrompt" label="学习目标">
<template #default="{ row }">
<el-tooltip
:content="row.learningObjectivePrompt"
placement="top"
effect="light"
popper-class="train-tooltip"
>
<span class="line-clamp-2 overflow-hidden text-ellipsis">{{
row.learningObjectivePrompt
}}</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column prop="proactiveContactEnabled" label="主动联系">
<template #default="{ row }">
<div
class="h-[24px] w-[28px] items-center justify-center rounded-[3px] bg-[#E8F8F2] text-center text-[12px] text-[#00A870]"
v-if="row.proactiveContactEnabled"
>
是
</div>
<div
class="h-[24px] w-[28px] items-center justify-center rounded-[3px] bg-[#F0F2F5] text-center text-[12px] text-[#777C85]"
v-else
>
否
</div>
</template>
</el-table-column>
<el-table-column prop="createdDate" label="创建时间" />
<el-table-column label="操作" width="100">
<template #default="{ row }">
<!-- <el-button link type="primary" @click="openDialog('edit', row)">编辑</el-button>
<el-button link type="primary" @click="deleteItem(row.id, row)">删除</el-button> -->
<span
class="cursor-pointer text-[#1956FE]"
@click="openDialog('edit', row)"
>编辑</span>
<span
class="ml-[10px] cursor-pointer text-[#1956FE]"
@click="deleteItem(row.id, row)"
>删除</span>
</template>
</el-table-column>
<template #empty>
<div class="flex flex-col items-center justify-center py-12">
<img
src="/images/icon-empty-list.png"
alt="暂无数据"
class="h-[76px] w-[120px] opacity-80"
/>
<span class="text-[14px] font-normal text-[#9CA0A8]">暂无数据</span>
</div>
</template>
</el-table>
<!-- 分页 -->
<div class="flex items-center justify-between text-sm text-gray-500">
<span>共 {{ pageParams.total }} 项数据</span>
<el-pagination
v-model:current-page="pageParams.currentPage"
v-model:page-size="pageParams.pageSize"
:page-sizes="[10, 20, 30]"
layout="sizes, prev, pager, next, slot, jumper"
:total="pageParams.total"
background
@size-change="getTrainingPlanList"
@current-change="getTrainingPlanList"
>
<template #default>
<span class="ml-2">页</span>
</template>
</el-pagination>
</div>
</section>
</div>
</div>
<TrainDialog ref="trainDialogRef" @refresh="getTrainingPlanList" />
</template>
<style scoped> <style scoped>
/* /*
自定义 Element Plus 样式覆盖 自定义 Element Plus 样式覆盖
...@@ -297,7 +362,7 @@ const processedCoreFunctions = computed(() => { ...@@ -297,7 +362,7 @@ const processedCoreFunctions = computed(() => {
:deep(.delete-confirm-dialog .el-message-box__title) { :deep(.delete-confirm-dialog .el-message-box__title) {
font-size: 16px; font-size: 16px;
font-weight: 600; font-weight: 600;
color: #2F3133; color: #2f3133;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 8px; gap: 8px;
...@@ -305,23 +370,23 @@ const processedCoreFunctions = computed(() => { ...@@ -305,23 +370,23 @@ const processedCoreFunctions = computed(() => {
:deep(.delete-confirm-dialog .el-message-box__status) { :deep(.delete-confirm-dialog .el-message-box__status) {
font-size: 20px; font-size: 20px;
color: #FF7A00 !important; color: #ff7a00 !important;
} }
:deep(.delete-confirm-dialog .el-message-box__status.el-icon) { :deep(.delete-confirm-dialog .el-message-box__status.el-icon) {
color: #FF7A00 !important; color: #ff7a00 !important;
} }
:deep(.delete-confirm-dialog .el-message-box__status svg) { :deep(.delete-confirm-dialog .el-message-box__status svg) {
color: #FF7A00 !important; color: #ff7a00 !important;
fill: #FF7A00 !important; fill: #ff7a00 !important;
} }
:deep(.delete-confirm-dialog .el-message-box__message) { :deep(.delete-confirm-dialog .el-message-box__message) {
padding: 0; padding: 0;
margin: 0; margin: 0;
font-size: 14px; font-size: 14px;
color: #2F3133; color: #2f3133;
line-height: 1.5; line-height: 1.5;
} }
...@@ -336,16 +401,16 @@ const processedCoreFunctions = computed(() => { ...@@ -336,16 +401,16 @@ const processedCoreFunctions = computed(() => {
} }
:deep(.delete-confirm-dialog .el-button--default) { :deep(.delete-confirm-dialog .el-button--default) {
background-color: #F5F5F5; background-color: #f5f5f5;
border-color: #F5F5F5; border-color: #f5f5f5;
color: #2F3133; color: #2f3133;
padding: 8px 16px; padding: 8px 16px;
font-size: 14px; font-size: 14px;
} }
:deep(.delete-confirm-dialog .el-button--default:hover) { :deep(.delete-confirm-dialog .el-button--default:hover) {
background-color: #E8E8E8; background-color: #e8e8e8;
border-color: #E8E8E8; border-color: #e8e8e8;
} }
:deep(.delete-confirm-dialog .el-button--primary) { :deep(.delete-confirm-dialog .el-button--primary) {
...@@ -362,7 +427,16 @@ const processedCoreFunctions = computed(() => { ...@@ -362,7 +427,16 @@ const processedCoreFunctions = computed(() => {
} }
:deep(.el-pagination .el-pager li.is-active) { :deep(.el-pagination .el-pager li.is-active) {
background: #d2e2ff !important; background: #d2e2ff !important;
border: 1px solid #8BAEFE !important; border: 1px solid #8baefe !important;
color: #1956FE !important; color: #1956fe !important;
}
</style>
<!-- 全局样式:用于 tooltip popper(渲染在 body 下,不受 scoped 限制) -->
<style>
.train-tooltip {
max-width: 568px;
box-shadow: 0 4px 12px 0 #515b664d;
font-size: 14px;
} }
</style> </style>
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<!-- 5. 智能体主动联系 --> <!-- 5. 智能体主动联系 -->
<el-form-item label="学员无应答时,智能体是否主动联系" prop="proactiveContactEnabled"> <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="true">是</el-radio>
<el-radio :label="false">否</el-radio> <el-radio :label="false">否</el-radio>
</el-radio-group> </el-radio-group>
...@@ -314,4 +314,9 @@ defineExpose({ ...@@ -314,4 +314,9 @@ defineExpose({
:deep(.el-radio__input.is-checked + .el-radio__label) { :deep(.el-radio__input.is-checked + .el-radio__label) {
color: #606266 !important; color: #606266 !important;
} }
/* 缩小 radio-group 中 radio 之间的间距 */
:deep(.compact-radio-group .el-radio) {
margin-right: 24px;
}
</style> </style>
<script setup> <script setup>
import { ref } from 'vue'; import { ref, onMounted, onUnmounted, nextTick, watch } from 'vue';
import { import {
ChatDotRound, ChatDotRound,
...@@ -20,6 +20,87 @@ import AgenticTrain from './components/AgenticTrain.vue'; ...@@ -20,6 +20,87 @@ import AgenticTrain from './components/AgenticTrain.vue';
// 状态 // 状态
const activeMenu = ref(0); 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 = [ const sidebarItems = [
{ {
...@@ -73,8 +154,8 @@ const sidebarItems = [ ...@@ -73,8 +154,8 @@ const sidebarItems = [
<div <div
v-for="(item, index) in sidebarItems" v-for="(item, index) in sidebarItems"
:key="index" :key="index"
@click="activeMenu = index" @click="handleMenuClick(index)"
class="group flex cursor-pointer items-center rounded-xl p-4 transition-all duration-200" class="group flex cursor-pointer items-center rounded-[8px] p-4 transition-all duration-200"
:class="activeMenu === index ? 'bg-[#eef6ff]' : 'hover:bg-gray-50'" :class="activeMenu === index ? 'bg-[#eef6ff]' : 'hover:bg-gray-50'"
> >
<!-- 图标容器 --> <!-- 图标容器 -->
...@@ -90,12 +171,11 @@ const sidebarItems = [ ...@@ -90,12 +171,11 @@ const sidebarItems = [
<!-- 文本 --> <!-- 文本 -->
<div class="flex flex-col"> <div class="flex flex-col">
<span <span
class="mb-0.5 text-base font-medium" class="mb-0.5 text-base font-medium text-[#2F3133]"
:class="activeMenu === index ? 'text-gray-900' : 'text-gray-700'"
> >
{{ item.title }} {{ item.title }}
</span> </span>
<span class="text-[12px] font-light text-gray-400">{{ <span class="text-[12px] text-[#969AA3]">{{
item.desc item.desc
}}</span> }}</span>
</div> </div>
...@@ -104,7 +184,12 @@ const sidebarItems = [ ...@@ -104,7 +184,12 @@ const sidebarItems = [
</aside> </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" /> <AgenticQuality v-if="activeMenu === 0" />
<AgenticPractice v-if="activeMenu === 1" /> <AgenticPractice v-if="activeMenu === 1" />
<AgenticReplay v-if="activeMenu === 2" /> <AgenticReplay v-if="activeMenu === 2" />
......
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
:on-remove="handleFileRemove" :on-remove="handleFileRemove"
> >
<div class="flex flex-col items-center justify-center h-full w-full"> <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> <el-icon class="el-icon--upload !text-4xl !text-gray-400"><UploadFilled /></el-icon>
<div class="el-upload__text text-gray-400"> <div class="el-upload__text text-gray-400 mt-[-8px]">
点击上传 / 拖拽文件到处 点击上传 / 拖拽文件到处
</div> </div>
</div> </div>
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
<div <div
v-for="node in selectedNodes" v-for="node in selectedNodes"
:key="node.id" :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"> <div class="flex items-center gap-2">
<span class="text-[14px] text-[#2F3133] font-normal">{{ getNodeDisplayText(node) }}</span> <span class="text-[14px] text-[#2F3133] font-normal">{{ getNodeDisplayText(node) }}</span>
......
...@@ -290,24 +290,27 @@ const getCardStyle = (type) => { ...@@ -290,24 +290,27 @@ const getCardStyle = (type) => {
const styles = { const styles = {
1: { // 文档 1: { // 文档
cardBg: 'bg-[#f0f9f8]', // 极浅绿背景 cardBg: 'bg-[#f0f9f8]', // 极浅绿背景
cardBgStyle: 'background: linear-gradient(56.9deg, #e6faf7 0%, #f5fffe 28.999999999999996%, #f5fffe 60%, #eefcfb 100%)', // 渐变背景
iconBg: 'bg-[#d5eee6]', // 图标浅绿底 iconBg: 'bg-[#d5eee6]', // 图标浅绿底
iconColor: 'text-[#4bb79d]', // 图标深绿 iconColor: 'text-[#4bb79d]', // 图标深绿
tagColor: 'text-[#4bb79d]', // 标签文字色 tagColor: 'text-[#4bb79d]', // 标签文字色
}, },
2: { // 图片 2: { // 图片
cardBg: 'bg-[#f2f4fc]', // 极浅蓝背景 cardBg: 'bg-[#f2f4fc]', // 极浅蓝背景
cardBgStyle: 'background: linear-gradient(56.9deg, #ebf2ff 0%, #f5f8ff 28.999999999999996%, #f5f8ff 61%, #f0f4ff 100%)', // 渐变背景
iconBg: 'bg-[#dcecff]', iconBg: 'bg-[#dcecff]',
iconColor: 'text-[#6eb0f7]', iconColor: 'text-[#6eb0f7]',
tagColor: 'text-[#6eb0f7]', tagColor: 'text-[#6eb0f7]',
}, },
3: { // 视频 3: { // 视频
cardBg: 'bg-[#f0f8ff]', // 极浅紫背景 cardBg: 'bg-[#f0f8ff]', // 极浅紫背景
cardBgStyle: 'background: linear-gradient(56.9deg, #ebf8ff 0%, #f5fbff 28.999999999999996%, #f5fbff 60%, #f0faff 100%)', // 渐变背景
iconBg: 'bg-[#dbe4fd]', iconBg: 'bg-[#dbe4fd]',
iconColor: 'text-[#738cdd]', iconColor: 'text-[#738cdd]',
tagColor: 'text-[#738cdd]', tagColor: 'text-[#738cdd]',
}, },
4: { // 其他 4: { // 其他
cardBg: 'bg-[#f5f5f5]', // 极浅灰背景 cardBgStyle: 'background: linear-gradient(56.9deg, #e6faf7 0%, #f5fffe 28.999999999999996%, #f5fffe 60%, #eefcfb 100%)', // 渐变背景
iconBg: 'bg-[#e0e0e0]', iconBg: 'bg-[#e0e0e0]',
iconColor: 'text-[#757575]', iconColor: 'text-[#757575]',
tagColor: 'text-[#757575]', tagColor: 'text-[#757575]',
...@@ -653,7 +656,7 @@ onMounted(() => { ...@@ -653,7 +656,7 @@ onMounted(() => {
<h1 class="mb-5 text-lg font-semibold text-gray-800">知识管理</h1> <h1 class="mb-5 text-lg font-semibold text-gray-800">知识管理</h1>
<div class="flex gap-8"> <div class="flex gap-8">
<div <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> </div>
...@@ -668,7 +671,7 @@ onMounted(() => { ...@@ -668,7 +671,7 @@ onMounted(() => {
<div class="flex flex-1 overflow-hidden bg-white p-6"> <div class="flex flex-1 overflow-hidden bg-white p-6">
<!-- 左侧侧边栏 --> <!-- 左侧侧边栏 -->
<aside <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"> <div class="flex items-center justify-between mb-3 flex-shrink-0">
<p class="text-[14px] font-normal text-[#2F3133]"> <p class="text-[14px] font-normal text-[#2F3133]">
...@@ -763,7 +766,7 @@ onMounted(() => { ...@@ -763,7 +766,7 @@ onMounted(() => {
<!-- 右侧内容区 --> <!-- 右侧内容区 -->
<main class="flex flex-1 flex-col overflow-hidden"> <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">
<div class="flex items-center gap-3"> <div class="flex items-center gap-3">
<span class="whitespace-nowrap text-[14px] text-gray-600" <span class="whitespace-nowrap text-[14px] text-gray-600"
...@@ -818,12 +821,13 @@ onMounted(() => { ...@@ -818,12 +821,13 @@ onMounted(() => {
<div class="flex justify-end items-center mb-4 bg-white"> <div class="flex justify-end items-center mb-4 bg-white">
<el-button type="primary" :icon="Upload" @click="handleEditMaterial({})">上传素材</el-button> <el-button type="primary" :icon="Upload" @click="handleEditMaterial({})">上传素材</el-button>
</div> </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 <div
v-for="item in materials" v-for="item in materials"
:key="item.id" :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="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]"> <div class="mb-4 absolute top-[-16px] left-[24px]">
...@@ -833,6 +837,7 @@ onMounted(() => { ...@@ -833,6 +837,7 @@ onMounted(() => {
getCardStyle(item.knowledgeType).iconBg, getCardStyle(item.knowledgeType).iconBg,
getCardStyle(item.knowledgeType).iconColor, 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 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=""> <img v-else-if="item.knowledgeType == 3 || item.knowledgeType === 'video'" src="/images/icon-know-video.png" alt="" srcset="">
...@@ -910,7 +915,7 @@ onMounted(() => { ...@@ -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="text-[14px] text-[#777C85]">共 {{ pagination.total }} 项数据</div>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<el-select <el-select
...@@ -1027,4 +1032,11 @@ onMounted(() => { ...@@ -1027,4 +1032,11 @@ onMounted(() => {
:deep(.el-select-dropdown__item.selected) { :deep(.el-select-dropdown__item.selected) {
color: #1956FE !important; color: #1956FE !important;
} }
/* 素材卡片网格布局:屏幕宽度大于1742px时显示4列 */
@media (min-width: 1742px) {
.materials-grid {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
}
</style> </style>
...@@ -419,7 +419,7 @@ watch( ...@@ -419,7 +419,7 @@ watch(
gap: 8px; gap: 8px;
align-items: center; align-items: center;
width: 228px; width: 228px;
height: 56px; height: 55px;
padding-left: 24px; padding-left: 24px;
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
...@@ -450,6 +450,7 @@ watch( ...@@ -450,6 +450,7 @@ watch(
height: 56px; height: 56px;
padding: 0 24px; padding: 0 24px;
background: #fff; background: #fff;
border-bottom: 1px solid #F2F4F7;
} }
/* 主体区域 */ /* 主体区域 */
......
...@@ -560,12 +560,14 @@ const handleChildClick = (child: MenuItem) => { ...@@ -560,12 +560,14 @@ const handleChildClick = (child: MenuItem) => {
.popover-menu-item:hover { .popover-menu-item:hover {
color: #1956fe; color: #1956fe;
background-color: #f0f4ff; background-color: #f0f4ff;
border-radius: 4px;
} }
.popover-menu-item.active { .popover-menu-item.active {
color: #1956fe; color: #1956fe;
background-color: #e8f0ff; background-color: #e8f0ff;
font-weight: 500; font-weight: 500;
border-radius: 4px;
} }
.popover-menu-title { .popover-menu-title {
......
...@@ -84,7 +84,7 @@ const handleLogin = async () => { ...@@ -84,7 +84,7 @@ const handleLogin = async () => {
// 验证表单 // 验证表单
if (!isFormValid.value) { if (!isFormValid.value) {
if (!loginForm.username.trim()) { if (!loginForm.username.trim()) {
usernameError.value = '请输入用户名'; usernameError.value = '请输入账户';
} }
if (!loginForm.password.trim()) { if (!loginForm.password.trim()) {
passwordError.value = '请输入密码'; passwordError.value = '请输入密码';
...@@ -115,7 +115,7 @@ const handleLogin = async () => { ...@@ -115,7 +115,7 @@ const handleLogin = async () => {
if (code == 0) { if (code == 0) {
// 登录成功,处理记住密码逻辑 // 登录成功,处理记住密码逻辑
if (loginForm.rememberMe) { if (loginForm.rememberMe) {
// 保存用户名和密码(使用 base64 简单编码) // 保存账户和密码(使用 base64 简单编码)
localStorage.setItem('rememberedUsername', loginForm.username); localStorage.setItem('rememberedUsername', loginForm.username);
localStorage.setItem('rememberedPassword', btoa(loginForm.password)); localStorage.setItem('rememberedPassword', btoa(loginForm.password));
localStorage.setItem('rememberMe', 'true'); localStorage.setItem('rememberMe', 'true');
...@@ -193,7 +193,7 @@ const handleRememberMeChange = () => { ...@@ -193,7 +193,7 @@ const handleRememberMeChange = () => {
if (!loginForm.rememberMe) { if (!loginForm.rememberMe) {
// 取消勾选时,清除保存的密码信息 // 取消勾选时,清除保存的密码信息
const savedUsername = localStorage.getItem('rememberedUsername'); const savedUsername = localStorage.getItem('rememberedUsername');
// 如果当前用户名与保存的用户名一致,清空密码字段 // 如果当前账户与保存的用户名一致,清空密码字段
if (savedUsername === loginForm.username) { if (savedUsername === loginForm.username) {
loginForm.password = ''; loginForm.password = '';
} }
...@@ -560,8 +560,6 @@ onMounted(() => { ...@@ -560,8 +560,6 @@ onMounted(() => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 4px; gap: 4px;
margin-bottom: 4px;
.input-icon { .input-icon {
width: 18px; width: 18px;
height: 18px; height: 18px;
...@@ -798,7 +796,7 @@ onMounted(() => { ...@@ -798,7 +796,7 @@ onMounted(() => {
width: 100% !important; width: 100% !important;
height: $input-height !important; height: $input-height !important;
padding: 0 !important; padding: 0 !important;
margin-top: 28px; margin-top: 20px;
font-size: $font-size-lg !important; font-size: $font-size-lg !important;
font-weight: 600 !important; font-weight: 600 !important;
color: #fff !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!