Files
Yi.Admin/Yi.BBS.Vue3/src/views/Index.vue

178 lines
4.7 KiB
Vue
Raw Normal View History

2023-12-12 18:10:04 +08:00
<template>
<div style="width: 1200px">
2023-03-26 01:28:48 +08:00
<el-row :gutter="20" class="top-div">
<el-col :span="17">
<div class="scrollbar">
<ScrollbarInfo />
</div>
<el-row class="left-div">
2023-12-12 18:10:04 +08:00
<el-col
:span="8"
v-for="i in plateList"
class="plate"
:style="{
'padding-left': i % 3 == 1 ? 0 : 0.2 + 'rem',
'padding-right': i % 3 == 0 ? 0 : 0.2 + 'rem',
}"
>
<PlateCard
:name="i.name"
:introduction="i.introduction"
:id="i.id"
/>
2023-03-05 20:30:44 +08:00
</el-col>
2023-03-26 01:28:48 +08:00
<el-col :span="24" v-for="i in discussList">
<DisscussCard :discuss="i" />
</el-col>
<el-col :span="24">
2023-12-12 18:10:04 +08:00
<el-empty
v-show="discussList.length <= 0"
description="推荐位置,空空如也"
/>
2023-03-26 01:28:48 +08:00
</el-col>
</el-row>
2023-03-03 23:56:37 +08:00
</el-col>
2023-03-26 01:28:48 +08:00
<el-col :span="7">
<el-row class="right-div">
<el-col :span="24">
<el-carousel trigger="click" height="150px">
<el-carousel-item v-for="item in bannerList">
2023-12-12 18:10:04 +08:00
<div class="carousel-font" :style="{ color: item.color }">
{{ item.name }}
</div>
<el-image
style="width: 100%; height: 100%"
:src="item.logo"
fit="cover"
/>
2023-03-26 01:28:48 +08:00
</el-carousel-item>
</el-carousel>
</el-col>
2023-12-12 18:10:04 +08:00
<el-col :span="24">
2023-03-26 01:28:48 +08:00
<InfoCard header="访问统计" class="VisitsLineChart" text="详情">
<template #content>
<VisitsLineChart />
</template>
</InfoCard>
</el-col>
<el-col :span="24">
<InfoCard header="简介" text="详情">
<template #content>
<div class="introduce">
2023-12-12 18:10:04 +08:00
没有什么能够阻挡人类对代码<span style="color: #1890ff"
>优雅</span
>的追求
2023-03-26 01:28:48 +08:00
</div>
</template>
</InfoCard>
</el-col>
<el-col :span="24">
2023-12-12 18:10:04 +08:00
<InfoCard :items="items" header="本月排行" text="更多">
2023-03-26 01:28:48 +08:00
<template #item="temp">
<AvatarInfo>
2023-12-12 18:10:04 +08:00
<template #bottom> 本月积分290 </template>
2023-03-26 01:28:48 +08:00
</AvatarInfo>
</template>
</InfoCard>
</el-col>
<el-col :span="24">
2023-12-12 18:10:04 +08:00
<InfoCard :items="items" header="推荐好友" text="更多">
2023-03-26 01:28:48 +08:00
<template #item="temp">
<AvatarInfo />
</template>
</InfoCard>
</el-col>
2023-12-12 18:10:04 +08:00
<el-col :span="24" style="background: transparent">
2023-03-26 01:28:48 +08:00
<BottomInfo />
</el-col>
</el-row>
</el-col>
</el-row>
</div>
2023-03-03 21:58:58 +08:00
</template>
2023-03-05 20:30:44 +08:00
<script setup>
2023-12-12 18:10:04 +08:00
import { onMounted, ref, reactive } from "vue";
import DisscussCard from "@/components/DisscussCard.vue";
import InfoCard from "@/components/InfoCard.vue";
import PlateCard from "@/components/PlateCard.vue";
import ScrollbarInfo from "@/components/ScrollbarInfo.vue";
import AvatarInfo from "@/components/AvatarInfo.vue";
import BottomInfo from "@/components/BottomInfo.vue";
import VisitsLineChart from "@/components/echars/VisitsLineChart.vue";
import { access } from "@/apis/accessApi.js";
import { getList } from "@/apis/plateApi.js";
import { getList as bannerGetList } from "@/apis/bannerApi.js";
import { getList as discussGetList } from "@/apis/discussApi.js";
2023-03-26 01:28:48 +08:00
var plateList = ref([]);
var discussList = ref([]);
var bannerList = ref([]);
2023-12-12 18:10:04 +08:00
const items = [{ user: "用户1" }, { user: "用户2" }, { user: "用户3" }];
//主题查询参数
2023-03-26 01:28:48 +08:00
const query = reactive({
2023-12-12 18:10:04 +08:00
skipCount: 1,
maxResultCount: 10,
isTop: true,
2023-03-12 19:49:08 +08:00
});
2023-03-11 15:02:50 +08:00
2023-03-20 19:46:47 +08:00
//初始化
2023-03-26 01:28:48 +08:00
onMounted(async () => {
2023-12-12 18:10:04 +08:00
access();
const { data: plateData } = await getList();
plateList.value = plateData.items;
const { data: discussData } = await discussGetList(query);
discussList.value = discussData.items;
const { data: bannerData } = await bannerGetList();
bannerList.value = bannerData.items;
2023-03-26 01:28:48 +08:00
});
2023-03-05 20:30:44 +08:00
</script>
2023-12-12 18:10:04 +08:00
<style scoped>
2023-03-26 01:28:48 +08:00
.introduce {
2023-12-12 18:10:04 +08:00
color: rgba(0, 0, 0, 0.45);
2023-03-26 01:28:48 +08:00
font-size: small;
2023-03-10 22:02:19 +08:00
}
2023-03-26 01:28:48 +08:00
.plate {
2023-03-05 20:30:44 +08:00
background: transparent !important;
}
2023-03-26 01:28:48 +08:00
.left-div .el-col {
2023-12-12 18:10:04 +08:00
background-color: #ffffff;
2023-03-26 01:28:48 +08:00
margin-bottom: 1rem;
2023-03-03 23:56:37 +08:00
}
2023-03-26 01:28:48 +08:00
.right-div .el-col {
2023-12-12 18:10:04 +08:00
background-color: #ffffff;
2023-03-03 23:56:37 +08:00
margin-bottom: 1rem;
}
2023-03-26 01:28:48 +08:00
.carousel-font {
2023-03-20 19:46:47 +08:00
position: absolute;
2023-03-26 01:28:48 +08:00
z-index: 1;
top: 10%;
left: 10%;
2023-03-20 19:46:47 +08:00
}
2023-03-03 21:58:58 +08:00
2023-03-26 01:28:48 +08:00
.top-div {
2023-03-07 00:02:48 +08:00
padding-top: 0.5rem;
2023-03-03 23:56:37 +08:00
}
2023-03-26 01:28:48 +08:00
.scrollbar {
display: block;
2023-03-07 00:02:48 +08:00
margin-bottom: 0.5rem;
2023-03-05 20:30:44 +08:00
}
2023-12-12 18:10:04 +08:00
.VisitsLineChart >>> .el-card__body {
2023-03-26 01:28:48 +08:00
padding: 0.5rem;
}
2023-03-03 21:58:58 +08:00
</style>