123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- <template>
- <a-list :class="$style.home" :data-source="data">
- <a-skeleton active :paragraph="{ rows: 4 }" :loading="loading" />
- <a-list-item slot="renderItem" slot-scope="record, index" :class="$style.items">
- <template>
- <div :class="$style.list">
- <div :class="$style.dates">
- <span style="font-size: 22px">{{ moment(record.finishTime).format('DD') }}</span
- ><br />
- <span>{{ moment(record.finishTime).format('YYYY-MM') }}</span>
- </div>
- <a-list-item-meta :description="''">
- <a
- slot="title"
- :href="getArticleUrl(type, record)"
- target="_blank"
- rel="opener"
- :title="record.title"
- >
- {{ record.title }}
- </a>
- </a-list-item-meta>
- </div>
- </template>
- </a-list-item>
- <a-empty v-if="isempty" :class="$style.emptySize">
- <a-icon slot="image" type="sd-notebook3" />
- </a-empty>
- </a-list>
- </template>
- <script>
- import moment from 'moment'
- import homepageService from './homepage-service'
- import components from './_import-components/home-tzgg-list-import'
- export default {
- name: 'HomeTzggList',
- components,
- props: {
- type: {
- default: '',
- type: String,
- },
- newsId: {
- default: '',
- type: String,
- },
- maxResults: {
- default: 6,
- type: Number,
- },
- },
- data() {
- return {
- loading: false,
- data: [],
- skeletonLoading: true,
- isempty: false,
- moment,
- }
- },
- mounted() {
- this.loading = true
- this.getNewsList({ articleBusinessType: this.type, maxResults: this.maxResults })
- },
- methods: {
- getArticleUrl(type, record) {
- // return `?#/sd-webflow/done-pages/${record.instId}`
- return `?#/iam-audit-home-three?type=${this.newsId}&id=${record.instId}`
- },
- // 降序函数 封装
- Desc(arr, StrKey) {
- var desc = function(x, y) {
- return x[StrKey] < y[StrKey] ? 1 : -1
- }
- return arr.sort(desc)
- },
- getNewsList(params) {
- this.loading = true
- const Num = 0
- const regex = /(<([^>]+)>)/gi
- homepageService.getNews(params).then((res) => {
- this.loading = false
- if (res) {
- if (this.newsId === 'tzgg') {
- if (res.data['03'].length) {
- res.data['03'].forEach((item) => {
- item.finishTime = item.finishdate
- let content = item.inforDescription
- if (content !== null) {
- content = content.replace(regex, '')
- content = content.replace(/ /g, '')
- item.content = content
- } else {
- item.content = ''
- }
- })
- this.data = res.data['03'].splice(0, this.maxResults)
- } else {
- this.isempty = true
- }
- } else if (this.newsId === 'gxjb') {
- if (res.data['05'].length) {
- res.data['05'].forEach((item) => {
- item.finishTime = item.finishdate
- let content = item.inforDescription
- if (content !== null) {
- content = content.replace(regex, '')
- content = content.replace(/ /g, '')
- item.content = content
- } else {
- item.content = ''
- }
- })
- this.data = res.data['05'].splice(0, this.maxResults)
- } else {
- this.isempty = true
- }
- } else {
- if (res.data.length) {
- if (this.type === 'getLawInstitutions') {
- res.data.forEach((item) => {
- item.title = item.docTitle
- item.finishTime = moment(item.publishTime).format('YYYY-MM-DD')
- })
- } else {
- res.data.forEach((item) => {
- item.finishTime = moment(item.lastModifiedTime).format('YYYY-MM-DD')
- })
- }
- this.data = res.data.splice(0, this.maxResults)
- } else {
- this.isempty = true
- }
- }
- } else {
- this.isempty = true
- }
- })
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- $importcolor: #e02020;
- $importsize: 28px;
- $lineheight: 28px;
- $fonsicon-bg: 48px;
- $nodata-icon: #d9d9d9;
- .home {
- :global(.ant-table-placeholder) {
- border: 0;
- }
- .first-notice {
- max-width: 90%;
- overflow: hidden;
- text-overflow: ellipsis;
- a {
- overflow: hidden;
- font-size: $importsize;
- font-weight: bold;
- color: $importcolor;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .detail {
- max-height: 60px;
- overflow: hidden;
- line-height: $lineheight;
- }
- }
- .items {
- border-bottom: none;
- .list {
- display: flex;
- align-items: center;
- justify-content: space-between;
- width: 100%;
- :global(.ant-list-item-meta) {
- display: block;
- flex: inherit;
- width: calc(100% - 100px);
- }
- :global(.ant-badge) {
- display: inline-block;
- max-width: calc(100% - 50px);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- vertical-align: middle;
- }
- }
- .dates {
- min-width: 80px;
- margin-left: 10px;
- text-align: center;
- border: 1px solid #e8e8e8;
- border-radius: 10px;
- }
- }
- :global(.ant-tag) {
- margin-left: 10px;
- }
- :global(.ant-badge-status-primary) {
- background-color: $primary-color;
- }
- :global(.ant-badge-status-dot) {
- width: 10px;
- height: 10px;
- }
- :global(.ant-badge-status-text) {
- font-size: $font-size-lg;
- }
- }
- .empty-size {
- margin: 10% 0;
- :global(.ant-empty-image) {
- height: 50px;
- i {
- height: 100%;
- font-size: $fonsicon-bg;
- color: $nodata-icon;
- }
- }
- }
- @media screen and (min-width: 1920px) {
- .items {
- padding: 12px 0;
- }
- }
- @media screen and (min-width: 1440px) and (max-width: 1599px) {
- .items {
- padding: 10px 0;
- }
- }
- @media screen and (min-width: 1600px) and (max-width: 1919px) {
- .items {
- padding: 10px 0;
- }
- }
- @media screen and (min-width: 992px) and (max-width: 1439px) {
- .items {
- padding: 8px 0;
- }
- }
- </style>
|