deptNews.vue 1.73 KB
<template>
    <div class="deptNews">
        <div class="title">公司新闻</div>
        <div class="lookMore" @click="newsDetail">查看更多</div>
        <div class="content heightCut44">
          <dv-scroll-board @click="handleClick" :config="config" style="width:calc(100% - 0.01rem);height:calc(100% - 0.01rem)" />
        </div>
    </div>
</template>

<script>
import * as API_BASIC from '@/api/sys.basic.js'

export default {
  data () {
    return {
      config: {
        columnWidth: [350, 100],
        oddRowBGC: 'rgba(47,219,243,0.15)',
        evenRowBGC: 'rgba(47,219,243,0.05)',
        data: []
      }
    }
  },
  mounted () {
    this.getNewsList()
  },
  methods: {
    // 查询概况页面数据
    getNewsList () {
      API_BASIC.getNewsPageList({ _index: 1, _size: 10 }).then(res => {
        const _newsList = res.data.records
        this.newsList = _newsList
        const _data = []
        _newsList.forEach(element => {
          _data.push([element.title, element.releaseDate ? element.releaseDate.substring(0, 10) : ''])
        })
        this.config = {
          columnWidth: [300, 120],
          oddRowBGC: 'rgba(47,219,243,0.15)',
          evenRowBGC: 'rgba(47,219,243,0.05)',
          data: _data
        }
      })
    },
    newsDetail () {
      this.$router.push('/companyNews')
    },
    handleClick (row) {
      this.$router.push({ path: '/newsDetail', query: { row: JSON.stringify(this.newsList[row.rowIndex]) } })
    }
  }
}
</script>

<style lang="scss" scoped>
    .deptNews{
      position: relative;
      .content{
        box-sizing: border-box;
        padding: .24rem;
        width: 100%;
      }
      ::v-deep .dv-scroll-board .rows .row-item {
        cursor: pointer;
      }
    }
</style>