import { css } from "@linaria/core"; import Image from "@/components/Image"; import { useArticle } from "@/modules"; import { ArrowRightOutlined } from "@ant-design/icons-vue"; import { Empty } from "ant-design-vue"; import dayjs from "dayjs"; import { defineComponent, onMounted, reactive } from "vue"; import { RouterLink, useRouter } from "vue-router"; import { renderSummary, renderTitle } from "@/modules/objects"; export default defineComponent({ setup() { const storeArt = useArticle(); const router = useRouter(); const categoryId = "6464b7398dcb7ddb98b57a60"; const state = reactive({ list: [], }); onMounted(() => { getList(); }); const getList = async () => { const query = { page: 1, size: 4, query: JSON.stringify({ cid: categoryId }), }; const res = await storeArt.getArticleList(query); const list = res.list || []; state.list = list; }; const turnPage = (aid: string) => { router.push({ name: "article", params: { id: categoryId }, query: { aid }, }); }; return () => (
科研创作/ Scientific Research
{state.list.length > 0 ? (
{state.list.map((e: ArticleItem) => { return (
{ turnPage(e._id); }} >
{renderTitle(e.title)}
{renderSummary(e.summary)}
{dayjs(e.createTime).format("YYYY.MM.DD")}
); })}
) : (
)}
查看更多
); }, }); const page = css` position: relative; background: url("@/assets/bg_research.png") no-repeat center top/100% auto; .tab_list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; .list_item { width: 100%; background-color: #fff; overflow: hidden; position: relative; .item { position: relative; display: block; border-bottom: 2px solid rgba(159, 159, 159, 0.5); cursor: pointer; &::before { content: ""; position: absolute; bottom: 0; right: 0; border-width: 6px; border-color: transparent rgba(159, 159, 159, 0.5) rgba(159, 159, 159, 0.5) transparent; } &::after { content: ""; position: absolute; bottom: -2px; right: 0; width: 0; height: 2px; background-color: var(--vt-c-primary); transition: width 0.3s ease-in-out; } &:hover { &::before { border-color: transparent var(--vt-c-primary) var(--vt-c-primary) transparent; } &::after { width: 100%; } img { transform: scale(1.2); } } } .list_img { width: 100%; height: 390px; overflow: hidden; } img { width: 100%; height: 390px; object-fit: cover; transition: all 0.3s ease-in-out; } .info_box { padding: 20px 18px; } .item_tit { height: 56px; font-size: 20px; line-height: 28px; color: #333333; overflow: hidden; } .item_desc { height: 72px; overflow: hidden; margin-top: 20px; font-size: 16px; line-height: 24px; font-weight: 400; color: #666666; word-break: break-all; } .item_date { font-size: 14px; margin-top: 30px; font-weight: 300; color: #999999; } } } .list_more { margin-top: 35px; text-align: center; a { color: var(--vt-c-primary); } .arrow { margin-left: 8px; padding: 2px; border: 1px solid var(--vt-c-primary); font-size: 12px; border-radius: 50%; } } `;