HotNews.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <div class="hotList">
  3. <div class="title">
  4. <h4>
  5. 今日热点
  6. </h4>
  7. </div>
  8. <ul class="messageList">
  9. <li v-for="(item, index) in hotNewsList">
  10. <span>{{ index + 1 }}</span>
  11. <NuxtLink :to="item.linkurl" target="_blank" v-show="item.islink == 1" :title="item.title">{{ item.title }}</NuxtLink>
  12. <NuxtLink :to="`/newsDetail/${item.id}`" target="_blank" v-if="item.islink == 0" :title="item.title">{{ item.title }}
  13. </NuxtLink>
  14. </li>
  15. </ul>
  16. </div>
  17. </template>
  18. <script setup>
  19. const hotNewsList = ref([])
  20. async function getPageData() {
  21. const { data: mkdata, error: mkdataError } = requestData('/web/getWebsiteArticlett', {
  22. method: 'GET',
  23. query: {
  24. 'pageSize': 14,
  25. 'level': 4,
  26. },
  27. });
  28. if (mkdataError.value) {
  29. //console.error('模块1数据上部分请求失败!', mkdataError.value);
  30. } else {
  31. if (mkdata.value) {
  32. //console.log('模块1数据上部分请求成功!', mkdata.value.data);
  33. hotNewsList.value = mkdata.value.data;
  34. }
  35. }
  36. }
  37. getPageData();
  38. </script>
  39. <style lang="less" scoped>
  40. .hotList {
  41. background: #fff;
  42. }
  43. .title {
  44. width: 380px;
  45. height: 40px;
  46. line-height: 40px;
  47. // border-top: 1px solid #139602;
  48. border-bottom: 1px solid #e7e7e7;
  49. background-color: #fbfbfb;
  50. >h4 {
  51. font-family: Microsoft YaHei, Microsoft YaHei;
  52. font-weight: 400;
  53. margin-left: 20px;
  54. font-size: 20px;
  55. color: #000000;
  56. text-align: left;
  57. font-style: normal;
  58. text-transform: none;
  59. >span {
  60. float: right;
  61. font-family: Microsoft YaHei, Microsoft YaHei;
  62. font-weight: 400;
  63. font-size: 14px;
  64. margin-right: 10px;
  65. color: #999999;
  66. text-align: left;
  67. font-style: normal;
  68. text-transform: none;
  69. }
  70. }
  71. }
  72. .messageList {
  73. height: 563px;
  74. padding-top: 15px;
  75. margin-bottom: 30px;
  76. background-color: #fbfbfb;
  77. >li {
  78. height: 24px;
  79. margin-bottom: 16px;
  80. white-space: nowrap;
  81. /* 禁止换行 */
  82. overflow: hidden;
  83. /* 隐藏超出部分 */
  84. text-overflow: ellipsis;
  85. /* 超出部分显示省略号 */
  86. >span {
  87. display: inline-block;
  88. width: 24px;
  89. height: 24px;
  90. margin-left: 22px;
  91. line-height: 24px;
  92. vertical-align: middle;
  93. text-align: center;
  94. background-color: #cecece;
  95. font-family: Microsoft YaHei, Microsoft YaHei;
  96. font-weight: 400;
  97. font-size: 18px;
  98. color: #FFFFFF;
  99. text-align: center;
  100. font-style: normal;
  101. text-transform: none;
  102. }
  103. >a {
  104. width: 256px;
  105. height: 21px;
  106. font-family: Microsoft YaHei, Microsoft YaHei;
  107. font-weight: 400;
  108. font-size: 16px;
  109. color: #333333;
  110. line-height: 19px;
  111. text-align: left;
  112. font-style: normal;
  113. text-transform: none;
  114. padding-left: 10px;
  115. }
  116. }
  117. >li:hover>a {
  118. color: #139602;
  119. }
  120. >li:nth-child(1)>span {
  121. background-color: #00c524;
  122. }
  123. >li:nth-child(2)>span {
  124. background-color: #ffdf27;
  125. }
  126. >li:nth-child(3)>span {
  127. background-color: #f3c57f;
  128. }
  129. }
  130. </style>