HotNews.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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" v-show="item.islink == 1" :title="item.title">{{ item.title }}</NuxtLink>
  12. <NuxtLink :to="`/newsDetail/${item.id}`" 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 mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  22. method: 'GET',
  23. query: {
  24. 'pageSize': 14,
  25. 'level': 4,
  26. },
  27. });
  28. hotNewsList.value = mkdata.data;
  29. }
  30. getPageData();
  31. </script>
  32. <style lang="less" scoped>
  33. .hotList {
  34. background: #fff;
  35. }
  36. .title {
  37. width: 380px;
  38. height: 40px;
  39. line-height: 40px;
  40. // border-top: 1px solid #139602;
  41. border-bottom: 1px solid #e7e7e7;
  42. background-color: #fbfbfb;
  43. >h4 {
  44. font-family: Microsoft YaHei, Microsoft YaHei;
  45. font-weight: 400;
  46. margin-left: 20px;
  47. font-size: 20px;
  48. color: #000000;
  49. text-align: left;
  50. font-style: normal;
  51. text-transform: none;
  52. >span {
  53. float: right;
  54. font-family: Microsoft YaHei, Microsoft YaHei;
  55. font-weight: 400;
  56. font-size: 14px;
  57. margin-right: 10px;
  58. color: #999999;
  59. text-align: left;
  60. font-style: normal;
  61. text-transform: none;
  62. }
  63. }
  64. }
  65. .messageList {
  66. height: 563px;
  67. padding-top: 15px;
  68. margin-bottom: 30px;
  69. background-color: #fbfbfb;
  70. >li {
  71. height: 24px;
  72. margin-bottom: 16px;
  73. white-space: nowrap;
  74. /* 禁止换行 */
  75. overflow: hidden;
  76. /* 隐藏超出部分 */
  77. text-overflow: ellipsis;
  78. /* 超出部分显示省略号 */
  79. >span {
  80. display: inline-block;
  81. width: 24px;
  82. height: 24px;
  83. margin-left: 22px;
  84. line-height: 24px;
  85. vertical-align: middle;
  86. text-align: center;
  87. background-color: #cecece;
  88. font-family: Microsoft YaHei, Microsoft YaHei;
  89. font-weight: 400;
  90. font-size: 18px;
  91. color: #FFFFFF;
  92. text-align: center;
  93. font-style: normal;
  94. text-transform: none;
  95. }
  96. >a {
  97. width: 256px;
  98. height: 21px;
  99. font-family: Microsoft YaHei, Microsoft YaHei;
  100. font-weight: 400;
  101. font-size: 16px;
  102. color: #333333;
  103. line-height: 19px;
  104. text-align: left;
  105. font-style: normal;
  106. text-transform: none;
  107. padding-left: 10px;
  108. }
  109. }
  110. >li:hover>a {
  111. color: #139602;
  112. }
  113. >li:nth-child(1)>span {
  114. background-color: #00c524;
  115. }
  116. >li:nth-child(2)>span {
  117. background-color: #ffdf27;
  118. }
  119. >li:nth-child(3)>span {
  120. background-color: #f3c57f;
  121. }
  122. }
  123. </style>