HotNews.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. <NuxtLink :to="item.linkurl" v-show="item.islink == 1" :title="item.title">{{ item.title }}</NuxtLink>
  11. <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
  12. {{ 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': 10,
  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. @media screen and (min-width: 1401px) {
  44. .hotList {
  45. font-family: "微软雅黑";
  46. width: 100%;
  47. height: auto;
  48. overflow: hidden;
  49. border: 1PX solid #C6E9FF;
  50. border-top-left-radius: 5PX;
  51. border-top-right-radius: 5PX;
  52. padding-bottom: 10PX;
  53. margin-bottom: 10PX;
  54. box-sizing: border-box;
  55. .title {
  56. width: 100%;
  57. height: 37PX;
  58. line-height: 37PX;
  59. overflow: hidden;
  60. padding: 0 10PX;
  61. background: url(../../public/index/hotNewsBg.jpg) no-repeat center top;
  62. background-size: 100% 100%;
  63. h4 {
  64. font-size: 18PX;
  65. color: #fff;
  66. font-weight: bold;
  67. }
  68. }
  69. .messageList {
  70. height: auto;
  71. padding: 0 20PX;
  72. box-sizing: border-box;
  73. >li {
  74. height: 35PX;
  75. line-height: 35PX;
  76. white-space: nowrap;
  77. overflow: hidden;
  78. text-overflow: ellipsis;
  79. >a {
  80. font-size: 12PX;
  81. color: #000;
  82. }
  83. }
  84. }
  85. }
  86. }
  87. @media screen and (min-width: 801px) and (max-width: 1400px) {
  88. .hotList {
  89. font-family: "微软雅黑";
  90. width: 100%;
  91. height: auto;
  92. overflow: hidden;
  93. border: 1PX solid #C6E9FF;
  94. border-top-left-radius: 5PX;
  95. border-top-right-radius: 5PX;
  96. padding-bottom: 10PX;
  97. margin-bottom: 10PX;
  98. box-sizing: border-box;
  99. .title {
  100. width: 100%;
  101. height: 37PX;
  102. line-height: 37PX;
  103. overflow: hidden;
  104. padding: 0 10PX;
  105. background: url(../../public/index/hotNewsBg.jpg) no-repeat center top;
  106. background-size: 100% 100%;
  107. h4 {
  108. font-size: 18PX;
  109. color: #fff;
  110. font-weight: bold;
  111. }
  112. }
  113. .messageList {
  114. height: auto;
  115. padding: 0 20PX;
  116. >li {
  117. height: 35PX;
  118. line-height: 35PX;
  119. white-space: nowrap;
  120. overflow: hidden;
  121. text-overflow: ellipsis;
  122. >a {
  123. font-size: 12PX;
  124. color: #000;
  125. }
  126. }
  127. }
  128. }
  129. }
  130. @media screen and (max-width: 800px) {
  131. .hotList {
  132. font-family: "微软雅黑";
  133. width: 100%;
  134. height: auto;
  135. overflow: hidden;
  136. border: 2px solid #C6E9FF;
  137. border-top-left-radius: 10px;
  138. border-top-right-radius: 10px;
  139. padding-bottom: 20px;
  140. margin-bottom: 20px;
  141. box-sizing: border-box;
  142. .title {
  143. width: 100%;
  144. height: 74px;
  145. line-height: 74px;
  146. overflow: hidden;
  147. padding: 0 20px;
  148. background: url(../../public/index/hotNewsBg.jpg) no-repeat center top;
  149. background-size: 100% 100%;
  150. h4 {
  151. font-size: 36px;
  152. color: #fff;
  153. font-weight: bold;
  154. }
  155. }
  156. .messageList {
  157. height: auto;
  158. padding: 0 40px;
  159. box-sizing: border-box;
  160. >li {
  161. height: 70px;
  162. line-height: 70px;
  163. white-space: nowrap;
  164. overflow: hidden;
  165. text-overflow: ellipsis;
  166. >a {
  167. font-size: 26px;
  168. color: #000;
  169. }
  170. }
  171. }
  172. }
  173. }
  174. </style>