Right.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <div class="news-content col-md-9">
  3. <h4><span class="label label-primary">News</span>新闻资讯</h4>
  4. <div class="news" v-for="item in news_show">
  5. <div class="new">
  6. <div style="width: 120px;">
  7. <div class="thumbnail-news">
  8. <nuxt-link :to="'/news/'+item.id" :title=item.title>
  9. <img class="content-thumbnail" alt="新闻缩略图" :src=item.thumbnail></nuxt-link>
  10. </div>
  11. </div>
  12. <div class="news-list">
  13. <h5> <nuxt-link :to="'/news/'+item.id" :title=item.title>{{item.title}}</nuxt-link></h5>
  14. <p v-text=item.summary></p>
  15. <div class="text-muted">
  16. <span class="pull-left " >{{item.created | date}}</span>
  17. <span class="pull-right text-num" >
  18. <i class="fa fa-eye" style="margin-left: 15px;"></i>{{item.viewCount}}</span>
  19. </div>
  20. </div>
  21. </div>
  22. </div>
  23. <page :total="totalCount" :page-size="pageSize"
  24. :current="nowPage" v-on:childEvent="listenPage"></page>
  25. </div>
  26. </template>
  27. <script>
  28. import Page from '~components/common/page/pageComponent.vue'
  29. export default {
  30. data () {
  31. return {
  32. pageSize: 10,
  33. nowPage: 1
  34. }
  35. },
  36. components: {
  37. Page
  38. },
  39. computed: {
  40. new () {
  41. return this.$store.state.newsData.newsPage.allNews
  42. },
  43. news_show () {
  44. return this.new.data.content
  45. },
  46. totalCount () {
  47. return this.new.data.count
  48. }
  49. },
  50. filters: {
  51. date: function (input) {
  52. const d = new Date(input)
  53. const year = d.getFullYear()
  54. const month = d.getMonth() + 1
  55. const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
  56. const hour = d.getHours()
  57. const minutes = d.getMinutes()
  58. return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes
  59. }
  60. },
  61. methods: {
  62. listenPage: function (changedPage) {
  63. this.nowPage = changedPage
  64. this.$emit('childEvent', this.nowPage)
  65. }
  66. }
  67. }
  68. </script>
  69. <style scoped>
  70. .news-content{
  71. padding-left: 0;
  72. float: right;
  73. width: 75%;
  74. padding-bottom: 15px;
  75. }
  76. .news-content .news{
  77. margin-bottom: 15px;
  78. }
  79. .news-content h4{
  80. border-bottom: #e8e8e8 1px solid;
  81. line-height: 40px;
  82. margin: 0;
  83. font-weight: normal;
  84. font-size: 18px;
  85. }
  86. .news-content h4 span.label{
  87. font-size: 12px;
  88. padding: 5px 2px;
  89. margin-right: 8px;
  90. }
  91. .news-content h4 span.label-primary{
  92. background: #5078cb;
  93. }
  94. .news {
  95. display: table;
  96. }
  97. .new {
  98. display: table-row;
  99. }
  100. .new >div{
  101. display: table-cell;
  102. vertical-align: middle;
  103. border-bottom: 1px dashed #ccc;
  104. }
  105. .thumbnail-news {
  106. width: 160px;
  107. height: 100px;
  108. overflow: hidden;
  109. margin: 20px 0 20px;
  110. }
  111. .thumbnail-news img {
  112. width: 160px;
  113. height: 100px;
  114. vertical-align: middle;
  115. border: 0;
  116. }
  117. .news-list {
  118. padding: 10px 10px 10px 20px;
  119. }
  120. .new h5 {
  121. font-size: 16px;
  122. font-weight: 600;
  123. }
  124. .news .new h5 a {
  125. color: #323232;
  126. font-weight: normal;
  127. }
  128. .news .new h5 a:hover {
  129. color: #5078cb;
  130. text-decoration: underline !important;
  131. }
  132. .news-list >p{
  133. line-height: 25px;
  134. }
  135. .news-list .pull-right i {
  136. margin-right: 10px;
  137. }
  138. .news-content a{
  139. cursor: pointer;
  140. }
  141. </style>