const jcdt = { template: /*language=HTML*/ `
{{ section.label }}
共 {{ currentNews.value.length }} 条 {{ pageNumber }} / {{ pageCount }}
暂无动态
`, data() { return {activeIndex: 0, pageNumber: 1, pageSize: 3} }, props: { list: { type: Array, default: () => [] } }, computed: { currentNews() { // 默认遵循接口栏目顺序,不再按栏目名称优先选择。 const section = this.list[this.activeIndex] || this.list[0] return section ? {label: section.label, value: section.value || []} : {label: '最新动态', value: []} }, visibleNews() { const start = (this.pageNumber - 1) * this.pageSize return this.currentNews.value.slice(start, start + this.pageSize) }, pageCount() { return Math.max(1, Math.ceil(this.currentNews.value.length / this.pageSize)) } }, watch: { list() { this.selectSection(0) } }, methods: { selectSection(index) { this.activeIndex = index this.pageNumber = 1 }, onLink(item) { const url = this.isHttpOrHttps(item.href) ? item.href : "https://xgh.cug.edu.cn/" + item.href window.open(url) }, isHttpOrHttps(url) { return /^(http:\/\/|https:\/\/)/i.test(url) } }, style: /*language=CSS*/ ` /* 每页固定三行,不因展开或末页条数变化撑高相邻的模板卡片。 */ #v4-home-app .portal-news-list { min-height: 132px; } #v4-home-app .portal-news-list .portal-news-row { height: 44px; padding: 9px 0; } #v4-home-app .portal-news-pager { display: flex; flex-shrink: 0; align-items: center; gap: 8px; } #v4-home-app .portal-news-count { margin-right: 4px; color: #8a9aac; font-size: 12px; } #v4-home-app .portal-news-page { min-width: 32px; color: #637b96; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; } #v4-home-app .portal-news-pager button { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 1px solid #e4edf7; border-radius: 6px; background: #fff; color: #1687f5; font-size: 18px; cursor: pointer; } #v4-home-app .portal-news-pager button:hover:not(:disabled) { border-color: #b9d8fb; background: #f0f7ff; } #v4-home-app .portal-news-pager button:disabled { border-color: #eef2f7; background: #f8fafc; color: #c3cedb; cursor: default; } .jcdt-wrapper { width: 100%; background-size: cover; background-position: center; background-repeat: no-repeat; } .jcdt-container { width: 80%; max-width: 80%; margin: 0 auto 10px; background-color: #FFFFFF; border-radius: 12px; padding: 20px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06); } /deep/ .jcdt-title{ font-size: 30px; color: #000000; display: block; font-weight: bold; position: relative; text-align: center; padding: 20px 0; } /deep/ .jcdt-container .jcdt-title span::before { content: ''; width: 24px; height: 11px; background: url(https://www.ncu.edu.cn/images/titl.svg) no-repeat center; background-size: 24px 11px; display: inline-block; margin-right: 0; vertical-align: middle; } /deep/ .jcdt-container .jcdt-title span::after { content: ''; width: 24px; height: 11px; background: url(https://www.ncu.edu.cn/images/titr.svg) no-repeat center; background-size: 24px 11px; display: inline-block; margin-left: 0; vertical-align: middle; } /deep/ .jcdt-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; } /deep/ .jcdt-item { display: flex; flex-direction: column; padding: 16px; border: none; border-bottom: 3px solid transparent; transition: all 0.3s ease; cursor: pointer; height: auto; border-radius: 12px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); border-bottom-color: var(--color-primary); background: #ffffff; } /deep/ .jcdt-item:hover{ transform: translateY(-4px); } /deep/ .jcdt-item .date { font-size: 20px; font-weight: bold; white-space: nowrap; text-align: left; margin-bottom: 8px; transition: opacity 0.3s ease; } /deep/ .jcdt-item .title { font-size: 16px; font-weight: 600; /*margin-bottom: 12px;*/ line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; /*height: 45px;*/ } /deep/ .jcdt-item .image { width: 100%; height: 180px; margin: 0 0 16px 0; border-radius: 8px; overflow: hidden; background: #f5f5f5; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); transition: transform 0.3s ease; } /deep/ .jcdt-item .image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; } /deep/ .jcdt-item .summary { font-size: 14px; color: #666; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-align: justify; margin-bottom: 12px; } /deep/ .jcdt-item i { color: #007aff; } ` };