HotNews2.vue 3.1 KB

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