Commit 96c5deb5 by Lin

feat: 样式对齐/打包配置修改

1 parent 8d7d2cd9
Showing 21 changed files with 165 additions and 65 deletions
<!doctype html> <!doctype html>
<html lang="zh-CN"> <html lang="zh-CN" sstyle="--el-color-primary: #185EFE; --el-color-primary-dark-2: #185EFE; --el-color-primary-light-1: #185EFE;">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
......
{ {
"name": "@venus/venus-agentic-assisant", "name": "@venus/venus-agentic-assisant",
"version": "1.0.0", "version": "1.0.0",
"description": "Vue3 微前端子应用模板,用于与 qiankun 基座集成",
"private": true, "private": true,
"type": "module", "type": "module",
"scripts": { "scripts": {
......
<template> <template>
<div class="card-list w-full flex flex-nowrap justify-between gap-6"> <div class="card-list w-full flex flex-nowrap gap-6">
<div class="card-item h-[182px] w-[202.5px] rounded-[10px] box-border shadow-[0_4px_12px_0_#525b6629]" v-for="(item, index) in data" :key="index"> <div
class="card-item flex-1 min-w-[202.5px] rounded-[10px] box-border shadow-[0_4px_12px_0_#525b6629]"
:style="{ minHeight: cardHeight }"
v-for="(item, index) in data"
:key="index"
>
<img class="rounded-t-[10px]" :src="`https://img02.glsx.com.cn/weapp/resource/venus-agentic/${item.iconUrl}`" alt="background"> <img class="rounded-t-[10px]" :src="`https://img02.glsx.com.cn/weapp/resource/venus-agentic/${item.iconUrl}`" alt="background">
<div class="card-item-bottom h-[102.5px] w-full pl-[16px] pr-[16px]"> <div class="card-item-bottom h-[102.5px] w-full pl-[16px] pr-[16px]">
<p class="text-[#2f3133] text-sm font-medium mb-1 leading-[22px] ">{{ item.name }}</p> <p class="text-[#2f3133] text-[14px] font-medium mb-1 leading-[22px] bg-red-500">{{ item.name }}</p>
<div class="flex justify-between" v-for="value in item.desc"> <div class="flex justify-between" v-for="value in item.desc">
<p class="h-[6px] w-[6px] bg-[#1956FE] rounded-[3px] mt-[6px]"></p> <p class="h-[6px] w-[6px] bg-[#1956FE] rounded-[3px] mt-[12px] mr-1"></p>
<p class="w-[158.5px] text-[#565C66] text-xs leading-[18px]">{{value}}</p> <p class="w-full text-[#565C66] text-[12px] leading-[18px] mt-[6px]">{{value}}</p>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, PropType } from 'vue';
interface DataItem { interface DataItem {
iconUrl: string; iconUrl: string;
name: string; name: string;
...@@ -23,6 +30,17 @@ const props = defineProps({ ...@@ -23,6 +30,17 @@ const props = defineProps({
type: Array as PropType<DataItem[]>, type: Array as PropType<DataItem[]>,
required: true, required: true,
}, },
source: {
type: String as PropType<'train' | 'raplay' | 'other'>,
required: false,
default: 'other',
},
});
const cardHeight = computed(() => {
if (props.source === 'train') return '246px';
if (props.source === 'raplay') return '204px';
return '182px';
}); });
console.log('[CustomCardList] data', props.data); console.log('[CustomCardList] data', props.data);
</script> </script>
/* global css variable */
$primary-color: var(#185EFE);
...@@ -534,7 +534,9 @@ const cancel = () => { ...@@ -534,7 +534,9 @@ const cancel = () => {
:on-change="handleFileChange" :on-change="handleFileChange"
accept=".pdf,.doc,.docx" accept=".pdf,.doc,.docx"
> >
<el-button icon="Upload"> <el-icon><Upload /></el-icon> 选择文件</el-button> <div class="flex items-center justify-center cursor-pointer w-[98px] h-[32px] rounded-[5px] border border-[#E1E3E6] bg-white hover:bg-[#ecf5ff] hover:text-[#1956fe] transition-all duration-200">
<img src="/images/icon-upload.png" alt="upload-file" class="w-[16px] h-[16px] mr-[4px]"> <span>选择文件</span>
</div>
</el-upload> </el-upload>
<div class="mt-[5px] text-xs text-[#909399]">支持pdf, word格式,大小在50M以内</div> <div class="mt-[5px] text-xs text-[#909399]">支持pdf, word格式,大小在50M以内</div>
<!-- 已上传文件显示 --> <!-- 已上传文件显示 -->
...@@ -586,10 +588,10 @@ const cancel = () => { ...@@ -586,10 +588,10 @@ const cancel = () => {
<!-- 底部按钮 --> <!-- 底部按钮 -->
<div class="flex mt-10"> <div class="flex mt-10">
<!-- <el-button type="primary" @click="save" :loading="saving">保存</el-button> <!-- <el-button type="primary" @click="save" :loading="saving">保存</el-button> -->
<el-button @click="cancel">取消</el-button> --> <!-- <el-button @click="cancel">取消</el-button> -->
<div <div
class="w-[60px] h-8 rounded-[5px] border bg-[#185EFE] border-[#8baefe] flex items-center justify-center cursor-pointer text-[#FFFFFF]" class="w-[60px] h-8 rounded-[5px] border bg-[#185EFE] border-[#8baefe] flex items-center justify-center cursor-pointer text-[#FFFFFF] hover:bg-[#79bbff] transition-colors"
@click="save" @click="save"
> >
保存 保存
......
...@@ -348,4 +348,7 @@ const handleCurrentChange = (val) => { ...@@ -348,4 +348,7 @@ const handleCurrentChange = (val) => {
border: 1px solid #8BAEFE !important; border: 1px solid #8BAEFE !important;
color: #1956FE !important; color: #1956FE !important;
} }
.el-select-dropdown__item.selected {
background-color: #1956FE!important;
}
</style> </style>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
</div> </div>
</div> </div>
<!-- 文本内容 --> <!-- 文本内容 -->
<p class="text-[14px] text-[#565C66] leading-relaxed max-w-4xl mt-[12px]"> <p class="text-[14px] text-[#565C66] leading-relaxed mt-[12px]">
对练智能体是一个专业的对话训练助手,能够模拟不同类型的客户角色,帮助销售人员和客服人员提升沟通技巧、产品介绍能力和问题解决能力。通过与智能体的反复练习,员工可以在实际工作中更加从容应对各种客户场景。 对练智能体是一个专业的对话训练助手,能够模拟不同类型的客户角色,帮助销售人员和客服人员提升沟通技巧、产品介绍能力和问题解决能力。通过与智能体的反复练习,员工可以在实际工作中更加从容应对各种客户场景。
</p> </p>
</div> </div>
...@@ -36,13 +36,13 @@ ...@@ -36,13 +36,13 @@
<CustomHeaderTitle title="客户角色类型"/> <CustomHeaderTitle title="客户角色类型"/>
<!-- 卡片 --> <!-- 卡片 -->
<div class="grid grid-cols-3 gap-x-8 gap-y-4"> <div class="grid grid-cols-3 gap-x-8 gap-y-4">
<div class="w-[278px] h-[94px] rounded-[10px] bg-white shadow-[0_4px_12px_0_#525b6629] flex items-start p-[16px]" v-for="(item, index) in roleTypes" :key="index"> <div class="min-w-[278px] h-[94px] rounded-[10px] bg-white shadow-[0_4px_12px_0_#525b6629] flex items-start p-[16px]" v-for="(item, index) in roleTypes" :key="index">
<div class="shrink-0 w-[38px] h-[38px] rounded-lg overflow-hidden mr-[12px] bg-gray-50 flex items-center justify-center"> <div class="shrink-0 w-[38px] h-[38px] rounded-lg overflow-hidden mr-[12px] bg-gray-50 flex items-center justify-center">
<img :src="`https://img02.glsx.com.cn/weapp/resource/venus-agentic/${item.iconUrl}`" alt="头像" class="w-full h-full object-cover" /> <img :src="`https://img02.glsx.com.cn/weapp/resource/venus-agentic/${item.iconUrl}`" alt="头像" class="w-full h-full object-cover" />
</div> </div>
<div class="flex-1 flex flex-col justify-start min-w-0"> <div class="flex-1 flex flex-col justify-start min-w-0">
<p class="text-[#2f3133] text-sm font-medium mb-1 leading-[22px] ">{{item.name}}</p> <p class="text-[#2f3133] text-[14px] font-medium mb-1 leading-[22px] ">{{item.name}}</p>
<p class="text-[#969aa3] text-xs font-normal m-0 leading-[18px] overflow-hidden text-ellipsis line-clamp-2">{{item.desc}}</p> <p class="text-[#969aa3] text-[12px] font-normal m-0 leading-[18px] overflow-hidden text-ellipsis line-clamp-2">{{item.desc}}</p>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -92,8 +92,8 @@ ...@@ -92,8 +92,8 @@
<section> <section>
<CustomHeaderTitle title="质检模板管理"/> <CustomHeaderTitle title="质检模板管理"/>
<!-- 表格工具栏 --> <!-- 表格工具栏 -->
<div class="flex justify-end items-center mb-4 bg-white" @click="openDialog('create','template', {})"> <div class="flex justify-end items-center mb-4 bg-white">
<el-button type="primary" :icon="Plus">创建模版</el-button> <el-button type="primary" :icon="Plus" @click="openDialog('create','template', {})">创建模版</el-button>
</div> </div>
<!-- 模板表格 --> <!-- 模板表格 -->
...@@ -220,7 +220,6 @@ const getTemplateList = async () => { ...@@ -220,7 +220,6 @@ const getTemplateList = async () => {
} }
const deleteItem = async (id: number, type: string, name: string) => { const deleteItem = async (id: number, type: string, name: string) => {
const typeName = type === 'rule' ? '规则' : '模板';
try { try {
await ElMessageBox.confirm( await ElMessageBox.confirm(
...@@ -249,7 +248,6 @@ const deleteItem = async (id: number, type: string, name: string) => { ...@@ -249,7 +248,6 @@ const deleteItem = async (id: number, type: string, name: string) => {
// 用户取消操作时不显示错误提示 // 用户取消操作时不显示错误提示
if (error !== 'cancel') { if (error !== 'cancel') {
console.error('删除数据失败:', error); console.error('删除数据失败:', error);
ElMessage.error(`删除${typeName}失败,请稍后重试`);
} }
} }
} }
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<p class="text-[14px] font-medium text-[#2F3133] ml-[12px]">复盘配置</p> <p class="text-[14px] font-medium text-[#2F3133] ml-[12px]">复盘配置</p>
</div> </div>
<div <div
class="flex items-center justify-center edit-btn w-[68px] h-[28px] rounded-[4px] bg-[#1956FE] cursor-pointer hover:bg-[#0d47d9] transition-colors" class="flex items-center justify-center edit-btn w-[68px] h-[28px] rounded-[4px] bg-[#1956FE] cursor-pointer hover:bg-[#79bbff] transition-colors"
v-if="!isEditing" v-if="!isEditing"
@click="toggleEdit" @click="toggleEdit"
> >
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
maxlength="5000" maxlength="5000"
show-word-limit show-word-limit
:disabled="!isEditing" :disabled="!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-[4px]">提示词将指导AI如何进行对话分析,可根据需求调整分析重点和输出格式</p>
...@@ -67,7 +68,7 @@ ...@@ -67,7 +68,7 @@
<!-- ================= 4. 核心功能 ================= --> <!-- ================= 4. 核心功能 ================= -->
<section class="mt-[48px]"> <section class="mt-[48px]">
<CustomHeaderTitle title="核心功能"/> <CustomHeaderTitle title="核心功能"/>
<CustomCardList :data="coreFunctions" /> <CustomCardList :source="'raplay'" :data="coreFunctions" />
</section> </section>
</div> </div>
...@@ -148,6 +149,10 @@ const getPromptTemplateList = async () => { ...@@ -148,6 +149,10 @@ const getPromptTemplateList = async () => {
textarea.value = res.promptTemplate textarea.value = res.promptTemplate
} }
const updatePromptTemplateList = async () => { const updatePromptTemplateList = async () => {
if (!textarea.value) {
ElMessage.error('内容不能为空')
return
}
const res = await updatePromptTemplate({ id: promptTemplateId.value, promptTemplate: textarea.value }) const res = await updatePromptTemplate({ id: promptTemplateId.value, promptTemplate: textarea.value })
console.log('updatePromptTemplateList:', res) console.log('updatePromptTemplateList:', res)
toggleEdit() toggleEdit()
......
...@@ -32,15 +32,15 @@ ...@@ -32,15 +32,15 @@
<!-- ================= 4. 核心功能 ================= --> <!-- ================= 4. 核心功能 ================= -->
<section class="mt-[48px]"> <section class="mt-[48px]">
<CustomHeaderTitle title="核心功能"/> <CustomHeaderTitle title="核心功能"/>
<CustomCardList :data="coreFunctions" /> <CustomCardList :source="'train'" :data="coreFunctions" />
</section> </section>
<section> <section>
<CustomHeaderTitle title="培训计划管理"/> <CustomHeaderTitle title="培训计划管理"/>
<!-- 表格工具栏 --> <!-- 表格工具栏 -->
<div class="flex justify-end items-center mb-4 bg-white" @click="openDialog('create','template')"> <div class="flex justify-end items-center mb-4 bg-white">
<el-button type="primary" :icon="Plus">创建培训计划</el-button> <el-button type="primary" :icon="Plus" @click="openDialog('create','template')">创建培训计划</el-button>
</div> </div>
<!-- 模板表格 --> <!-- 模板表格 -->
<el-table <el-table
...@@ -112,7 +112,6 @@ import { trainingPlanList, deleteTrainingPlan, ftrainingPlanDetail } from '@/api ...@@ -112,7 +112,6 @@ import { trainingPlanList, deleteTrainingPlan, ftrainingPlanDetail } from '@/api
import { Plus } from '@element-plus/icons-vue'; import { Plus } from '@element-plus/icons-vue';
// 表格数据 // 表格数据
const tableData = ref<any[]>([]); const tableData = ref<any[]>([]);
const pageParams = reactive({ const pageParams = reactive({
currentPage: 1, currentPage: 1,
pageSize: 10, pageSize: 10,
...@@ -128,47 +127,47 @@ const workflowSteps = [ ...@@ -128,47 +127,47 @@ const workflowSteps = [
] ]
}, },
{ {
title: '「精准推送」碎片化 + 场景化触达', title: '场景化练习与举一反三',
desc: [ desc: [
'推送时机匹配:基于学习计划,在销售碎片化时间(如晨会前 10 分钟、客户接待间隙)自动推送知识点', '避免 "学用脱节",确保知识能落地到实战场景',
'内容形态适配:根据销售偏好,推送对应形式内容(短视频、图文解析等),确保接收意愿' '实现主动触发练习、模拟真实销售场景、提供个性化优化建议和拓展同类场景引导迁移'
] ]
}, },
{ {
title: '「互动巩固」练习 + 举一反三验证', title: '学习全记录与记忆',
desc: [ desc: [
'主动发起小练习:知识点推送后,自动触发场景化练习(如模拟客户对话场景)', '实现 "持续跟踪学习轨迹",为个性化迭代提供数据支撑',
'举一反三引导:完成练习后提供优化建议,拓展同类场景,强化知识迁移能力' '包括自动记录学习行为、记忆用户偏好与理解习惯、动态更新个人学习档案'
] ]
}, },
{ {
title: '「记忆与迭代」记忆 + 进度可视化 + 进度可视化生成', title: '知识图谱学习进度可视化',
desc: [ desc: [
'学习记录记忆:自动存储销售的学习时长、练习完成情况、错题记录、偏好调整等数据,形成个人学习档案', '让销售与管理者清晰掌握学习成效,明确提升方向',
'进度生成与反馈:定期基于知识图谱,输出学习进度报告,明确后续学习重点' '包括基于知识图谱展示各模块掌握进度、生成阶段性进度报告、自动标注薄弱环节并关联补充学习内容'
] ]
} }
]; ];
const coreFunctions = [ const coreFunctions = [
{ {
name: '岗位助理配置', name: '个性化内容加工与推送',
iconUrl: '/icon-agentic-core01.png', iconUrl: '/icon-agentic-core11.png',
desc: ['无需复杂配置,可直接与岗位助理系统对接,自动获取相关岗位信息'] desc: ['解决 "知识推送同质化、接收效率低" 痛点','实现营销式内容包装、多形态内容适配、碎片化定时推送和贴合成长路径的计划匹配']
}, },
{ {
name: '智能体编排', name: '场景化练习与举一反三',
iconUrl: '/icon-agentic-core02.png', iconUrl: '/icon-agentic-core12.png',
desc: ['支持与其他智能体协同工作,如培训智能体、质检智能体等,形成完整的训练体系'] desc: ['避免 "学用脱节",确保知识能落地到实战场景','实现主动触发练习、模拟真实销售场景、提供个性化优化建议和拓展同类场景引导迁移']
}, },
{ {
name: '实时反馈', name: '学习全记录与记忆',
iconUrl: '/icon-agentic-core03.png', iconUrl: '/icon-agentic-core13.png',
desc: ['提供即时的对话分析和改进建议,帮助员工快速提升技能'] desc: ['实现 "持续跟踪学习轨迹"实现 "持续跟踪学习轨迹",为个性化迭代提供数据支撑','包括自动记录学习行为、记忆用户偏好与理解习惯、动态更新个人学习档案']
}, },
{ {
name: '学习记录追踪', name: '知识图谱学习进度可视化',
iconUrl: '/icon-agentic-core04.png', iconUrl: '/icon-agentic-core14.png',
desc: ['记录员工的训练历史和进步情况,生成学习报告和能力评估'] desc: ['让销售与管理者清晰掌握学习成效,明确提升方向','包括基于知识图谱展示各模块掌握进度、生成阶段性进度报告、自动标注薄弱环节并关联补充学习内容']
} }
]; ];
const getTrainingPlanList = async () => { const getTrainingPlanList = async () => {
...@@ -209,7 +208,6 @@ const deleteItem = async (id: number, row: any) => { ...@@ -209,7 +208,6 @@ const deleteItem = async (id: number, row: any) => {
// 用户取消操作时不显示错误提示 // 用户取消操作时不显示错误提示
if (error !== 'cancel') { if (error !== 'cancel') {
console.error('删除培训计划失败:', error); console.error('删除培训计划失败:', error);
ElMessage.error('删除培训计划失败,请稍后重试');
} }
} }
} }
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<el-input <el-input
v-model="formData.description" v-model="formData.description"
type="textarea" type="textarea"
:placeholder="'请输入' + screenTitle + '详细描述,支持中英文数字'" :placeholder="`请输入${screenType==='rule'?'规则详细描述':'模版说明'},支持中英文数字`"
maxlength="500" maxlength="500"
show-word-limit show-word-limit
:rows="4" :rows="4"
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<!-- <el-button @click="dialogVisible = false">取 消</el-button> --> <!-- <el-button @click="dialogVisible = false">取 消</el-button> -->
<div class="w-[60px] h-[32px] mr-[8px] rounded-[5px] border border-[#E1E3E6] bg-white flex items-center justify-center cursor-pointer text-[#666666] text-[14px] hover:bg-[#ecf5ff] hover:text-[#1956fe] transition-all duration-200" @click="dialogVisible = false">取 消</div> <div class="w-[60px] h-[32px] mr-[8px] rounded-[5px] border border-[#E1E3E6] bg-white flex items-center justify-center cursor-pointer text-[#666666] text-[14px] hover:bg-[#ecf5ff] hover:text-[#1956fe] transition-all duration-200" @click="dialogVisible = false">取消</div>
<el-button type="primary" @click="submitForm"> <el-button type="primary" @click="submitForm">
{{ mode === 'create' ? '创建' + screenTitle : '保存' + screenTitle }} {{ mode === 'create' ? '创建' + screenTitle : '保存' + screenTitle }}
</el-button> </el-button>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
:options="departmentOptions" :options="departmentOptions"
placeholder="请选择部门" placeholder="请选择部门"
clearable clearable
class="w-[100%]" class="w-[376px]"
@change="handleCascaderChange" @change="handleCascaderChange"
:props="{ value: 'departmentId', label: 'departmentName', children: 'children' }" :props="{ value: 'departmentId', label: 'departmentName', children: 'children' }"
/> />
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
collapse-tags collapse-tags
collapse-tags-tooltip collapse-tags-tooltip
placeholder="请选择学习内容" placeholder="请选择学习内容"
style="width: 100%" style="width: 376px"
node-key="id" node-key="id"
/> />
</el-form-item> </el-form-item>
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
collapse-tags collapse-tags
collapse-tags-tooltip collapse-tags-tooltip
placeholder="请选择学习内容" placeholder="请选择学习内容"
style="width: 100%" style="width: 376px"
node-key="id" node-key="id"
/> />
</el-form-item> </el-form-item>
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
<template #footer> <template #footer>
<div class="dialog-footer flex justify-end"> <div class="dialog-footer flex justify-end">
<!-- <el-button @click="visible = false">取 消</el-button> --> <!-- <el-button @click="visible = false">取 消</el-button> -->
<div class="w-[60px] h-[32px] mr-[8px] rounded-[5px] border border-[#E1E3E6] bg-white flex items-center justify-center cursor-pointer text-[#666666] text-[14px] hover:bg-[#ecf5ff] hover:text-[#1956fe] transition-all duration-200" @click="visible = false">取 消</div> <div class="w-[60px] h-[32px] mr-[8px] rounded-[5px] border border-[#E1E3E6] bg-white flex items-center justify-center cursor-pointer text-[#666666] text-[14px] hover:bg-[#ecf5ff] hover:text-[#1956fe] transition-all duration-200" @click="visible = false">取消</div>
<el-button type="primary" @click="submitForm" :loading="loading"> <el-button type="primary" @click="submitForm" :loading="loading">
{{ mode === 'create' ? '创建计划' : '保存计划' }} {{ mode === 'create' ? '创建计划' : '保存计划' }}
</el-button> </el-button>
......
...@@ -95,7 +95,7 @@ const sidebarItems = [ ...@@ -95,7 +95,7 @@ const sidebarItems = [
> >
{{ item.title }} {{ item.title }}
</span> </span>
<span class="text-xs font-light text-gray-400">{{ <span class="text-[12px] font-light text-gray-400">{{
item.desc item.desc
}}</span> }}</span>
</div> </div>
......
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
</div> </div>
<!-- 右侧:已选列表 --> <!-- 右侧:已选列表 -->
<div class="w-2/5 rounded-md flex flex-col bg-white rounded-[6px] border border-[#f2f4f7] bg-white"> <div class="w-2/5 flex flex-col bg-white rounded-[6px] border border-[#f2f4f7] bg-white">
<div class="bg-gray-50 px-4 py-2 text-[14px] text-[#2F3133] flex justify-between items-center h-[41px]"> <div class="bg-gray-50 px-4 py-2 text-[14px] text-[#2F3133] flex justify-between items-center h-[41px]">
<span>已选 · {{ selectedNodes.length }}</span> <span>已选 · {{ selectedNodes.length }}</span>
<button <button
...@@ -188,7 +188,7 @@ ...@@ -188,7 +188,7 @@
class="!px-6 !py-5 !text-base !bg-blue-600 hover:!bg-blue-500 !border-none" class="!px-6 !py-5 !text-base !bg-blue-600 hover:!bg-blue-500 !border-none"
@click="submitForm" @click="submitForm"
> >
{{ props.material?.id ? '保存' : '上传素材' }} {{ isEditMode ? '保存' : '上传素材' }}
</el-button> </el-button>
<!-- <el-button <!-- <el-button
class="px-6 py-5 text-[14px] text-[#565D6B] hover:!bg-gray-50" class="px-6 py-5 text-[14px] text-[#565D6B] hover:!bg-gray-50"
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive, watch, onMounted, computed, nextTick, toRaw } from 'vue'; import { ref, reactive, watch, onMounted, onUnmounted, computed, nextTick, toRaw } from 'vue';
import { Close, UploadFilled, Folder, CircleCheckFilled, Edit, Delete, WarningFilled } from '@element-plus/icons-vue'; import { Close, UploadFilled, Folder, CircleCheckFilled, Edit, Delete, WarningFilled } from '@element-plus/icons-vue';
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus';
import { findCategoryList, updateKnowledgeMaterial,saveKnowledgeMaterial } from '@/api/knowledge'; import { findCategoryList, updateKnowledgeMaterial,saveKnowledgeMaterial } from '@/api/knowledge';
...@@ -229,6 +229,10 @@ const props = defineProps({ ...@@ -229,6 +229,10 @@ const props = defineProps({
// 定义 emits // 定义 emits
const emit = defineEmits(['close', 'refresh']); const emit = defineEmits(['close', 'refresh']);
// --- 编辑模式状态(用于避免关闭时按钮文字闪动) ---
const isEditMode = ref(false);
let editModeResetTimer = null; // 用于延迟重置编辑模式的定时器
// --- Form Data --- // --- Form Data ---
const formRef = ref(null); const formRef = ref(null);
const uploadRef = ref(null); const uploadRef = ref(null);
...@@ -689,6 +693,25 @@ const setTreeCheckedKeys = (deptIds) => { ...@@ -689,6 +693,25 @@ const setTreeCheckedKeys = (deptIds) => {
// 监听 material 变化,填充表单数据 // 监听 material 变化,填充表单数据
watch(() => props.material, async (newMaterial) => { watch(() => props.material, async (newMaterial) => {
// 清除之前的定时器
if (editModeResetTimer) {
clearTimeout(editModeResetTimer);
editModeResetTimer = null;
}
// 更新编辑模式状态
// 当 material 有值且有 id 时,立即设置为编辑模式
// 当 material 变为 null 时,延迟更新(避免关闭动画期间按钮文字闪动)
if (newMaterial && newMaterial.id) {
isEditMode.value = true;
} else {
// 延迟更新,等待关闭动画完成(通常 300ms)
editModeResetTimer = setTimeout(() => {
isEditMode.value = false;
editModeResetTimer = null;
}, 300);
}
if (newMaterial) { if (newMaterial) {
formData.name = newMaterial.title || newMaterial.name || ''; formData.name = newMaterial.title || newMaterial.name || '';
...@@ -988,7 +1011,7 @@ const submitForm = async () => { ...@@ -988,7 +1011,7 @@ const submitForm = async () => {
}; };
const closeModal = () => { const closeModal = () => {
resetForm(); // resetForm();
if (props.isStandalone) { if (props.isStandalone) {
ElMessage.info('取消操作'); ElMessage.info('取消操作');
} else { } else {
...@@ -1000,11 +1023,23 @@ const handleClose = () => { ...@@ -1000,11 +1023,23 @@ const handleClose = () => {
closeModal(); closeModal();
}; };
defineExpose({
resetForm,
});
// 组件挂载时获取分类列表 // 组件挂载时获取分类列表
onMounted(() => { onMounted(() => {
getCategoryList(); getCategoryList();
getDeptTree(); getDeptTree();
}); });
// 组件卸载时清理定时器
onUnmounted(() => {
if (editModeResetTimer) {
clearTimeout(editModeResetTimer);
editModeResetTimer = null;
}
});
</script> </script>
<style scoped> <style scoped>
......
...@@ -23,6 +23,8 @@ const originalData = ref({}); ...@@ -23,6 +23,8 @@ const originalData = ref({});
const drawer = ref(false); const drawer = ref(false);
// 当前编辑的素材数据 // 当前编辑的素材数据
const currentMaterial = ref(null); const currentMaterial = ref(null);
// 子表单引用,用于重置数据
const addUpdateRef = ref();
// 预览相关 // 预览相关
const previewVisible = ref(false); const previewVisible = ref(false);
const previewMaterial = ref(null); const previewMaterial = ref(null);
...@@ -417,6 +419,7 @@ const getMaterialList = async () => { ...@@ -417,6 +419,7 @@ const getMaterialList = async () => {
}; };
// 打开编辑drawer // 打开编辑drawer
const handleEditMaterial = (item) => { const handleEditMaterial = (item) => {
addUpdateRef.value?.resetForm?.();
currentMaterial.value = { ...item, id: item.id }; currentMaterial.value = { ...item, id: item.id };
drawer.value = true; drawer.value = true;
}; };
...@@ -933,7 +936,13 @@ onMounted(() => { ...@@ -933,7 +936,13 @@ onMounted(() => {
<img src="/images/icon-close.png" alt="" srcset="" class="el-icon--left w-[20px] h-[20px] cursor-pointer" @click="handleCloseDrawer"> <img src="/images/icon-close.png" alt="" srcset="" class="el-icon--left w-[20px] h-[20px] cursor-pointer" @click="handleCloseDrawer">
</div> </div>
</template> </template>
<AddUpdate :is-standalone="false" :material="currentMaterial" @close="handleCloseDrawer" @refresh="handleRefreshList" /> <AddUpdate
ref="addUpdateRef"
:is-standalone="false"
:material="currentMaterial"
@close="handleCloseDrawer"
@refresh="handleRefreshList"
/>
</el-drawer> </el-drawer>
<!-- 预览素材弹框 --> <!-- 预览素材弹框 -->
...@@ -1000,4 +1009,13 @@ onMounted(() => { ...@@ -1000,4 +1009,13 @@ onMounted(() => {
--el-button-bg-color: #1d4ed8; /* Tailwind blue-700 */ --el-button-bg-color: #1d4ed8; /* Tailwind blue-700 */
--el-button-border-color: #1d4ed8; --el-button-border-color: #1d4ed8;
} }
/* el-select 选中项字体颜色 */
:deep(.el-select .el-input__inner) {
color: #1956FE !important;
}
/* el-select 下拉选项中已选中项的字体颜色 */
:deep(.el-select-dropdown__item.selected) {
color: #1956FE !important;
}
</style> </style>
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh-CN"> <html lang="zh-CN" style="--el-color-primary: #185EFE; ">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
......
...@@ -7,6 +7,7 @@ import { setupQiankun } from './qiankun'; ...@@ -7,6 +7,7 @@ import { setupQiankun } from './qiankun';
import router, { addLayoutRoutes } from './router'; import router, { addLayoutRoutes } from './router';
import { useAppStore, useMenuStore, useUserStore } from './stores'; import { useAppStore, useMenuStore, useUserStore } from './stores';
import { getToken } from './utils/auth'; import { getToken } from './utils/auth';
import './styles/element/index.scss';
import 'element-plus/dist/index.css'; import 'element-plus/dist/index.css';
import './style.css'; import './style.css';
// 创建应用实例 // 创建应用实例
......
@forward "element-plus/theme-chalk/src/common/var.scss" with (
// $button: (
// "color": #666666,
// "border-color": #E1E3E6,
// "hover-bg-color": #3d6eff,
// "hover-text-color": #ffffff,
// "hover-border-color": #3d6eff,
// )
$colors: (
'primary': (
'base': #3d6eff,
),
)
);
@use "element-plus/theme-chalk/src/index.scss" as *;
...@@ -5,3 +5,5 @@ ...@@ -5,3 +5,5 @@
@forward './variables'; @forward './variables';
@use './mixins' as *; @use './mixins' as *;
@forward './mixins'; @forward './mixins';
/** /**
* 将当前项目的 dist 文件夹复制到 venus-pro 根目录的 dist 文件夹 * 将当前项目的 dist 文件夹复制到 根目录的 dist 文件夹
* 用于 postbuild 钩子 * 用于 postbuild 钩子
*/ */
import { existsSync, rmSync, cpSync } from 'node:fs'; import { existsSync, rmSync, cpSync } from 'node:fs';
...@@ -9,10 +9,11 @@ import { fileURLToPath } from 'node:url'; ...@@ -9,10 +9,11 @@ import { fileURLToPath } from 'node:url';
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename); const __dirname = dirname(__filename);
// 获取 venus-pro 项目根目录(scripts 的父目录) // 获取项目根目录(scripts 的父目录)
const venusProRoot = resolve(__dirname, '..'); const venusProRoot = resolve(__dirname, '..');
const rootDistDir = join(venusProRoot, 'dist'); const rootDistDir = join(venusProRoot, 'dist');
console.log('目根目录', venusProRoot);
console.log('输出路径', rootDistDir);
// 获取当前包的工作目录 // 获取当前包的工作目录
// pnpm 在执行 postbuild 时,工作目录就是包的目录 // pnpm 在执行 postbuild 时,工作目录就是包的目录
const packageDir = process.cwd(); const packageDir = process.cwd();
...@@ -23,13 +24,13 @@ if (!existsSync(sourceDistDir)) { ...@@ -23,13 +24,13 @@ if (!existsSync(sourceDistDir)) {
process.exit(1); process.exit(1);
} }
// 清理 venus-pro 根目录的 dist(如果存在) // 清理 根目录的 dist(如果存在)
if (existsSync(rootDistDir)) { if (existsSync(rootDistDir)) {
rmSync(rootDistDir, { recursive: true, force: true }); rmSync(rootDistDir, { recursive: true, force: true });
} }
// 复制 dist 到 venus-pro 根目录的 dist 文件夹 // 复制 dist 到根目录的 dist 文件夹
cpSync(sourceDistDir, rootDistDir, { recursive: true }); cpSync(sourceDistDir, rootDistDir, { recursive: true });
console.log(`✅ 已将构建产物复制到 venus-pro 根目录: ${rootDistDir}`); console.log(`✅ 已将构建产物复制到根目录: ${rootDistDir}`);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!