From 5c21f20126907898fda0628a0d31da76a7aad31f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=AB=E5=9C=B0=E5=83=A7?= <357099073@qq.com> Date: Thu, 25 Dec 2025 23:15:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9C=AC=E5=9C=B0=E7=8E=AF?= =?UTF-8?q?=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/.env | 8 ++- frontend/.env.development | Bin 208 -> 206 bytes frontend/.env.production | Bin 208 -> 87 bytes frontend/src/router/index.ts | 10 ++-- .../src/views/components/detail_article.vue | 47 ++++++------------ .../src/views/components/detail_resource.vue | 2 +- 6 files changed, 29 insertions(+), 38 deletions(-) diff --git a/frontend/.env b/frontend/.env index 55794e0..92827e3 100644 --- a/frontend/.env +++ b/frontend/.env @@ -1,2 +1,8 @@ -# API 基础地址 +# 应用名称 +VITE_APP_NAME=Yunzer + +# 通用配置 +VITE_APP_VERSION=1.0.0 + +# 接口地址 VITE_API_DOMAIN=http://localhost:8000 \ No newline at end of file diff --git a/frontend/.env.development b/frontend/.env.development index 24172383d388fbd3b0c1aa2603d9ed9852da712f..90d0fb49ebc2af87f1fd6a937ddc4c51a7d7aeb2 100644 GIT binary patch delta 6 Ncmcb>c#d(xIRFY20{;L2 delta 9 QcmX@dc!6=kIVLU!023zz3jhEB diff --git a/frontend/.env.production b/frontend/.env.production index 9206ce0d7e58f87e3601ad57834ad8227583b809..c779445da691dc69fd56ab7a27b5595330ce5ade 100644 GIT binary patch literal 87 zcmaFAd%v>6v%aNI`xif*v*GF72CgvA5Z8Fe0MB?Ae_uyWKiiCwl7eC@ef`9OOufp| lysFe9z2rPDE@cH5SEo?-XDb#y-O~@z1QxJOOUx-w1pt@{BP##^ literal 208 zcmYk0!4APt6hzPZZTteU$6C?^(MT6s30k`ssR|<6XuDwRTdaMQ|G>PJW;QeT-kCe! zPnR~&^t~J;qr?ysu)@bOW+85w5;2zw2=O>j2?ZrX`odQHNRJye7w%+SrBZPtxa^Re xo#wCdu`yDS5?#J89xJhs!(G&JRm#d6UUxZR&5X{eWt;8(8;`wOoYg4P#~+mZB{Bd2 diff --git a/frontend/src/router/index.ts b/frontend/src/router/index.ts index 6548475..6c8bd06 100644 --- a/frontend/src/router/index.ts +++ b/frontend/src/router/index.ts @@ -1,16 +1,16 @@ -import { createRouter, createWebHistory } from "vue-router"; +import { createRouter, createWebHashHistory } from "vue-router"; const router = createRouter({ - history: createWebHistory(), + history: createWebHashHistory(), routes: [ { path: "/", - redirect: "/index", + name: "index", + component: () => import("@/views/index/index.vue"), }, { path: "/index", - name: "index", - component: () => import("@/views/index/index.vue"), + redirect: "/", }, { path: "/siteInformation", diff --git a/frontend/src/views/components/detail_article.vue b/frontend/src/views/components/detail_article.vue index 849bb3b..2d9e672 100644 --- a/frontend/src/views/components/detail_article.vue +++ b/frontend/src/views/components/detail_article.vue @@ -4,13 +4,12 @@ import { useRoute, useRouter } from "vue-router"; import { ElMessage } from "element-plus"; import Header from "@/views/components/header.vue"; import Footer from "@/views/components/footer.vue"; -import { siteInformation } from "@/api/siteInformation"; -import { technicalArticles } from "@/api/technicalArticles"; +import { article } from "@/api/article"; const route = useRoute(); const router = useRouter(); const articleId = ref(route.query.id as string); -const article = ref(null); +const articleData = ref(null); const loading = ref(true); // 获取图片地址 @@ -41,25 +40,11 @@ const fetchArticleDetail = async () => { loading.value = true; try { - // 根据来源页面调用不同的API - const source = route.query.source as string; - let response: any; - - if (source === 'siteInformation') { - response = await siteInformation.getSiteInformationDetail(articleId.value); - } else if (source === 'technicalArticles') { - response = await technicalArticles.getTechnicalArticlesDetail(articleId.value); - } else { - // 默认尝试两个API - try { - response = await siteInformation.getSiteInformationDetail(articleId.value); - } catch { - response = await technicalArticles.getTechnicalArticlesDetail(articleId.value); - } - } + // 使用article API获取文章详情 + const response: any = await article.getArticleDetail(articleId.value); if (response.data?.data) { - article.value = response.data.data; + articleData.value = response.data.data; } else { ElMessage.warning(response.data?.msg || "获取文章详情失败"); router.push("/"); @@ -108,41 +93,41 @@ onMounted(() => {
-

{{ article.title }}

+

{{ articleData.title }}

-
- +
+
-