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 2417238..90d0fb4 100644 Binary files a/frontend/.env.development and b/frontend/.env.development differ diff --git a/frontend/.env.production b/frontend/.env.production index 9206ce0..c779445 100644 Binary files a/frontend/.env.production and b/frontend/.env.production differ 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 }}

-
- +
+
-