diff --git a/frontend/src/lang/package/en.ts b/frontend/src/lang/package/en.ts index e66e1354..a3e5585b 100644 --- a/frontend/src/lang/package/en.ts +++ b/frontend/src/lang/package/en.ts @@ -8,6 +8,7 @@ export default { edit: "Edit", delete: "Delete", add: "Add", + clear: "Clear", export: "Export", import: "Import", query: "Query", diff --git a/frontend/src/lang/package/zh-cn.ts b/frontend/src/lang/package/zh-cn.ts index e4acb307..27eacf10 100644 --- a/frontend/src/lang/package/zh-cn.ts +++ b/frontend/src/lang/package/zh-cn.ts @@ -8,6 +8,7 @@ export default { edit: "编辑", delete: "删除", add: "添加", + clear: "清除", export: "导出", import: "导入", query: "查询", diff --git a/frontend/src/store/modules/tags-view.store.ts b/frontend/src/store/modules/tags-view.store.ts index 7768f06d..1054f2c0 100644 --- a/frontend/src/store/modules/tags-view.store.ts +++ b/frontend/src/store/modules/tags-view.store.ts @@ -39,7 +39,6 @@ export const useTagsViewStore = defineStore("tagsView", () => { // 如果视图需要缓存(keepAlive),则将其路由名称添加到缓存视图列表中 if (view.keepAlive) { cachedViews.value.push(viewName); - console.log("cachedViews",cachedViews.value) } } diff --git a/frontend/src/utils/quickStartManager.ts b/frontend/src/utils/quickStartManager.ts index 85c1ce86..c586360b 100644 --- a/frontend/src/utils/quickStartManager.ts +++ b/frontend/src/utils/quickStartManager.ts @@ -3,10 +3,8 @@ import { ElMessage } from 'element-plus'; // 快速链接数据类型 export interface QuickLink { title: string; - description: string; icon: string; href: string; - action: 'navigate' | 'external'; id?: string; } @@ -28,40 +26,7 @@ class QuickStartManager { // 获取默认链接 private getDefaultLinks(): QuickLink[] { - return [ - { - id: 'user-management', - title: "用户管理", - description: "管理系统用户信息", - icon: "User", - href: "/system/user", - action: "navigate" - }, - { - id: 'monitor', - title: "系统监控", - description: "监控系统状态", - icon: "Monitor", - href: "/monitor", - action: "navigate" - }, - { - id: 'baidu', - title: "百度搜索", - description: "访问百度搜索引擎", - icon: "Search", - href: "https://www.baidu.com", - action: "external" - }, - { - id: 'github', - title: "GitHub", - description: "访问代码托管平台", - icon: "Monitor", - href: "https://github.com", - action: "external" - } - ]; + return []; } // 保存快速链接 @@ -78,9 +43,6 @@ class QuickStartManager { addQuickLink(link: QuickLink): void { const links = this.getQuickLinks(); - // 生成唯一ID - link.id = link.id || `link-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`; - // 检查是否已存在相同路径的链接 const existingIndex = links.findIndex(l => l.href === link.href); if (existingIndex !== -1) { @@ -105,28 +67,19 @@ class QuickStartManager { } } + // 清空所有快速链接 + clearQuickLinks(): void { + this.saveQuickLinks([]); + } // 从路由或菜单信息创建快速链接 - createQuickLinkFromRoute(route: any, customTitle?: string, customDescription?: string): QuickLink { - // 优先使用路由对象上的icon字段,如果没有则使用默认图标 - let routeIcon = route.icon || 'Link'; - - // 处理Element Plus图标名称,转换为组件名称 - if (routeIcon.startsWith('el-icon-')) { - // 将 el-icon-Odometer 转换为 Odometer - routeIcon = routeIcon.replace('el-icon-', ''); - // 首字母大写 - routeIcon = routeIcon.charAt(0).toUpperCase() + routeIcon.slice(1); - } - + createQuickLinkFromRoute(route: any, customTitle?: string): QuickLink { // 确定最终使用的标题 - 优先使用route.title const finalTitle = customTitle || route.title || route.name || '未命名页面'; return { title: finalTitle, - description: customDescription || `快速访问 ${route.title || route.name || '页面'}`, - icon: routeIcon, + icon: route.icon, href: route.fullPath || route.path, - action: 'navigate', id: `route-${route.path.replace(/\//g, '-')}-${Date.now()}` }; } diff --git a/frontend/src/views/dashboard/components/AddQuickLinkDialog.vue b/frontend/src/views/dashboard/components/AddQuickLinkDialog.vue deleted file mode 100644 index efc44784..00000000 --- a/frontend/src/views/dashboard/components/AddQuickLinkDialog.vue +++ /dev/null @@ -1,232 +0,0 @@ - - - - - diff --git a/frontend/src/views/dashboard/components/QuickStart.vue b/frontend/src/views/dashboard/components/QuickStart.vue deleted file mode 100644 index 3f299f68..00000000 --- a/frontend/src/views/dashboard/components/QuickStart.vue +++ /dev/null @@ -1,298 +0,0 @@ - - - - - diff --git a/frontend/src/views/dashboard/components/index.ts b/frontend/src/views/dashboard/components/index.ts deleted file mode 100644 index f7e9f364..00000000 --- a/frontend/src/views/dashboard/components/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { default as QuickStart } from './QuickStart.vue'; -export { default as AddQuickLinkDialog } from './AddQuickLinkDialog.vue'; diff --git a/frontend/src/views/dashboard/workplace.vue b/frontend/src/views/dashboard/workplace.vue index b4f98c8c..c38822ef 100644 --- a/frontend/src/views/dashboard/workplace.vue +++ b/frontend/src/views/dashboard/workplace.vue @@ -33,7 +33,8 @@ 进行中的项目 全部项目 - + + @@ -61,58 +62,108 @@ - - - - - -
-
-
- {{ item.notice_title }} - - {{ getNoticeTypeText(item.notice_type) }} - -
- {{ formatTime(item.created_at) }} -
-
{{ item.notice_content }}
-
- {{ item.creator?.name }} 发布 - - 详情↗ - -
-
-
-
-
+ + + + + + +
+
+
+ {{ item.notice_title }} + + {{ getNoticeTypeText(item.notice_type) }} + +
+ {{ formatTime(item.created_at) }} +
+
{{ item.notice_content }}
+
+ {{ item.creator?.name }} 发布 + + 详情↗ + +
+
+
+
+
- - - - - - - - {{ item.member }} - - - - + + + + + + + + + {{ item.member }} + + + + - + + + + + + + + +
+
+ + {{ item.title }} + + + + + + + + @@ -128,16 +179,25 @@ import { EChartsOption } from 'echarts' import { useUserStore } from "@/store/index"; import { greetings } from '@/utils/common'; -import QuickStart from './components/QuickStart.vue'; import NoticeAPI, { NoticeTable } from '@/api/system/notice'; -import { ref, onMounted } from 'vue'; +import { ref, onMounted, reactive } from 'vue'; +import { useI18n } from 'vue-i18n'; +import { useRouter } from 'vue-router'; +import { QuestionFilled, Close, CircleCloseFilled } from "@element-plus/icons-vue"; +import { ElMessage, ElMessageBox } from 'element-plus'; +import { quickStartManager, type QuickLink } from '@/utils/quickStartManager'; const userStore = useUserStore(); const timefix = greetings(); +const { t } = useI18n(); +const router = useRouter(); // 通知公告数据 const noticeList = ref([]); +// 快速链接数据 +const quickLinks = ref(quickStartManager.getQuickLinks()); + // 格式化时间 const formatTime = (time: string | undefined) => { if (!time) return ''; @@ -195,9 +255,68 @@ const getNoticeList = async () => { } }; -// 组件挂载时获取数据 +// 处理快速链接点击 +const handleQuickLinkClick = (item: QuickLink) => { + if (item.href) { + // 内部路由跳转 + router.push(item.href).catch(() => { + ElMessage.warning(`路由 ${item.href} 不存在,请检查配置`); + }); + ElMessage.success(`进入:${item.title}`); + } else { + ElMessage.info(`${item.title} 功能待开发`); + } +}; + +// 处理删除链接 +const handleDeleteLink = (item: QuickLink) => { + ElMessageBox.confirm( + `确定要取消收藏"${item.title}"吗?`, + '取消收藏确认', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + } + ).then(() => { + if (item.id) { + quickStartManager.removeQuickLink(item.id); + ElMessage.success(`已取消收藏:${item.title}`); + } + }).catch(() => { + // 用户取消删除 + }); +}; + +const clearBookmarks = () => { + ElMessageBox.confirm( + '确定要清空收藏吗?', + '清空收藏确认', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + } + ).then(() => { + quickStartManager.clearQuickLinks(); + ElMessage.success('已清空收藏'); + }).catch(() => {}) +} + +// 监听快速链接变化 +const updateQuickLinks = (links: QuickLink[]) => { + quickLinks.value = links; +}; + +// 组件挂载时获取数据和添加监听器 onMounted(() => { getNoticeList(); + quickStartManager.addListener(updateQuickLinks); +}); + +// 组件卸载时移除监听器 +onUnmounted(() => { + quickStartManager.removeListener(updateQuickLinks); }); defineOptions({ @@ -279,7 +398,6 @@ const projectNotice = [ ]; - const chartOptions = reactive({ tooltip: { trigger: 'item' }, legend: { data: ['个人', '团队', '部门'] }, @@ -307,18 +425,9 @@ const chartOptions = reactive({ }] }); - -