HotNews.vue 3.6 KB

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