HotNews.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <div class="hotList">
  3. <div class="title">
  4. 最新资讯
  5. <em></em>
  6. </div>
  7. <div class="top111">
  8. <div class="hotList_photo_text" v-for="(item, index) in hotNewsListImg" :key="index">
  9. <NuxtLink :to="item.linkurl" v-if="item.islink == 1" :title="item.title">
  10. <img :src="item.imgurl" alt="">
  11. <span class="jingxuan">精选</span>
  12. <div class="hotlist_text">{{ item.title }}</div>
  13. </NuxtLink>
  14. <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
  15. <img :src="item.imgurl" alt="">
  16. <span class="jingxuan">精选</span>
  17. <div class="hotlist_text">{{ item.title }}</div>
  18. </NuxtLink>
  19. </div>
  20. </div>
  21. <ul class="message">
  22. <li class="messageList" v-for="(item, index) in hotNewsList" :key="index">
  23. <NuxtLink :to="item.linkurl" v-if="item.islink == 1" :title="item.title">{{ item.title }}</NuxtLink>
  24. <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
  25. {{ item.title }}
  26. </NuxtLink>
  27. </li>
  28. </ul>
  29. </div>
  30. </template>
  31. <script setup>
  32. const hotNewsList = ref([])
  33. const hotNewsListImg = ref([])
  34. async function getPageData() {
  35. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  36. method: 'GET',
  37. query: {
  38. 'imgnum':1,
  39. 'textnum': 5,
  40. 'level': 4,
  41. 'id': 0,
  42. 'placeid': 0,
  43. },
  44. });
  45. if (mkdata.code == 200) {
  46. hotNewsList.value = mkdata.data.text;
  47. hotNewsListImg.value = mkdata.data.img;
  48. console.log("11111111111111111111111111", hotNewsList.value);
  49. } else {
  50. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  51. console.log("错误位置:获取最新资讯")
  52. console.log("后端错误反馈:", mkdata.message)
  53. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  54. }
  55. }
  56. getPageData();
  57. </script>
  58. <style lang="less" scoped>
  59. .title {
  60. width: 100px;
  61. height: 40px;
  62. line-height: 40px;
  63. font-family: Microsoft YaHei, Microsoft YaHei;
  64. font-weight: 400;
  65. margin: 10px 0;
  66. font-size: 20px;
  67. color: #333333;
  68. position: relative;
  69. em {
  70. display: inline-block;
  71. width: 8px;
  72. height: 8px;
  73. border-radius: 4px;
  74. background-color: #a01c0e;
  75. position: absolute;
  76. top: 6px;
  77. right: 8px;
  78. }
  79. }
  80. .top111 {
  81. width: 350px;
  82. height: 280px;
  83. position: relative;
  84. .hotList_photo_text {
  85. width: 350px;
  86. height: 280px;
  87. position: relative;
  88. img {
  89. width: 350px;
  90. height: 230px;
  91. }
  92. .jingxuan {
  93. display: inline-block;
  94. width: 50px;
  95. height: 26px;
  96. background-color: #a01c0e;
  97. color: #fff;
  98. text-align: center;
  99. line-height: 26px;
  100. position: absolute;
  101. top: 0px;
  102. right: 10px;
  103. }
  104. .hotlist_text {
  105. width: 350px;
  106. height: 40px;
  107. line-height: 40px;
  108. white-space: nowrap;
  109. overflow: hidden;
  110. text-overflow: ellipsis;
  111. font-family: Microsoft YaHei, Microsoft YaHei;
  112. font-weight: bold;
  113. font-size: 18px;
  114. color: #333333;
  115. margin-top: 8px;
  116. }
  117. }
  118. }
  119. .message {
  120. width: 350px;
  121. margin-top: 30px;
  122. .messageList {
  123. width: 350px;
  124. white-space: nowrap;
  125. /* 禁止换行 */
  126. overflow: hidden;
  127. /* 隐藏超出部分 */
  128. text-overflow: ellipsis;
  129. /* 超出部分显示省略号 */
  130. font-family: Microsoft YaHei, Microsoft YaHei;
  131. font-weight: 400;
  132. font-size: 18px;
  133. color: #333333;
  134. margin-bottom: 25px;
  135. a {
  136. color: #333333;
  137. }
  138. }
  139. .messageList:first-child {
  140. font-weight: bold;
  141. }
  142. >li:hover>a {
  143. color: #a01c0e;
  144. }
  145. }
  146. </style>