瑜璟缘官网
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

127 linhas
2.9 KiB

  1. <template>
  2. <div class="Box">
  3. <div class="leftBox">
  4. <textTitle text="新闻咨询" />
  5. <!-- <div @click="goparticulars">
  6. <detail v-for="(item, index) in newsList" :key="index" />
  7. </div> -->
  8. <div class="detailBox" v-for="(item, index) in newsList" :key="index" @click="goparticulars(item)">
  9. <div class="imgBox">
  10. <img class="img" :src="item.mainPicRealPath" />
  11. <div class="text">
  12. <h3>{{item.title}}</h3>
  13. <p v-html="item.content"></p>
  14. <span class="time">{{item.publishDate}} <span class="el-icon-view"> {{item.view}}</span></span>
  15. </div>
  16. </div>
  17. </div>
  18. <el-pagination :current-page.sync="paging.pageNum"
  19. background
  20. layout="prev, pager, next"
  21. :total="paging.total">
  22. </el-pagination>
  23. </div>
  24. <sidebar />
  25. </div>
  26. </template>
  27. <script>
  28. import textTitle from "@/components/headTail/textTitle";
  29. import sidebar from "@/components/sidebar/sidebar";
  30. import { homeService } from "@/api"
  31. import moment from "moment"
  32. export default {
  33. components: {
  34. textTitle,
  35. sidebar,
  36. },
  37. data() {
  38. return {
  39. newsList: [],
  40. paging: {
  41. pageNum: 1,
  42. pageSize: 4,
  43. total: 4
  44. }
  45. }
  46. },
  47. methods: {
  48. goparticulars(item) {
  49. let detailId= item.id + ".html"
  50. this.$router.push({name: "particulars",params:{ id: detailId, ifjournalism: 2}})
  51. },
  52. /* 新闻列表 */
  53. getNewsList() {
  54. let d = {
  55. type: 1,
  56. pageNum: this.paging.pageNum,
  57. pageSize: this.paging.pageSize
  58. }
  59. homeService.getNewsList(d).then(res => {
  60. res.list.forEach(ele => {
  61. ele.publishDate = moment(ele.publishDate).format("YYYY-MM-DD")
  62. });
  63. this.paging.total = Number(res.total)
  64. this.newsList = res.list
  65. })
  66. }
  67. },
  68. created() {
  69. this.getNewsList()
  70. }
  71. };
  72. </script>
  73. <style lang="scss" scoped>
  74. .el-pagination{
  75. text-align: center;
  76. margin-top: 20px;
  77. }
  78. .detailBox {
  79. margin-top: 30px;
  80. margin-left: 20px;
  81. h3 {
  82. font-size: 14px;
  83. padding-bottom: 4px;
  84. }
  85. .imgBox {
  86. overflow: hidden;
  87. .img {
  88. float: left;
  89. width: 150px;
  90. height: 100px;
  91. }
  92. .text {
  93. float: left;
  94. width: 630px;
  95. height: 100px;
  96. margin-left: 20px;
  97. position: relative;
  98. p {
  99. display: -webkit-box;
  100. -webkit-line-clamp: 2;
  101. -webkit-box-orient: vertical;
  102. line-height: 20px;
  103. overflow: hidden;
  104. color: #999;
  105. font-size: 12px;
  106. }
  107. .time {
  108. display: block;
  109. margin-top: 20px;
  110. position: absolute;
  111. bottom: 0;
  112. width: 100%;
  113. span{
  114. float: right;
  115. }
  116. }
  117. }
  118. }
  119. }
  120. </style>
  121. <style scoped>
  122. .detailBox .imgBox >>> span{
  123. font-size: 12px !important;
  124. }
  125. </style>