From 992b7e571ba68d40091aa7e174089d8ed24d1533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=BF=97=E5=BC=BA?= <357099073@qq.com> Date: Thu, 29 Jan 2026 17:37:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A8=A1=E5=9D=97=E5=B8=82?= =?UTF-8?q?=E5=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 39 +- .../apps/cms/analytics/content/index.vue | 27 +- src/views/moduleshop/center/index.vue | 647 +++++++++++++++++ .../moduleshop/components/createModules.vue | 312 +++++++++ src/views/moduleshop/index.vue | 11 + src/views/moduleshop/publish/index.vue | 512 ++++++++++++++ src/views/user/userProfile.vue | 653 +++++++++++++++++- 7 files changed, 2133 insertions(+), 68 deletions(-) create mode 100644 src/views/moduleshop/center/index.vue create mode 100644 src/views/moduleshop/components/createModules.vue create mode 100644 src/views/moduleshop/index.vue create mode 100644 src/views/moduleshop/publish/index.vue diff --git a/src/router/index.js b/src/router/index.js index 33e6e6e..ba28eaf 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,7 +1,17 @@ import { createRouter, createWebHashHistory } from "vue-router"; import { convertMenusToRoutes } from "./dynamicRoutes"; -// 静态路由:登录页独立,404 页面独立,home 导航门户独立 +// 静态子路由:需要在 Main 框架内显示的页面 +const staticMainChildren = [ + { + path: "/user/userProfile", + name: "userProfile", + component: () => import("@/views/user/userProfile.vue"), + meta: { requiresAuth: true, title: "用户中心" } + } +]; + +// 静态路由:登录页独立、home 导航门户独立、404 页面独立 const staticRoutes = [ { path: "/login", @@ -9,19 +19,20 @@ const staticRoutes = [ component: () => import("@/views/login/index.vue"), meta: { requiresAuth: false } }, - { - path: "/", - name: "Main", - component: () => import("@/views/Main.vue"), - redirect: "/dashboard", - meta: { requiresAuth: true } - }, { path: "/home", name: "Home", component: () => import("@/views/home/index.vue"), meta: { requiresAuth: true, title: "系统导航", isStandalone: true } }, + { + path: "/", + name: "Main", + component: () => import("@/views/Main.vue"), + redirect: "/dashboard", + meta: { requiresAuth: true }, + children: staticMainChildren + }, { path: "/:pathMatch(.*)*", name: "NotFound", @@ -93,14 +104,14 @@ function addDynamicRoutes(menus) { router.removeRoute('Main'); } - // 重新添加主路由 + // 重新添加主路由,合并静态子路由和动态路由 router.addRoute({ path: "/", name: "Main", component: () => import("@/views/Main.vue"), redirect: "/dashboard", meta: { requiresAuth: true }, - children: dynamicRoutes // 嵌套路由直接加入 children + children: [...staticMainChildren, ...dynamicRoutes] // 合并静态和动态子路由 }); dynamicRoutesAdded = true; @@ -159,17 +170,11 @@ router.beforeEach(async (to, from, next) => { if (!dynamicRoutesAdded) { await loadAndAddDynamicRoutes(); - // 路由加载后重新导航,确保路由匹配正确 + // 路由加载后重新导航,确保路由匹配正确 next({ path: to.path, replace: true }); return; } - // 如果匹配不到路由,跳转到首页导航门户 - if (to.matched.length === 0) { - next({ path: "/home" }); - return; - } - next(); }); diff --git a/src/views/apps/cms/analytics/content/index.vue b/src/views/apps/cms/analytics/content/index.vue index a502f6a..1a2895f 100644 --- a/src/views/apps/cms/analytics/content/index.vue +++ b/src/views/apps/cms/analytics/content/index.vue @@ -5,11 +5,8 @@
{{ card.label }}
{{ card.count.toLocaleString() }}
-
- 昨日 - - {{ card.trend >= 0 ? "+" : "" }}{{ card.trend }} - +
+ 昨日 {{ card.yesterday || 0 }}
@@ -72,7 +69,7 @@ import { getContentStats } from "@/api/analytics"; interface TopCard { label: string; count: number; - trend: number; + yesterday?: number; } interface HotArticle { @@ -92,10 +89,10 @@ const barChart = shallowRef(null); const categoryChart = shallowRef(null); const topCards = ref([ - { label: "总发布量", count: 0, trend: 0 }, - { label: "本月新增", count: 0, trend: 0 }, - { label: "总点赞量", count: 0, trend: 0 }, - { label: "总访问量", count: 0, trend: 0 }, + { label: "总发布量", count: 0 }, + { label: "本月新增", count: 0 }, + { label: "总点赞量", count: 0 }, + { label: "总访问量", count: 0 }, ]); const hotContent = ref([]); @@ -103,13 +100,13 @@ const hotContent = ref([]); async function fetchContentStats() { const res = await getContentStats(); if (res.code === 200 && res.data) { - const { overview, hot_articles } = res.data; + const { total_articles, month_articles, total_likes, total_views, hot_articles } = res.data; topCards.value = [ - { label: "总发布量", count: overview.total_articles.value, trend: overview.total_articles.growth }, - { label: "本月新增", count: overview.month_new.value, trend: overview.month_new.growth }, - { label: "总点赞量", count: overview.total_likes.value, trend: overview.total_likes.growth }, - { label: "总访问量", count: overview.total_views.value, trend: overview.total_views.growth }, + { label: "总发布量", count: total_articles || 0 }, + { label: "本月新增", count: month_articles || 0 }, + { label: "总点赞量", count: total_likes || 0 }, + { label: "总访问量", count: total_views || 0 }, ]; hotContent.value = hot_articles || []; diff --git a/src/views/moduleshop/center/index.vue b/src/views/moduleshop/center/index.vue new file mode 100644 index 0000000..b5af314 --- /dev/null +++ b/src/views/moduleshop/center/index.vue @@ -0,0 +1,647 @@ + + + + + diff --git a/src/views/moduleshop/components/createModules.vue b/src/views/moduleshop/components/createModules.vue new file mode 100644 index 0000000..c8188eb --- /dev/null +++ b/src/views/moduleshop/components/createModules.vue @@ -0,0 +1,312 @@ + + + + + diff --git a/src/views/moduleshop/index.vue b/src/views/moduleshop/index.vue new file mode 100644 index 0000000..2fa6465 --- /dev/null +++ b/src/views/moduleshop/index.vue @@ -0,0 +1,11 @@ + + + + + \ No newline at end of file diff --git a/src/views/moduleshop/publish/index.vue b/src/views/moduleshop/publish/index.vue new file mode 100644 index 0000000..803a68e --- /dev/null +++ b/src/views/moduleshop/publish/index.vue @@ -0,0 +1,512 @@ + + + + + diff --git a/src/views/user/userProfile.vue b/src/views/user/userProfile.vue index d61d250..fc24d66 100644 --- a/src/views/user/userProfile.vue +++ b/src/views/user/userProfile.vue @@ -1,58 +1,639 @@ -