perf: 优化bbs前端整体显示

This commit is contained in:
橙子
2025-02-04 15:23:20 +08:00
parent 9a73789788
commit bce9b58265
10 changed files with 138 additions and 52 deletions

View File

@@ -9,7 +9,7 @@
<el-button
style="width: 100%; margin-bottom: 0.8rem"
@click="loadDiscuss(true)"
>主题封面</el-button
>主题首页</el-button
>
<el-button
v-if="isAddArticle && isArticleUser"
@@ -19,7 +19,7 @@
>添加子文章</el-button
>
<!--目录在这里 -->
<el-scrollbar height="410px">
<el-scrollbar style="min-height: 410px">
<TreeArticleInfo
:data="articleData"
@remove="delArticle"
@@ -34,19 +34,19 @@
</InfoCard>
</el-col>
<el-col :span="24">
<InfoCard :items="items" header="作者分享" text="更多">
<InfoCard :items="authorList" :isPadding="false" header="作者分享" height="410" text="更多">
<template #item="temp">
<AvatarInfo />
</template>
</InfoCard>
</el-col>
<el-col :span="24">
<InfoCard :items="items" header="内容推荐" text="更多">
<template #item="temp">
<AvatarInfo />
<ThemeData :themeData="temp"/>
</template>
</InfoCard>
</el-col>
<!-- <el-col :span="24">-->
<!-- <InfoCard :items="items" header="内容推荐" text="更多">-->
<!-- <template #item="temp">-->
<!-- <AvatarInfo />-->
<!-- </template>-->
<!-- </InfoCard>-->
<!-- </el-col>-->
</el-row>
</el-col>
@@ -155,19 +155,24 @@
</InfoCard>
</el-col>
<el-col :span="24">
<InfoCard :items="items" header="其他" text="更多">
<InfoCard :items="themeList" :isPadding="false" header="推荐主题" text="更多" height="500">
<template #item="temp">
<AvatarInfo />
</template>
</InfoCard>
</el-col>
<el-col :span="24">
<InfoCard :items="items" header="其他" text="更多">
<template #item="temp">
<AvatarInfo />
<ThemeData :themeData="temp"/>
</template>
</InfoCard>
<!-- <InfoCard :items="items" header="其他" text="更多">-->
<!-- <template #item="temp">-->
<!-- <AvatarInfo />-->
<!-- </template>-->
<!-- </InfoCard>-->
</el-col>
<!-- <el-col :span="24">-->
<!-- <InfoCard :items="items" header="其他" text="更多">-->
<!-- <template #item="temp">-->
<!-- <AvatarInfo />-->
<!-- </template>-->
<!-- </InfoCard>-->
<!-- </el-col>-->
</el-row>
</el-col>
</el-row>
@@ -192,17 +197,20 @@ import {
import Breadcrumb from "@/components/Breadcrumb/index.vue";
import { getPermission } from "@/utils/auth";
import useUserStore from "@/stores/user.js";
import ThemeData from "@/views/home/components/RecommendTheme/index.vue";
import {getRecommendedTopic,getAuthorTopic} from "@/apis/analyseApi";
//数据定义
const route = useRoute();
const router = useRouter();
const spacer = h(ElDivider, { direction: "vertical" });
const items = [{ user: "用户1" }, { user: "用户2" }, { user: "用户3" }];
//子文章数据
const articleData = ref([]);
//主题内容
const discuss = ref({});
//推荐主题
const themeList=ref([]);
//作者主题
const authorList=ref([]);
//封面url
const getUrl = (str) => {
return `${import.meta.env.VITE_APP_BASEAPI}/file/${str}`;
@@ -369,11 +377,22 @@ const delArticle = (node, data) => {
});
});
};
const loadThemeData =async () => {
const {data: themeData} = await getRecommendedTopic();
themeList.value = themeData;
}
const loadAuthorData=async () => {
const {data: authorData} = await getAuthorTopic(discuss.value.user.id);
authorList.value = authorData;
}
onMounted(async () => {
await loadDiscuss();
await loadArticleData();
await loadAuthorData();
await loadThemeData();
});
watch(
() => currentArticle.value,
(val) => {
@@ -406,7 +425,7 @@ watch(
}
.article-box {
width: 1400px;
width: 1500px;
height: 100%;
.comment {
min-height: 40rem;