HotNews2.vue 3.8 KB

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