123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <template>
- <div class="news-item">
- <div class="empty" v-if="listInfo.total == 0">无快讯信息!</div>
- <a class="item" :href="'/news/' + item.nc_id + '?type=' + item.nc_type" v-for="item in listData">
- <div class="date">
- <p v-text="new Date(item.nc_publishdate).getDay()">1</p>
- <p v-text="formatTime(item.nc_publishdate)">Jan</p>
- </div>
- <div class="img" v-if="item.nc_image != null">
- <img :src="item.nc_image">
- </div>
- <div :class="{content_img: item.nc_image != null, content: item.nc_image == null}">
- <h4 v-text="item.nc_title">11</h4>
- <p v-text="item.nc_desc">11</p>
- <span v-text="item.nc_readnum" v-if="item.nc_image != null">323</span>
- </div>
- </a>
- <div class="page" v-if="listInfo.total > 10">
- <el-pagination
- @current-change="handleCurrentChange"
- :current-page="page"
- :page-size="count"
- layout="total, prev, pager, next, jumper"
- :total="listInfo.total"/>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: 'ItemView',
- data () {
- return {
- count: 10,
- page: 1
- }
- },
- computed: {
- listInfo () {
- return this.$store.state.news.list.data
- },
- listData () {
- return this.listInfo.list
- }
- },
- methods: {
- handleCurrentChange(val) {
- this.$store.dispatch('loadNewsList', {page: val, limit: this.count, type: this.step})
- },
- // 输出时间日期
- formatTime (row) {
- let count = new Date(row).getMonth()
- switch (count) {
- case 0 : return 'Jan'
- case 1 : return 'Feb'
- case 2 : return 'Mar'
- case 3 : return 'Apr'
- case 4 : return 'May'
- case 5 : return 'Jun'
- case 6 : return 'Jul'
- case 7 : return 'Aug'
- case 8 : return 'Sep'
- case 9 : return 'Oct'
- case 10 : return 'Nov'
- case 11 : return 'Dec'
- }
- }
- }
- }
- </script>
- <style scoped type="text/scss" lang="scss">
- .news-item{
- .empty{
- padding-top:120px;
- font-size: 30px;
- text-align: center;
- font-weight: bold;
- color:#333;
- }
- .page{
- padding:20px 0;
- text-align: center;
- }
- .item{
- position:relative;
- display:block;
- padding:35px 40px 35px 145px;
- border-bottom:1px solid #f1f1f1;
- &:hover{
- .date{
- p{
- color:#149ccf;
- }
- }
- .content{
- h4{
- color:#149ccf;
- }
- }
- .content_img{
- h4{
- color:#149ccf;
- }
- }
- }
- .date{
- position:absolute;
- top:35px;
- left:75px;
- width:70px;
- height:90px;
- background: #f4f4f4;
- text-align: center;
- p{
- font-size: 18px;
- font-weight: bold;
- color:#323232;
- margin:0;
- line-height: 45px;
- }
- }
- .img{
- display:inline-block;
- vertical-align: top;
- width:200px;
- height:160px;
- img{
- width:200px;
- height:160px;
- }
- }
- .content_img{
- width:520px;
- height:160px;
- display:inline-block;
- vertical-align: top;
- padding-left:30px;
- position:relative;
- h4{
- font-size: 20px;
- color:#1e1e1e;
- width:500px;
- overflow:hidden;
- text-overflow: ellipsis;
- white-space:nowrap;
- margin-bottom:25px;
- }
- p{
- font-size: 14px;
- color:#797979;
- line-height: 20px;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- span{
- position:absolute;
- bottom:0;
- left:25px;
- font-size: 14px;
- color:#797979;
- &:before{
- content: '';
- display: inline-block;
- width: 16px;
- height: 16px;
- margin-right: 10px;
- vertical-align: middle;
- background: url(/icon/new.png) no-repeat 0 2px;
- }
- }
- }
- .content{
- width:700px;
- display:inline-block;
- vertical-align: top;
- padding-left:30px;
- position:relative;
- height:90px;
- h4{
- font-size: 20px;
- color:#1e1e1e;
- width:700px;
- overflow:hidden;
- text-overflow: ellipsis;
- white-space:nowrap;
- margin-bottom:25px;
- }
- p{
- font-size: 14px;
- color:#797979;
- line-height: 20px;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- }
- }
- }
- </style>
|