HotNews2.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <div class="hotNews">
  3. <div class="hotNews_title">
  4. 热点精选
  5. </div>
  6. <ul class="hotNews_message">
  7. <li class="hotNews_messageList" v-for="(item, index) in hotNewsList" :key="index">
  8. <span class="number">{{ index + 1 }}</span>
  9. <NuxtLink
  10. :href="getLinkPathDetail(item)"
  11. :title="item.title"
  12. :key="item.id"
  13. :target="item.islink == 1 ? '_blank' : '_self'"
  14. >
  15. <span class="hotlist_text">{{ item.title }}</span>
  16. </NuxtLink>
  17. </li>
  18. </ul>
  19. </div>
  20. </template>
  21. <script setup>
  22. const getLinkPathDetail = (item) => {
  23. if (item.islink == 1) {
  24. return `${item.linkurl}`;
  25. } else {
  26. return `/${item.pinyin}/${item.id}.html`;
  27. }
  28. }
  29. const hotNewsList = ref([])
  30. async function getPageData() {
  31. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  32. method: 'GET',
  33. query: {
  34. 'imgnum':0,
  35. 'textnum':8,
  36. 'level': 5,
  37. 'placeid': 0,
  38. 'id': '',
  39. },
  40. });
  41. if (mkdata.code == 200) {
  42. hotNewsList.value = mkdata.data.text;
  43. } else {
  44. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  45. console.log("错误位置:获取热点精选")
  46. console.log("后端错误反馈:", mkdata.message)
  47. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  48. }
  49. }
  50. getPageData();
  51. </script>
  52. <style lang="less" scoped>
  53. .hotNews {
  54. width: 270px;
  55. margin-top: 20px;
  56. height: 550px;
  57. //标题
  58. .hotNews_title {
  59. width: 100px;
  60. font-family: Microsoft YaHei, Microsoft YaHei;
  61. font-weight: bold;
  62. margin: 30px 0 10px;
  63. font-size: 20px;
  64. color: #004564;
  65. // border-left: #004564 5px solid;
  66. // padding-left: 17px;
  67. }
  68. //新闻列表
  69. .hotNews_message {
  70. width: 270px;
  71. .hotNews_messageList {
  72. width: 270px;
  73. height: 64px;
  74. line-height: 64px;
  75. border-bottom: 1px solid #E4E4E4;
  76. font-weight: 400;
  77. font-size: 18px;
  78. color: #333333;
  79. ;
  80. white-space: nowrap;
  81. overflow: hidden;
  82. text-overflow: ellipsis;
  83. a {
  84. color: #333333;
  85. }
  86. .number {
  87. color: #999999;
  88. margin-right: 13px;
  89. font-family: DingTalk JinBuTi, DingTalk JinBuTi;
  90. }
  91. }
  92. .hotNews_messageList:nth-child(1) {
  93. .number {
  94. color: #004564;
  95. }
  96. }
  97. .hotNews_messageList:nth-child(2) {
  98. .number {
  99. color: #004564;
  100. }
  101. }
  102. .hotNews_messageList:nth-child(3) {
  103. .number {
  104. color: #004564;
  105. }
  106. }
  107. .hotNews_messageList:hover {
  108. color: #004564;
  109. a {
  110. color: #004564;
  111. }
  112. }
  113. }
  114. }
  115. </style>