Files
template-10490/components/Index/ZSNews.vue
2025-04-17 16:22:32 +08:00

124 lines
4.2 KiB
Vue

<template>
<div class="xl:w-screen-xl m-auto px-4 sm:px-0">
<el-row :gutter="24" id="container" class="clearfix">
<el-col :span="8" :xs="24">
<el-card shadow="hover" :body-style="{ padding: '0px' }" class=" hover:bg-gray-50 cursor-pointer mb-5" >
<template #header>
<div class="text-lg font-medium">
招生就业
</div>
</template>
<div class="px-5">
<template v-for="(item,index) in zsList" :key="index">
<nuxt-link :to="`/detail/${item.articleId}.html`" class="item">
<div class="text-lg my-3 flex justify-between">
<span class="title text-gray-800 hover:text-green-700 line-clamp-2 text-sm lg:text-lg">{{ item.title }}</span>
<span class="text-gray-400 text-sm text-right w-[100px]">{{ dayjs(item.createTime).format('MM-DD') }}</span>
</div>
</nuxt-link>
</template>
</div>
</el-card>
</el-col>
<el-col :span="8" :xs="24">
<el-card shadow="hover" :body-style="{ padding: '0px' }" class=" hover:bg-gray-50 cursor-pointer mb-5" >
<template #header>
<div class="text-lg font-medium">
通知公告
</div>
</template>
<div class="px-5">
<template v-for="(item,index) in tzList" :key="index">
<nuxt-link :to="`/detail/${item.articleId}.html`" class="item">
<div class="text-lg my-3 flex justify-between">
<span class="title text-gray-800 hover:text-green-700 line-clamp-2 text-sm lg:text-lg">{{ item.title }}</span>
<span class="text-gray-400 text-sm text-right w-[100px]">{{ dayjs(item.createTime).format('MM-DD') }}</span>
</div>
</nuxt-link>
</template>
</div>
</el-card>
</el-col>
<el-col :span="8" :xs="24">
<el-card shadow="hover" :body-style="{ padding: '0px' }" class=" hover:bg-gray-50 cursor-pointer mb-5" >
<template #header>
<div class="text-lg font-medium">
教学教研
</div>
</template>
<div class="px-5">
<template v-for="(item,index) in jyList" :key="index">
<nuxt-link :to="`/detail/${item.articleId}.html`" class="item">
<div class="text-lg my-3 flex justify-between">
<span class="title text-gray-800 hover:text-green-700 line-clamp-2 text-sm lg:text-lg">{{ item.title }}</span>
<span class="text-gray-400 text-sm text-right w-[100px]">{{ dayjs(item.createTime).format('MM-DD') }}</span>
</div>
</nuxt-link>
</template>
</div>
</el-card>
</el-col>
</el-row>
</div>
<div v-if="disabled" class="px-1 text-center text-gray-500 min-h-xs">
没有更多了
</div>
</template>
<script lang="ts" setup>
import {navigateTo} from "#imports";
import dayjs from "dayjs";
import type {CmsArticle} from "~/api/cms/cmsArticle/model";
import {listCmsArticle, pageCmsArticle} from "~/api/cms/cmsArticle";
import type {CmsArticleParam} from "~/api/cms/cmsArticle/model";
import Carousel from "~/components/Index/Carousel.vue";
import HotNewsCarousel from "~/components/Index/HotNewsCarousel.vue";
const props = withDefaults(
defineProps<{
param?: CmsArticleParam;
disabled?: boolean;
categoryId?: number;
title?: string;
comments?: string;
fit?: any;
}>(),
{
fit: 'cover'
}
);
const emit = defineEmits<{
(e: 'done'): void;
}>();
const zsList = ref<CmsArticle[]>([]);
const tzList = ref<CmsArticle[]>([]);
const jyList = ref<CmsArticle[]>([]);
// 请求数据
const reload = async () => {
pageCmsArticle({
limit: 8,
recommend: 1,
parentId: 4132
}).then(res => {
zsList.value = res?.list || [];
})
pageCmsArticle({
limit: 8,
recommend: 1,
categoryId: 4152
}).then(res => {
tzList.value = res?.list || [];
})
pageCmsArticle({
limit: 8,
parentId: 4133
}).then(res => {
jyList.value = res?.list || [];
})
}
reload();
</script>