Commit c9f77efd by Lin

feat:岗位助手页面/智能体列表页面

1 parent b9000e34
Showing 28 changed files with 702 additions and 178 deletions
---
'@venus/venus-agentic-assisant': major
'@venus/venus-agentic-base': major
---
修改汽车智能体平台页面布局/功能页面开发
---
'@venus/venus-agentic-base': major
---
汽车智能体项目微前端基座布局配置等优化
...@@ -76,7 +76,6 @@ function setupStoreSync() { ...@@ -76,7 +76,6 @@ function setupStoreSync() {
// 获取配置中心配置 // 获取配置中心配置
fetchConfig() fetchConfig()
.then((config) => { .then((config) => {
console.log('[基座] 配置中心配置获取成功:', config);
console.log('[基座] 当前配置数据:', getConfig()); console.log('[基座] 当前配置数据:', getConfig());
}) })
.catch((error) => { .catch((error) => {
......
...@@ -11,13 +11,15 @@ ...@@ -11,13 +11,15 @@
"type-check": "vue-tsc --noEmit" "type-check": "vue-tsc --noEmit"
}, },
"dependencies": { "dependencies": {
"@venus/tailwind-config": "workspace:*",
"@vueuse/core": "catalog:", "@vueuse/core": "catalog:",
"axios": "catalog:", "axios": "catalog:",
"element-plus": "^2.9.1", "element-plus": "^2.9.1",
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
"pinia": "catalog:", "pinia": "catalog:",
"vue": "catalog:", "vue": "catalog:",
"vue-router": "catalog:" "vue-router": "catalog:",
"tailwindcss": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "catalog:", "@types/node": "catalog:",
......
import postcssConfig from '@venus/tailwind-config/postcss';
export default postcssConfig;
...@@ -7,18 +7,6 @@ onMounted(() => { ...@@ -7,18 +7,6 @@ onMounted(() => {
</script> </script>
<template> <template>
<div id="micro-app" class="micro-app-container">
<header class="app-header">
<h1>🚀 Vue3 微前端子应用</h1>
<nav class="nav-menu">
<router-link to="/" class="nav-link">首页</router-link>
<router-link to="/about" class="nav-link">关于</router-link>
<router-link to="/communication" class="nav-link">通信示例</router-link>
<router-link to="/user" class="nav-link">用户管理</router-link>
<router-link to="/settings" class="nav-link">系统设置</router-link>
</nav>
</header>
<main class="app-main"> <main class="app-main">
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
...@@ -26,71 +14,12 @@ onMounted(() => { ...@@ -26,71 +14,12 @@ onMounted(() => {
</transition> </transition>
</router-view> </router-view>
</main> </main>
<footer class="app-footer">
<p>© 2025 Venus 微前端子应用模板</p>
</footer>
</div>
</template> </template>
<style scoped> <style scoped>
.micro-app-container {
display: flex;
flex-direction: column;
min-height: 100vh;
color: white;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.app-header {
padding: 1.5rem 2rem;
background: rgb(255 255 255 / 10%);
border-bottom: 1px solid rgb(255 255 255 / 20%);
backdrop-filter: blur(10px);
}
.app-header h1 {
margin: 0 0 1rem;
font-size: 1.8rem;
font-weight: 600;
}
.nav-menu {
display: flex;
gap: 1.5rem;
}
.nav-link {
padding: 0.5rem 1rem;
color: white;
text-decoration: none;
background: rgb(255 255 255 / 10%);
border-radius: 0.5rem;
transition: all 0.3s ease;
}
.nav-link:hover {
background: rgb(255 255 255 / 20%);
transform: translateY(-2px);
}
.nav-link.router-link-active {
font-weight: 600;
background: rgb(255 255 255 / 30%);
}
.app-main { .app-main {
flex: 1; flex: 1;
padding: 2rem;
}
.app-footer {
padding: 1rem 2rem;
text-align: center;
background: rgb(0 0 0 / 20%);
border-top: 1px solid rgb(255 255 255 / 10%);
} }
/* 路由过渡动画 */ /* 路由过渡动画 */
.fade-enter-active, .fade-enter-active,
.fade-leave-active { .fade-leave-active {
......
...@@ -12,11 +12,35 @@ const routes: RouteRecordRaw[] = [ ...@@ -12,11 +12,35 @@ const routes: RouteRecordRaw[] = [
}, },
}, },
{ {
path: '/about', path: '/managekonw',
name: 'About', name: 'ManageKonw',
component: () => import('@/views/About.vue'), component: () => import('@/views/ManageKonw/index.vue'),
meta: { meta: {
title: '关于', title: '知识管理',
},
},
{
path: '/assistant',
name: 'Assistant',
component: () => import('@/views/Assistant/index.vue'),
meta: {
title: '岗位助理配置',
},
},
{
path: '/assistant/add',
name: 'AssistantAdd',
component: () => import('@/views/Assistant/add.vue'),
meta: {
title: '新增智能体',
},
},
{
path: '/assistant/edit/:id',
name: 'AssistantEdit',
component: () => import('@/views/Assistant/add.vue'),
meta: {
title: '编辑智能体',
}, },
}, },
{ {
......
/* Tailwind CSS 指令 */
@tailwind base;
@tailwind components;
@tailwind utilities;
/* 全局样式 */ /* 全局样式 */
* { * {
box-sizing: border-box; box-sizing: border-box;
......
...@@ -109,15 +109,6 @@ class SubAppCommunicationManager { ...@@ -109,15 +109,6 @@ class SubAppCommunicationManager {
this.unsubscribe = unsubscribeFn; this.unsubscribe = unsubscribeFn;
} }
} }
console.log('[子应用通信] 通信管理器初始化完成');
// 额外的保险措施:延迟一点再触发一次所有监听器,确保数据已经传递
setTimeout(() => {
if (this.props?.onGlobalStateChange) {
console.log('[子应用通信] 二次确认全局状态同步');
}
}, 100);
} }
/** /**
......
<script setup>
import { ref, reactive, computed, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { Plus } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
const router = useRouter()
// --- 1. 状态定义 ---
const loading = ref(false)
const selectedIds = ref([])
// 搜索表单
const searchForm = reactive({
name: '',
status: '' // 空字符串代表全部,true/false代表具体状态
})
// 分页配置
const pagination = reactive({
currentPage: 1,
pageSize: 10
})
// 原始数据(模拟数据库)
const allData = ref([])
// --- 2. 模拟数据生成 ---
const initMockData = () => {
const baseData = [
{ name: '销售顾问AI', department: '深圳旗舰店销售部', status: true },
{ name: '客服助手', department: '客户服务中心', status: true },
{ name: '培训导师', department: '人力资源部', status: false },
]
const list = []
for (let i = 0; i < 101; i++) {
const template = baseData[i % 3]
list.push({
id: i + 1,
name: `${template.name} ${i + 1}`, // 加上序号区分
department: template.department,
createTime: '2025-10-25 10:30:00',
status: i % 5 === 0 ? false : true, // 随机一些状态
statusLoading: false
})
}
allData.value = list
}
onMounted(() => {
initMockData()
})
// --- 3. 数据处理逻辑 (前端模拟后端查询) ---
// 经过搜索过滤后的总数据
const filteredData = computed(() => {
return allData.value.filter(item => {
const matchName = item.name.includes(searchForm.name)
const matchStatus = searchForm.status === '' || item.status === searchForm.status
return matchName && matchStatus
})
})
// 过滤后的总条数
const filteredTotal = computed(() => filteredData.value.length)
// 当前页显示的数据(切片)
const currentPageData = computed(() => {
const start = (pagination.currentPage - 1) * pagination.pageSize
const end = start + pagination.pageSize
return filteredData.value.slice(start, end)
})
// --- 4. 事件处理 ---
// 查询
const handleSearch = () => {
pagination.currentPage = 1 // 查询时重置到第一页
ElMessage.success('查询成功')
}
// 重置
const handleReset = () => {
searchForm.name = ''
searchForm.status = ''
pagination.currentPage = 1
ElMessage.info('已重置搜索条件')
}
// 表格多选
const handleSelectionChange = (selection) => {
selectedIds.value = selection.map(item => item.id)
}
// 状态切换
const handleStatusChange = (row) => {
row.statusLoading = true
// 模拟API请求延迟
setTimeout(() => {
row.statusLoading = false
ElMessage.success(`${row.name} 状态已更新为:${row.status ? '启用' : '禁用'}`)
}, 500)
}
// 新增
const handleAdd = () => {
router.push('/assistant/add')
}
// 编辑
const handleEdit = (row) => {
router.push(`/assistant/edit/${row.id}`)
}
// 分页事件
const handleSizeChange = (val) => {
pagination.pageSize = val
pagination.currentPage = 1
}
const handleCurrentChange = (val) => {
pagination.currentPage = val
}
</script>
<template>
<div class="p-5 bg-white min-h-screen">
<!-- 1. 顶部标题 -->
<h2 class="text-lg font-semibold mb-5 text-[#303133]">岗位助理配置</h2>
<!-- 2. 搜索区域 -->
<div class="mb-5">
<el-form :inline="true" :model="searchForm" class="search-form">
<el-form-item label="智能体名称">
<el-input
v-model="searchForm.name"
placeholder="请输入"
clearable
style="width: 220px"
@keyup.enter="handleSearch"
/>
</el-form-item>
<el-form-item label="状态">
<el-select
v-model="searchForm.status"
placeholder="全部"
clearable
style="width: 220px"
>
<el-option label="全部" value="" />
<el-option label="启用" :value="true" />
<el-option label="禁用" :value="false" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button>
<el-button @click="handleReset">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 3. 操作栏 (左侧选中统计,右侧新增按钮) -->
<div class="flex justify-between items-center mb-4">
<div class="left-panel">
<span class="text-sm text-[#909399]">已选 {{ selectedIds.length }} 项</span>
</div>
<div class="right-panel">
<el-button type="primary" :icon="Plus" @click="handleAdd">新增智能体</el-button>
</div>
</div>
<!-- 4. 表格区域 -->
<el-table
:data="currentPageData"
style="width: 100%"
:header-cell-style="{ background: '#f5f7fa', color: '#606266' }"
@selection-change="handleSelectionChange"
v-loading="loading"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="name" label="智能体名称" min-width="150" />
<el-table-column prop="department" label="岗位关联" min-width="180" />
<el-table-column prop="createTime" label="创建时间" min-width="180" />
<el-table-column label="状态" min-width="120">
<template #default="scope">
<div class="flex items-center gap-2.5">
<el-switch
v-model="scope.row.status"
:loading="scope.row.statusLoading"
@change="handleStatusChange(scope.row)"
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
/>
<span class="text-sm" :class="scope.row.status ? 'text-[#303133]' : 'text-[#909399]'">
{{ scope.row.status ? '启用' : '禁用' }}
</span>
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="100" fixed="right">
<template #default="scope">
<el-button link type="primary" @click="handleEdit(scope.row)">编辑</el-button>
</template>
</el-table-column>
</el-table>
<!-- 5. 分页区域 -->
<div class="mt-5 flex justify-between items-center">
<div class="text-sm text-[#606266]">共 {{ filteredTotal }} 项数据</div>
<el-pagination
v-model:current-page="pagination.currentPage"
v-model:page-size="pagination.pageSize"
:page-sizes="[10, 20, 50, 100]"
layout="sizes, prev, pager, next, jumper"
:total="filteredTotal"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</div>
</template>
<style scoped>
/* Element Plus 表单项样式覆盖 - 使用 !important 确保优先级 */
.search-form :deep(.el-form-item) {
margin-bottom: 0;
margin-right: 20px;
}
</style>
<template>
<div class="flex flex-col h-screen bg-white font-sans text-gray-800 overflow-hidden">
<!-- 顶部标题栏 -->
<header class="px-6 pt-5 border-b border-gray-100 flex-shrink-0">
<h1 class="text-lg font-semibold mb-5 text-gray-800">知识管理</h1>
<div class="flex gap-8">
<div class="pb-3 text-sm font-medium text-blue-500 border-b-2 border-blue-500 cursor-pointer">
素材库
</div>
<div class="pb-3 text-sm text-gray-500 cursor-pointer hover:text-blue-500 transition-colors">
其他
</div>
</div>
</header>
<div class="flex flex-1 overflow-hidden p-6 bg-white">
<!-- 左侧侧边栏 -->
<aside class="w-60 h-fit min-h-[600px] border border-gray-200 rounded-lg mr-6 py-4 flex-shrink-0">
<div class="px-5 text-sm font-medium mb-3 text-gray-700">
全部素材 · {{ totalMaterials }}
</div>
<ul class="space-y-1">
<li
v-for="item in categories"
:key="item.id"
class="flex justify-between items-center px-5 h-10 mx-2 rounded cursor-pointer text-sm transition-colors duration-200"
:class="[
currentCategory === item.id
? 'bg-blue-50 text-blue-500'
: 'text-gray-600 hover:bg-gray-50'
]"
@click="currentCategory = item.id"
>
<span>{{ item.name }}</span>
<span :class="currentCategory === item.id ? 'text-blue-500' : 'text-gray-400 text-xs'">
{{ item.count }}
</span>
</li>
</ul>
</aside>
<!-- 右侧内容区 -->
<main class="flex-1 flex flex-col overflow-hidden">
<!-- 筛选栏 -->
<div class="flex justify-between items-center mb-5 flex-shrink-0">
<div class="flex gap-6 items-center">
<div class="flex items-center gap-3">
<span class="text-sm text-gray-600 whitespace-nowrap">文件类型</span>
<el-select v-model="filterForm.type" placeholder="全部" class="!w-[200px]">
<el-option label="全部" value="" />
<el-option label="文档" value="doc" />
<el-option label="图片" value="image" />
<el-option label="视频" value="video" />
</el-select>
</div>
<div class="flex items-center gap-3">
<span class="text-sm text-gray-600 whitespace-nowrap">素材名称</span>
<el-input v-model="filterForm.name" placeholder="请输入" class="!w-[240px]" />
</div>
<div class="flex gap-3 ml-3">
<el-button type="primary" class="!px-6" @click="handleSearch">查询</el-button>
<el-button class="!px-6" @click="handleReset">重置</el-button>
</div>
</div>
</div>
<!-- 操作栏 -->
<div class="flex justify-between items-center mb-5 flex-shrink-0">
<div class="text-sm text-gray-600">已选 {{ selectedCount }} 项</div>
<el-button type="primary">
<el-icon class="el-icon--left"><Upload /></el-icon>上传素材
</el-button>
</div>
<!-- 素材卡片列表 (Grid布局 + 滚动区) -->
<div class="flex-1 overflow-y-auto pr-2">
<div class="grid grid-cols-3 gap-5 mb-6">
<div
v-for="item in materials"
:key="item.id"
class="rounded-lg p-5 flex flex-col min-h-[140px] relative transition-shadow duration-300 hover:shadow-[0_4px_12px_rgba(0,0,0,0.05)]"
:class="getCardStyle(item.type).cardBg"
>
<!-- 卡片图标区域 -->
<div class="mb-4">
<div class="w-12 h-12 rounded-xl flex items-center justify-center" :class="[getCardStyle(item.type).iconBg, getCardStyle(item.type).iconColor]">
<el-icon v-if="item.type === 'doc'" :size="24"><Document /></el-icon>
<el-icon v-else-if="item.type === 'image'" :size="24"><Picture /></el-icon>
<el-icon v-else-if="item.type === 'video'" :size="24"><VideoCamera /></el-icon>
</div>
</div>
<!-- 卡片内容 -->
<div class="flex-1 flex flex-col">
<div class="text-base font-medium text-gray-800 mb-2 line-clamp-2 leading-snug h-[44px]">
{{ item.title }}
</div>
<!-- 标签 -->
<div class="self-start px-2 py-0.5 rounded text-xs bg-white mb-6" :class="getCardStyle(item.type).tagColor">
{{ getTypeName(item.type) }}
</div>
<!-- 底部操作栏 -->
<div class="mt-auto flex justify-between items-center">
<div class="flex gap-4">
<button class="flex items-center gap-1 text-[13px] text-blue-500 hover:text-blue-600 transition-colors">
<el-icon><View /></el-icon> 预览
</button>
<button class="flex items-center gap-1 text-[13px] text-blue-500 hover:text-blue-600 transition-colors">
<el-icon><EditPen /></el-icon> 编辑
</button>
</div>
<el-dropdown trigger="click">
<span class="flex items-center gap-1 text-[13px] text-gray-600 cursor-pointer hover:text-blue-500 transition-colors">
更多 <el-icon><ArrowDown /></el-icon>
</span>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item>下载</el-dropdown-item>
<el-dropdown-item class="!text-red-500">删除</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</div>
</div>
</div>
</div>
<!-- 分页 -->
<div class="flex items-center justify-end pt-5 flex-shrink-0">
<div class="text-gray-500 text-sm mr-4">共 101 项数据</div>
<el-pagination
v-model:current-page="pagination.currentPage"
v-model:page-size="pagination.pageSize"
:page-sizes="[10, 20, 50]"
layout="sizes, prev, pager, next, jumper"
:total="101"
background
/>
</div>
</main>
</div>
</div>
</template>
<script setup>
import { ref, reactive } from 'vue'
import {
Document, Picture, VideoCamera,
Upload, View, EditPen, ArrowDown
} from '@element-plus/icons-vue'
// --- 侧边栏数据 ---
const currentCategory = ref(1)
const totalMaterials = ref(60)
const categories = ref([
{ id: 1, name: '销售培训', count: 25 },
{ id: 2, name: '车型资料', count: 6 },
{ id: 3, name: '产品功能', count: 6 },
{ id: 4, name: '售后服务', count: 6 },
{ id: 5, name: '金融服务', count: 6 },
{ id: 6, name: '充电解决方案', count: 6 },
{ id: 7, name: '未分组', count: 5 },
])
// --- 筛选数据 ---
const filterForm = reactive({
type: '',
name: ''
})
const handleSearch = () => {
console.log('Searching...', filterForm)
}
const handleReset = () => {
filterForm.type = ''
filterForm.name = ''
}
// --- 素材列表数据 ---
const selectedCount = ref(0)
const getTypeName = (type) => {
const map = { doc: '文档', image: '图片', video: '视频' }
return map[type]
}
// 核心:样式映射函数 - 用于处理不同类型的颜色主题
const getCardStyle = (type) => {
const styles = {
doc: {
cardBg: 'bg-[#f0f9f8]', // 极浅绿背景
iconBg: 'bg-[#d5eee6]', // 图标浅绿底
iconColor: 'text-[#4bb79d]', // 图标深绿
tagColor: 'text-[#4bb79d]' // 标签文字色
},
image: {
cardBg: 'bg-[#f2f4fc]', // 极浅紫背景
iconBg: 'bg-[#dbe4fd]',
iconColor: 'text-[#738cdd]',
tagColor: 'text-[#738cdd]'
},
video: {
cardBg: 'bg-[#f0f8ff]', // 极浅蓝背景
iconBg: 'bg-[#dcecff]',
iconColor: 'text-[#6eb0f7]',
tagColor: 'text-[#6eb0f7]'
}
}
return styles[type] || styles.doc
}
// 模拟数据
const materials = ref([
{ id: 1, title: '2025年10月销售数据统计', type: 'doc' },
{ id: 2, title: '问界车型库', type: 'image' },
{ id: 3, title: '权益销售培训教程', type: 'video' },
{ id: 4, title: '权益销售培训教程', type: 'video' },
{ id: 5, title: '2025年第三季度销售部工作总结报告', type: 'doc' },
{ id: 6, title: '问界车型库', type: 'image' },
])
// --- 分页数据 ---
const pagination = reactive({
currentPage: 1,
pageSize: 10
})
</script>
import tailwindConfig from '@venus/tailwind-config';
export default tailwindConfig;
...@@ -2,6 +2,5 @@ import gscPost from '@/config/gscrequest' ...@@ -2,6 +2,5 @@ import gscPost from '@/config/gscrequest'
// 数据看板指标统计 // 数据看板指标统计
export function getdataBoard(data: any) { export function getdataBoard(data: any) {
console.log("SSSSS"); return gscPost("/dataBoard/indexs", data)
return gscPost("/dataBoard/index", data)
} }
...@@ -96,6 +96,11 @@ export async function fetchConfig(): Promise<any> { ...@@ -96,6 +96,11 @@ export async function fetchConfig(): Promise<any> {
console.log('[配置中心] GSC API 登出:', response, requestConfig); console.log('[配置中心] GSC API 登出:', response, requestConfig);
}, },
}, },
// Sentry 配置
sentry: {
enable: true, // 是否启用Sentry错误上报
dsn: 'https://ace1d827739e4229887b78468bd8a385@sentry.glsx.com.cn/48'
}
}); });
console.log('[配置中心] GSC API 实例创建成功:', gscApiInstance); console.log('[配置中心] GSC API 实例创建成功:', gscApiInstance);
......
...@@ -16,40 +16,97 @@ export const homeMenus: MenuItem[] = [ ...@@ -16,40 +16,97 @@ export const homeMenus: MenuItem[] = [
} }
]; ];
// Vue 微应用侧边栏菜单(多级示例) // Vue 微应用侧边栏菜单(多级嵌套示例)
// 支持一级、二级、三级菜单嵌套结构
export const vueAppMenus: MenuItem[] = [ export const vueAppMenus: MenuItem[] = [
{ {
id: 'contacts', id: 'contacts',
title: '智能助理', title: '智能助理',
path: '/subapp-vue/contacts', path: '/subapp-vue/',
icon: '📥', icon: '🤖',
level: 1, level: 1,
children: [ children: [
{ {
id: 'contacts-list', id: 'contacts-config',
title: '首页',
path: '/subapp-vue/',
icon: '⚙️',
level: 2,
parentId: 'contacts',
children: [],
},
{
id: 'contacts-config',
title: '岗位助理配置', title: '岗位助理配置',
path: '/subapp-vue/about', path: '/subapp-vue/assistant',
icon: '📝', icon: '⚙️',
level: 2, level: 2,
parentId: 'contacts', parentId: 'contacts',
children: [],
}, },
{ {
id: 'contacts-import', id: 'contacts-knowledge',
title: '知识管理', title: '知识管理',
path: '/subapp-vue/communication', path: '/subapp-vue/managekonw',
icon: '📥', icon: '📚',
level: 2, level: 2,
parentId: 'contacts', parentId: 'contacts',
},{ children: [],
id: 'contacts-import', },
{
id: 'contacts-agent',
title: '智能体管理', title: '智能体管理',
path: '/subapp-vue/communications', path: '/subapp-vue/communications',
icon: '📥', icon: '🎯',
level: 2, level: 2,
parentId: 'contacts', parentId: 'contacts',
children: [
{
id: 'contacts-agent-list',
title: '智能体列表',
path: '/subapp-vue/communications/list',
icon: '📋',
level: 3,
parentId: 'contacts-agent',
},
{
id: 'contacts-agent-create',
title: '创建智能体',
path: '/subapp-vue/communications/create',
icon: '➕',
level: 3,
parentId: 'contacts-agent',
},
{
id: 'contacts-agent-training',
title: '训练管理',
path: '/subapp-vue/communications/training',
icon: '🎓',
level: 3,
parentId: 'contacts-agent',
children: [
{
id: 'contacts-agent-training-data',
title: '训练数据',
path: '/subapp-vue/communications/training/data',
icon: '💾',
level: 4,
parentId: 'contacts-agent-training',
},
{
id: 'contacts-agent-training-model',
title: '模型训练',
path: '/subapp-vue/communications/training/model',
icon: '🧠',
level: 4,
parentId: 'contacts-agent-training',
}, },
], ],
} },
],
},
],
},
]; ];
/** /**
......
...@@ -44,10 +44,6 @@ const getActiveTopMenuId = (path: string): string => { ...@@ -44,10 +44,6 @@ const getActiveTopMenuId = (path: string): string => {
return ''; return '';
}; };
// 判断顶级菜单是否激活
const isTopMenuActive = (topMenuId: string): boolean => {
return activeTopMenuId.value === topMenuId;
};
// 面包屑导航 // 面包屑导航
const breadcrumbs = computed<BreadcrumbItem[]>(() => { const breadcrumbs = computed<BreadcrumbItem[]>(() => {
...@@ -88,11 +84,6 @@ function findMenuByPath(menus: MenuItem[], path: string): MenuItem | null { ...@@ -88,11 +84,6 @@ function findMenuByPath(menus: MenuItem[], path: string): MenuItem | null {
return null; return null;
} }
// 顶级和侧边主菜单点击事件
const handleTopMenuClick = (topMenuId: string, topMenuPath: string) => {
activeTopMenuId.value = topMenuId;
router.push(topMenuPath);
};
// 菜单点击事件 // 菜单点击事件
const handleMenuClick = (menu: MenuItem) => { const handleMenuClick = (menu: MenuItem) => {
......
...@@ -82,8 +82,8 @@ onUnmounted(() => { ...@@ -82,8 +82,8 @@ onUnmounted(() => {
<div class="notification-center"> <div class="notification-center">
<!-- 通知图标按钮 --> <!-- 通知图标按钮 -->
<div class="notification-badge" @click="togglePanel"> <div class="notification-badge" @click="togglePanel">
<!-- <span class="icon">🔔</span> <!-- <span class="icon">🔔</span> -->
<span v-if="unreadCount > 0" class="badge">{{ unreadCount }}</span> --> <span v-if="unreadCount > 0" class="badge">{{ unreadCount }}</span>
<el-icon size="16" style="margin-right: 6px;"><Bell /></el-icon> <el-icon size="16" style="margin-right: 6px;"><Bell /></el-icon>
<span>消息通知</span> <span>消息通知</span>
</div> </div>
......
...@@ -146,6 +146,11 @@ const handleToggle = () => { ...@@ -146,6 +146,11 @@ const handleToggle = () => {
font-size: 14px; font-size: 14px;
} }
.menu-item-content.level-4 {
padding-left: 64px;
font-size: 14px;
}
.menu-item-content:hover { .menu-item-content:hover {
color: #1956FE; color: #1956FE;
background-color: #f5f5f5; background-color: #f5f5f5;
...@@ -170,7 +175,8 @@ const handleToggle = () => { ...@@ -170,7 +175,8 @@ const handleToggle = () => {
/* 子菜单选中样式:保留背景色,移除边框 */ /* 子菜单选中样式:保留背景色,移除边框 */
.menu-item-content.level-2.active, .menu-item-content.level-2.active,
.menu-item-content.level-3.active { .menu-item-content.level-3.active,
.menu-item-content.level-4.active {
border-radius: 6px; border-radius: 6px;
background-color: #E8F0FF; background-color: #E8F0FF;
} }
...@@ -250,7 +256,6 @@ const handleToggle = () => { ...@@ -250,7 +256,6 @@ const handleToggle = () => {
/* 有子菜单的项目样式 */ /* 有子菜单的项目样式 */
.menu-item-content.has-children { .menu-item-content.has-children {
font-weight: 500;
} }
/* 二级菜单样式 */ /* 二级菜单样式 */
...@@ -270,4 +275,13 @@ const handleToggle = () => { ...@@ -270,4 +275,13 @@ const handleToggle = () => {
.level-3 .menu-item-content:hover { .level-3 .menu-item-content:hover {
background-color: #ebebeb; background-color: #ebebeb;
} }
/* 四级菜单样式 */
.level-4 .menu-item-content {
background-color: rgb(0 0 0 / 6%);
}
.level-4 .menu-item-content:hover {
background-color: #e5e5e5;
}
</style> </style>
...@@ -11,22 +11,6 @@ const showDropdown = ref(false); ...@@ -11,22 +11,6 @@ const showDropdown = ref(false);
// 确认对话框显示状态 // 确认对话框显示状态
const showConfirmDialog = ref(false); const showConfirmDialog = ref(false);
// 角色文本映射
const getRoleText = () => {
const roles = userStore.roles;
if (!roles || roles.length === 0) return '普通用户';
const roleMap: Record<string, string> = {
admin: '管理员',
user: '普通用户',
guest: '访客',
developer: '开发者',
manager: '经理',
};
return roleMap[roles[0]] || roles[0];
};
// 切换下拉菜单 // 切换下拉菜单
const toggleDropdown = () => { const toggleDropdown = () => {
console.log("toggleDropdown"); console.log("toggleDropdown");
...@@ -37,7 +21,7 @@ const toggleDropdown = () => { ...@@ -37,7 +21,7 @@ const toggleDropdown = () => {
// 点击外部关闭下拉菜单 // 点击外部关闭下拉菜单
const handleClickOutside = (event: MouseEvent) => { const handleClickOutside = (event: MouseEvent) => {
const target = event.target as HTMLElement; const target = event.target as HTMLElement;
if (!target.closest('.user-card')) { if (!target.closest('.user-info')) {
showDropdown.value = false; showDropdown.value = false;
} }
}; };
...@@ -94,18 +78,10 @@ onUnmounted(() => { ...@@ -94,18 +78,10 @@ onUnmounted(() => {
<template> <template>
<div class="user-info" v-if="userStore.isLoggedIn"> <div class="user-info" v-if="userStore.isLoggedIn">
<div class="user-info-card"> <div class="user-info-card" @click.stop="toggleDropdown">
<div class="avatar"></div> <div class="avatar"></div>
<p class="name">{{ userStore.userName }}</p> <p class="name">{{ userStore.userName }}</p>
</div> </div>
<!-- 已登录状态 -->
<div v-if="false" class="user-card" @click="toggleDropdown">
<div class="user-avatar">{{ userStore.userAvatar || '👤' }}</div>
<div class="user-details">
<div class="user-name">{{ userStore.userName }}</div>
<div class="user-role">{{ getRoleText() }}</div>
</div>
<div class="dropdown-icon">▼</div>
<!-- 下拉菜单 --> <!-- 下拉菜单 -->
<div v-if="showDropdown" class="user-dropdown" @click.stop> <div v-if="showDropdown" class="user-dropdown" @click.stop>
...@@ -139,7 +115,6 @@ onUnmounted(() => { ...@@ -139,7 +115,6 @@ onUnmounted(() => {
</button> </button>
</div> </div>
</div> </div>
</div>
<!-- 未登录状态 --> <!-- 未登录状态 -->
<div v-if="false" class="user-empty"> <div v-if="false" class="user-empty">
...@@ -228,23 +203,44 @@ onUnmounted(() => { ...@@ -228,23 +203,44 @@ onUnmounted(() => {
} }
.user-info-card { .user-info-card {
position: relative; position: relative;
padding: 8px; padding: 8px 12px;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
gap: 6px;
cursor: pointer; cursor: pointer;
.avatar { border-radius: 6px;
transition: all 0.2s;
}
.user-info-card:hover {
background: rgba(0, 0, 0, 0.04);
}
.user-info-card .avatar {
width: 28px; width: 28px;
height: 28px; height: 28px;
opacity: 1; opacity: 1;
background: #e6efff; background: #e6efff;
border-radius: 50%; border-radius: 50%;
} flex-shrink: 0;
.name { }
.user-info-card .name {
color: #777c85; color: #777c85;
font-size: 12px; font-size: 12px;
margin-left: 6px; white-space: nowrap;
} }
.user-info-card .dropdown-icon {
font-size: 10px;
color: #8c8c8c;
transition: transform 0.3s;
flex-shrink: 0;
}
.user-info:hover .dropdown-icon {
color: #667eea;
} }
/* 用户卡片 */ /* 用户卡片 */
...@@ -320,6 +316,7 @@ onUnmounted(() => { ...@@ -320,6 +316,7 @@ onUnmounted(() => {
border-radius: 8px; border-radius: 8px;
box-shadow: 0 8px 24px rgb(0 0 0 / 15%); box-shadow: 0 8px 24px rgb(0 0 0 / 15%);
animation: dropdown-slide-in 0.2s ease-out; animation: dropdown-slide-in 0.2s ease-out;
overflow: hidden;
} }
.dropdown-header { .dropdown-header {
......
...@@ -76,8 +76,7 @@ function setupStoreSync() { ...@@ -76,8 +76,7 @@ function setupStoreSync() {
// 获取配置中心配置 // 获取配置中心配置
fetchConfig() fetchConfig()
.then((config) => { .then((config) => {
console.log('[基座] 配置中心配置获取成功:', config); console.log('[基座] 当前配置数据:', getConfig(),config);
console.log('[基座] 当前配置数据:', getConfig());
}) })
.catch((error) => { .catch((error) => {
console.error('[基座] 配置中心配置获取失败:', error); console.error('[基座] 配置中心配置获取失败:', error);
......
...@@ -78,19 +78,6 @@ const routes: RouteRecordRaw[] = [ ...@@ -78,19 +78,6 @@ const routes: RouteRecordRaw[] = [
requiresAuth: true, requiresAuth: true,
}, },
}, },
// ==================== React 微应用模块 ====================
{
path: '/subapp-react/:pathMatch(.*)*',
name: 'SubAppReact',
component: () => import('@/views/MicroApp.vue'),
meta: {
title: 'React 微应用',
level: 1,
isMicroApp: true,
requiresAuth: true,
},
},
], ],
}, },
......
...@@ -24,7 +24,7 @@ const globalState = ref<GlobalState | null>(null); ...@@ -24,7 +24,7 @@ const globalState = ref<GlobalState | null>(null);
// 消息输入 // 消息输入
const messageTitle = ref('来自主应用的消息'); const messageTitle = ref('来自主应用的消息');
const messageContent = ref('Hello from Main App!'); const messageContent = ref('Hello from Main App!');
const drawer = ref(false)
// 监听器的取消函数 // 监听器的取消函数
let unsubscribe: (() => void) | null = null; let unsubscribe: (() => void) | null = null;
...@@ -164,7 +164,7 @@ const handleDebounceClick = () => { ...@@ -164,7 +164,7 @@ const handleDebounceClick = () => {
<h1 class="title">欢迎使用 SCRM 微前端平台</h1> <h1 class="title">欢迎使用 SCRM 微前端平台</h1>
<p class="subtitle">基于 qiankun + Vue3 + Vite 构建的微前端主应用</p> <p class="subtitle">基于 qiankun + Vue3 + Vite 构建的微前端主应用</p>
</div> </div>
<el-button @click="drawer = true">Open</el-button>
<div class="feature-section"> <div class="feature-section">
<div class="feature-card"> <div class="feature-card">
<div class="feature-icon">微</div> <div class="feature-icon">微</div>
...@@ -534,6 +534,9 @@ const handleDebounceClick = () => { ...@@ -534,6 +534,9 @@ const handleDebounceClick = () => {
</div> </div>
</div> </div>
</div> </div>
<el-drawer v-model="drawer" title="I am the title" :with-header="false">
<span>Hi there!</span>
</el-drawer>
</div> </div>
</template> </template>
......
...@@ -109,15 +109,6 @@ class SubAppCommunicationManager { ...@@ -109,15 +109,6 @@ class SubAppCommunicationManager {
this.unsubscribe = unsubscribeFn; this.unsubscribe = unsubscribeFn;
} }
} }
console.log('[子应用通信] 通信管理器初始化完成');
// 额外的保险措施:延迟一点再触发一次所有监听器,确保数据已经传递
setTimeout(() => {
if (this.props?.onGlobalStateChange) {
console.log('[子应用通信] 二次确认全局状态同步');
}
}, 100);
} }
/** /**
......
...@@ -42,6 +42,5 @@ ...@@ -42,6 +42,5 @@
outline: none !important; outline: none !important;
} }
} }
} }
</style> </style>
...@@ -588,6 +588,9 @@ importers: ...@@ -588,6 +588,9 @@ importers:
'@element-plus/icons-vue': '@element-plus/icons-vue':
specifier: ^2.3.1 specifier: ^2.3.1
version: 2.3.2(vue@3.5.24(typescript@5.9.3)) version: 2.3.2(vue@3.5.24(typescript@5.9.3))
'@venus/tailwind-config':
specifier: workspace:*
version: link:../../../../internal/tailwind-config
'@vueuse/core': '@vueuse/core':
specifier: 'catalog:' specifier: 'catalog:'
version: 13.9.0(vue@3.5.24(typescript@5.9.3)) version: 13.9.0(vue@3.5.24(typescript@5.9.3))
...@@ -600,6 +603,9 @@ importers: ...@@ -600,6 +603,9 @@ importers:
pinia: pinia:
specifier: ^3.0.3 specifier: ^3.0.3
version: 3.0.4(typescript@5.9.3)(vue@3.5.24(typescript@5.9.3)) version: 3.0.4(typescript@5.9.3)(vue@3.5.24(typescript@5.9.3))
tailwindcss:
specifier: 'catalog:'
version: 3.4.18(yaml@2.8.1)
vue: vue:
specifier: ^3.5.17 specifier: ^3.5.17
version: 3.5.24(typescript@5.9.3) version: 3.5.24(typescript@5.9.3)
...@@ -612,10 +618,10 @@ importers: ...@@ -612,10 +618,10 @@ importers:
version: 24.10.0 version: 24.10.0
'@vitejs/plugin-vue': '@vitejs/plugin-vue':
specifier: 'catalog:' specifier: 'catalog:'
version: 6.0.1(vite@7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1))(vue@3.5.24(typescript@5.9.3)) version: 6.0.1(vite@7.2.2(@types/node@24.10.0)(jiti@1.21.7)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1))(vue@3.5.24(typescript@5.9.3))
'@vitejs/plugin-vue-jsx': '@vitejs/plugin-vue-jsx':
specifier: 'catalog:' specifier: 'catalog:'
version: 5.1.1(vite@7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1))(vue@3.5.24(typescript@5.9.3)) version: 5.1.1(vite@7.2.2(@types/node@24.10.0)(jiti@1.21.7)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1))(vue@3.5.24(typescript@5.9.3))
typescript: typescript:
specifier: 'catalog:' specifier: 'catalog:'
version: 5.9.3 version: 5.9.3
...@@ -627,10 +633,10 @@ importers: ...@@ -627,10 +633,10 @@ importers:
version: 0.26.0(@babel/parser@7.28.5)(rollup@4.53.2)(vue@3.5.24(typescript@5.9.3)) version: 0.26.0(@babel/parser@7.28.5)(rollup@4.53.2)(vue@3.5.24(typescript@5.9.3))
vite: vite:
specifier: ^7.1.2 specifier: ^7.1.2
version: 7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1) version: 7.2.2(@types/node@24.10.0)(jiti@1.21.7)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1)
vite-plugin-qiankun: vite-plugin-qiankun:
specifier: 'catalog:' specifier: 'catalog:'
version: 1.0.15(typescript@5.9.3)(vite@7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1)) version: 1.0.15(typescript@5.9.3)(vite@7.2.2(@types/node@24.10.0)(jiti@1.21.7)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1))
vue-tsc: vue-tsc:
specifier: 'catalog:' specifier: 'catalog:'
version: 2.2.10(typescript@5.9.3) version: 2.2.10(typescript@5.9.3)
...@@ -9524,6 +9530,18 @@ snapshots: ...@@ -9524,6 +9530,18 @@ snapshots:
'@unrs/resolver-binding-win32-x64-msvc@1.11.1': '@unrs/resolver-binding-win32-x64-msvc@1.11.1':
optional: true optional: true
'@vitejs/plugin-vue-jsx@5.1.1(vite@7.2.2(@types/node@24.10.0)(jiti@1.21.7)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1))(vue@3.5.24(typescript@5.9.3))':
dependencies:
'@babel/core': 7.28.5
'@babel/plugin-syntax-typescript': 7.27.1(@babel/core@7.28.5)
'@babel/plugin-transform-typescript': 7.28.5(@babel/core@7.28.5)
'@rolldown/pluginutils': 1.0.0-beta.49
'@vue/babel-plugin-jsx': 1.5.0(@babel/core@7.28.5)
vite: 7.2.2(@types/node@24.10.0)(jiti@1.21.7)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1)
vue: 3.5.24(typescript@5.9.3)
transitivePeerDependencies:
- supports-color
'@vitejs/plugin-vue-jsx@5.1.1(vite@7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1))(vue@3.5.24(typescript@5.9.3))': '@vitejs/plugin-vue-jsx@5.1.1(vite@7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1))(vue@3.5.24(typescript@5.9.3))':
dependencies: dependencies:
'@babel/core': 7.28.5 '@babel/core': 7.28.5
...@@ -9541,6 +9559,12 @@ snapshots: ...@@ -9541,6 +9559,12 @@ snapshots:
vite: 7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1) vite: 7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1)
vue: 3.5.24(typescript@5.9.3) vue: 3.5.24(typescript@5.9.3)
'@vitejs/plugin-vue@6.0.1(vite@7.2.2(@types/node@24.10.0)(jiti@1.21.7)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1))(vue@3.5.24(typescript@5.9.3))':
dependencies:
'@rolldown/pluginutils': 1.0.0-beta.29
vite: 7.2.2(@types/node@24.10.0)(jiti@1.21.7)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1)
vue: 3.5.24(typescript@5.9.3)
'@vitejs/plugin-vue@6.0.1(vite@7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1))(vue@3.5.24(typescript@5.9.3))': '@vitejs/plugin-vue@6.0.1(vite@7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1))(vue@3.5.24(typescript@5.9.3))':
dependencies: dependencies:
'@rolldown/pluginutils': 1.0.0-beta.29 '@rolldown/pluginutils': 1.0.0-beta.29
...@@ -13899,12 +13923,34 @@ snapshots: ...@@ -13899,12 +13923,34 @@ snapshots:
- tsx - tsx
- yaml - yaml
vite-plugin-qiankun@1.0.15(typescript@5.9.3)(vite@7.2.2(@types/node@24.10.0)(jiti@1.21.7)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1)):
dependencies:
cheerio: 1.1.2
typescript: 5.9.3
vite: 7.2.2(@types/node@24.10.0)(jiti@1.21.7)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1)
vite-plugin-qiankun@1.0.15(typescript@5.9.3)(vite@7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1)): vite-plugin-qiankun@1.0.15(typescript@5.9.3)(vite@7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1)):
dependencies: dependencies:
cheerio: 1.1.2 cheerio: 1.1.2
typescript: 5.9.3 typescript: 5.9.3
vite: 7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1) vite: 7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1)
vite@7.2.2(@types/node@24.10.0)(jiti@1.21.7)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1):
dependencies:
esbuild: 0.25.3
fdir: 6.5.0(picomatch@4.0.3)
picomatch: 4.0.3
postcss: 8.5.6
rollup: 4.53.2
tinyglobby: 0.2.15
optionalDependencies:
'@types/node': 24.10.0
fsevents: 2.3.3
jiti: 1.21.7
sass: 1.94.0
terser: 5.44.1
yaml: 2.8.1
vite@7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1): vite@7.2.2(@types/node@24.10.0)(jiti@2.6.1)(sass@1.94.0)(terser@5.44.1)(yaml@2.8.1):
dependencies: dependencies:
esbuild: 0.25.3 esbuild: 0.25.3
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!