修复本地环境
This commit is contained in:
parent
dd6ee001f1
commit
5c21f20126
@ -1,2 +1,8 @@
|
|||||||
# API 基础地址
|
# 应用名称
|
||||||
|
VITE_APP_NAME=Yunzer
|
||||||
|
|
||||||
|
# 通用配置
|
||||||
|
VITE_APP_VERSION=1.0.0
|
||||||
|
|
||||||
|
# 接口地址
|
||||||
VITE_API_DOMAIN=http://localhost:8000
|
VITE_API_DOMAIN=http://localhost:8000
|
||||||
Binary file not shown.
Binary file not shown.
@ -1,16 +1,16 @@
|
|||||||
import { createRouter, createWebHistory } from "vue-router";
|
import { createRouter, createWebHashHistory } from "vue-router";
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(),
|
history: createWebHashHistory(),
|
||||||
routes: [
|
routes: [
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
redirect: "/index",
|
name: "index",
|
||||||
|
component: () => import("@/views/index/index.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/index",
|
path: "/index",
|
||||||
name: "index",
|
redirect: "/",
|
||||||
component: () => import("@/views/index/index.vue"),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/siteInformation",
|
path: "/siteInformation",
|
||||||
|
|||||||
@ -4,13 +4,12 @@ import { useRoute, useRouter } from "vue-router";
|
|||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import Header from "@/views/components/header.vue";
|
import Header from "@/views/components/header.vue";
|
||||||
import Footer from "@/views/components/footer.vue";
|
import Footer from "@/views/components/footer.vue";
|
||||||
import { siteInformation } from "@/api/siteInformation";
|
import { article } from "@/api/article";
|
||||||
import { technicalArticles } from "@/api/technicalArticles";
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const articleId = ref(route.query.id as string);
|
const articleId = ref(route.query.id as string);
|
||||||
const article = ref<any>(null);
|
const articleData = ref<any>(null);
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
|
||||||
// 获取图片地址
|
// 获取图片地址
|
||||||
@ -41,25 +40,11 @@ const fetchArticleDetail = async () => {
|
|||||||
|
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
// 根据来源页面调用不同的API
|
// 使用article API获取文章详情
|
||||||
const source = route.query.source as string;
|
const response: any = await article.getArticleDetail(articleId.value);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.data?.data) {
|
if (response.data?.data) {
|
||||||
article.value = response.data.data;
|
articleData.value = response.data.data;
|
||||||
} else {
|
} else {
|
||||||
ElMessage.warning(response.data?.msg || "获取文章详情失败");
|
ElMessage.warning(response.data?.msg || "获取文章详情失败");
|
||||||
router.push("/");
|
router.push("/");
|
||||||
@ -108,41 +93,41 @@ onMounted(() => {
|
|||||||
<div v-else class="article-content">
|
<div v-else class="article-content">
|
||||||
<!-- 文章标题 -->
|
<!-- 文章标题 -->
|
||||||
<div class="article-header">
|
<div class="article-header">
|
||||||
<h1 class="article-title">{{ article.title }}</h1>
|
<h1 class="article-title">{{ articleData.title }}</h1>
|
||||||
<div class="article-meta">
|
<div class="article-meta">
|
||||||
<span class="article-date">
|
<span class="article-date">
|
||||||
<i class="fas fa-calendar"></i>
|
<i class="fas fa-calendar"></i>
|
||||||
{{ formatDate(article.publishdate || article.created_at) }}
|
{{ formatDate(articleData.publishdate || articleData.created_at) }}
|
||||||
</span>
|
</span>
|
||||||
<span class="article-views" v-if="article.view">
|
<span class="article-views" v-if="articleData.view">
|
||||||
<i class="fas fa-eye"></i>
|
<i class="fas fa-eye"></i>
|
||||||
{{ article.view }} 阅读
|
{{ articleData.view }} 阅读
|
||||||
</span>
|
</span>
|
||||||
<span class="article-likes" v-if="article.likes">
|
<span class="article-likes" v-if="articleData.likes">
|
||||||
<i class="fas fa-heart"></i>
|
<i class="fas fa-heart"></i>
|
||||||
{{ article.likes }} 点赞
|
{{ articleData.likes }} 点赞
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 文章图片 -->
|
<!-- 文章图片 -->
|
||||||
<div class="article-image" v-if="article.image">
|
<div class="article-image" v-if="articleData.image">
|
||||||
<img :src="getImageUrl(article.image)" :alt="article.title" />
|
<img :src="getImageUrl(articleData.image)" :alt="articleData.title" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 文章正文 -->
|
<!-- 文章正文 -->
|
||||||
<div class="article-body">
|
<div class="article-body">
|
||||||
<div
|
<div
|
||||||
class="article-text"
|
class="article-text"
|
||||||
v-html="article.content"
|
v-html="articleData.content"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 文章标签 -->
|
<!-- 文章标签 -->
|
||||||
<div class="article-tags" v-if="article.tags && article.tags.length">
|
<div class="article-tags" v-if="articleData.tags && articleData.tags.length">
|
||||||
<span class="tag-label">标签:</span>
|
<span class="tag-label">标签:</span>
|
||||||
<el-tag
|
<el-tag
|
||||||
v-for="tag in article.tags"
|
v-for="tag in articleData.tags"
|
||||||
:key="tag"
|
:key="tag"
|
||||||
size="small"
|
size="small"
|
||||||
class="article-tag"
|
class="article-tag"
|
||||||
|
|||||||
@ -113,7 +113,7 @@ const fetchResourceDetail = async () => {
|
|||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
// 由于所有资源都来自downloadGames页面,统一使用downloadGames API
|
// 由于所有资源都来自downloadGames页面,统一使用downloadGames API
|
||||||
const response = await resourceApi.getResourceDetail(resourceId.value);
|
const response:any = await resourceApi.getResourceDetail(resourceId.value);
|
||||||
|
|
||||||
if (response.data?.data) {
|
if (response.data?.data) {
|
||||||
resourceData.value = response.data.data;
|
resourceData.value = response.data.data;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user