HotNews.vue 3.6 KB

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