school-file-portal/src/views/CatalogResource/index.vue

143 lines
3.1 KiB
Vue
Raw Normal View History

2024-06-18 02:37:00 +00:00
<template>
<div class="container">
<div class="bread-container">
<el-breadcrumb separator=">">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>专题资源</el-breadcrumb-item>
</el-breadcrumb>
</div>
<el-card style="margin-top: 20px;">
<div class="title">
专题资源
</div>
<div class="more">
2024-06-20 09:08:05 +00:00
{{ total }}个专题
2024-06-18 02:37:00 +00:00
</div>
<div class="subject-content">
2024-06-24 07:20:12 +00:00
<div class="subject-card" v-for="item in resourceList" @click="goTo(item)">
<el-card>
<img :src="item.coverUrl" />
<p class="subject-title">{{ item.catalogName }}</p>
</el-card>
<div class="subject-top">{{ item.resourceNum }}个资源</div>
2024-06-18 02:37:00 +00:00
</div>
</div>
2024-07-24 02:48:01 +00:00
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize" @pagination="getResourceListData" />
2024-06-18 02:37:00 +00:00
</el-card>
</div>
</template>
<script setup>
2024-06-20 09:08:05 +00:00
import { ref, onMounted } from 'vue'
2024-06-24 07:20:12 +00:00
import { useRouter } from 'vue-router'
2024-06-20 09:08:05 +00:00
import { getResourceCatalogList } from '@/apis/catalogResource'
2024-07-24 02:48:01 +00:00
import pagination from '@/components/Pagination/index.vue';
2024-06-20 09:08:05 +00:00
2024-06-24 07:20:12 +00:00
const router = useRouter()
2024-06-20 09:08:05 +00:00
const queryParams = ref({
pageNum: 1,
pageSize: 12
})
const resourceList = ref([])
const total = ref(0)
const getResourceListData = async () => {
const res = await getResourceCatalogList(queryParams.value)
resourceList.value = res.rows
total.value = res.total
}
2024-06-24 07:20:12 +00:00
const goTo = (item) => {
router.push({ path: `subSubject`, query: { catalogId: item.catalogId, catalogName: item.catalogName, createTime: item.createTime, resourceNum: item.resourceNum } })
}
2024-06-20 09:08:05 +00:00
onMounted(() => {
getResourceListData()
})
2024-06-18 02:37:00 +00:00
</script>
<style lang="scss" scoped>
.container {
.title {
font-size: 20px;
font-weight: bold;
}
.more {
margin-top: 10px;
margin-bottom: 20px;
font-size: 15px;
color: #8A8178;
}
.bread-container {
padding: 25px 0;
:deep(.el-breadcrumb__inner) {
color: #fff;
font-size: 16px;
}
:deep(.el-breadcrumb__separator) {
color: #fff;
}
}
.subject-banner {
margin-top: 20px;
width: 1240px;
height: 500px;
img {
width: 100%;
height: 500px;
border-radius: 5px;
}
}
.subject-content {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(3, 1fr);
gap: 10px;
.subject-card {
position: relative;
2024-06-24 07:20:12 +00:00
img {
border-radius: 10px;
width: 100%;
height: 240px;
}
.subject-title {
text-align: center;
margin-top: 5px;
font-size: 16px;
}
2024-06-18 02:37:00 +00:00
.subject-top {
position: absolute;
top: 0;
left: 0;
background-color: #FCB124;
font-size: 14px;
font-weight: bold;
color: #fff;
line-height: 28px;
width: 100px;
text-align: center;
}
}
}
.book-page {
margin-top: 20px;
display: flex;
justify-content: end
}
}
</style>