HotNews.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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">
  11. <em></em>
  12. {{ item.title }}
  13. </NuxtLink>
  14. <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
  15. <em></em>
  16. {{ item.title }}
  17. </NuxtLink>
  18. </li>
  19. </ul>
  20. </div>
  21. </template>
  22. <script setup>
  23. const hotNewsList = ref([])
  24. async function getPageData() {
  25. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  26. method: 'GET',
  27. query: {
  28. 'imgnum': 0,
  29. 'textnum': 8,
  30. 'level': 4,
  31. 'id': 0,
  32. 'placeid': 0,
  33. },
  34. });
  35. if (mkdata.code == 200) {
  36. hotNewsList.value = mkdata.data.text;
  37. } else {
  38. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  39. console.log("错误位置:获取最新资讯")
  40. console.log("后端错误反馈:", mkdata.message)
  41. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  42. }
  43. }
  44. getPageData();
  45. </script>
  46. <style lang="less" scoped>
  47. @media screen and (min-width: 1401px) {
  48. .hotList {
  49. width: 100%;
  50. height: auto;
  51. overflow: hidden;
  52. border-top-left-radius: 5PX;
  53. border-top-right-radius: 5PX;
  54. padding-bottom: 10PX;
  55. margin-bottom: 10PX;
  56. box-sizing: border-box;
  57. .title {
  58. width: 100%;
  59. height: 40PX;
  60. overflow: hidden;
  61. border-bottom: solid 2PX #b41c2a;
  62. h4 {
  63. display: block;
  64. width: 107PX;
  65. height: 40PX;
  66. line-height: 40PX;
  67. background: #b41c2a;
  68. text-align: center;
  69. color: #fff;
  70. font-size: 20PX;
  71. font-weight: bold;
  72. border-top-left-radius: 10PX;
  73. border-top-right-radius: 10PX;
  74. }
  75. }
  76. .messageList {
  77. height: auto;
  78. margin-top: 10PX;
  79. li {
  80. width: 100%;
  81. height: 43PX;
  82. line-height: 38PX;
  83. list-style-position: inside;
  84. border-bottom: 1PX solid #ccc;
  85. white-space: nowrap;
  86. overflow: hidden;
  87. text-overflow: ellipsis;
  88. &:last-child {
  89. margin-bottom: 0;
  90. }
  91. a {
  92. font-size: 16PX;
  93. color: #333;
  94. em {
  95. display: inline-block;
  96. width: 16PX;
  97. height: 16PX;
  98. background: url(../../public/index/index_42.png) no-repeat;
  99. vertical-align: -3PX;
  100. }
  101. }
  102. &:nth-child(1),
  103. &:nth-child(2),
  104. &:nth-child(3) {
  105. a {
  106. em {
  107. background: url(../../public/index/index_31.png) no-repeat;
  108. vertical-align: -3PX;
  109. }
  110. }
  111. }
  112. }
  113. }
  114. }
  115. }
  116. @media screen and (min-width: 801px) and (max-width: 1400px) {
  117. .hotList {
  118. width: 100%;
  119. height: auto;
  120. overflow: hidden;
  121. border-top-left-radius: 5PX;
  122. border-top-right-radius: 5PX;
  123. padding-bottom: 10PX;
  124. margin-bottom: 10PX;
  125. box-sizing: border-box;
  126. .title {
  127. width: 100%;
  128. height: 40PX;
  129. overflow: hidden;
  130. border-bottom: solid 2PX #b41c2a;
  131. h4 {
  132. display: block;
  133. width: 107PX;
  134. height: 40PX;
  135. line-height: 40PX;
  136. background: #b41c2a;
  137. text-align: center;
  138. color: #fff;
  139. font-size: 20PX;
  140. font-weight: bold;
  141. border-top-left-radius: 10PX;
  142. border-top-right-radius: 10PX;
  143. }
  144. }
  145. .messageList {
  146. height: auto;
  147. margin-top: 10PX;
  148. li {
  149. width: 100%;
  150. height: 43PX;
  151. line-height: 38PX;
  152. list-style-position: inside;
  153. border-bottom: 1PX solid #ccc;
  154. white-space: nowrap;
  155. overflow: hidden;
  156. text-overflow: ellipsis;
  157. &:last-child {
  158. margin-bottom: 0;
  159. }
  160. a {
  161. font-size: 16PX;
  162. color: #333;
  163. em {
  164. display: inline-block;
  165. width: 16PX;
  166. height: 16PX;
  167. background: url(../../public/index/index_42.png) no-repeat;
  168. vertical-align: -3PX;
  169. }
  170. }
  171. &:nth-child(1),
  172. &:nth-child(2),
  173. &:nth-child(3) {
  174. a {
  175. em {
  176. background: url(../../public/index/index_31.png) no-repeat;
  177. vertical-align: -3PX;
  178. }
  179. }
  180. }
  181. }
  182. }
  183. }
  184. }
  185. @media screen and (max-width: 800px) {
  186. .hotList {
  187. width: 100%;
  188. height: auto;
  189. overflow: hidden;
  190. border-top-left-radius: 10px;
  191. border-top-right-radius: 10px;
  192. padding-bottom: 20px;
  193. margin-bottom: 20px;
  194. box-sizing: border-box;
  195. .title {
  196. width: 100%;
  197. height: 80px;
  198. overflow: hidden;
  199. border-bottom: solid 2PX #b41c2a;
  200. h4 {
  201. display: block;
  202. width: 214px;
  203. height: 80px;
  204. line-height: 80px;
  205. background: #b41c2a;
  206. text-align: center;
  207. color: #fff;
  208. font-size: 40px;
  209. font-weight: bold;
  210. border-top-left-radius: 20px;
  211. border-top-right-radius: 20px;
  212. }
  213. }
  214. .messageList {
  215. height: auto;
  216. margin-top: 20px;
  217. display: flex;
  218. flex-wrap: wrap;
  219. justify-content: space-between;
  220. li {
  221. width: 49%;
  222. height: 86px;
  223. line-height: 76px;
  224. list-style-position: inside;
  225. border-bottom: 2px solid #ccc;
  226. white-space: nowrap;
  227. overflow: hidden;
  228. text-overflow: ellipsis;
  229. &:last-child {
  230. margin-bottom: 0;
  231. }
  232. a {
  233. font-size: 32px;
  234. color: #333;
  235. em {
  236. display: inline-block;
  237. width: 24px;
  238. height: 28px;
  239. background: url(../../public/index/index_42.png) no-repeat;
  240. background-size: 100% 100%;
  241. vertical-align: -6px;
  242. margin-right: 10px;
  243. }
  244. }
  245. &:nth-child(1),
  246. &:nth-child(2),
  247. &:nth-child(3) {
  248. a {
  249. em {
  250. display: inline-block;
  251. width: 24px;
  252. height: 28px;
  253. background: url(../../public/index/index_31.png) no-repeat;
  254. background-size: 100% 100%;
  255. vertical-align: -6px;
  256. }
  257. }
  258. }
  259. }
  260. }
  261. }
  262. }
  263. </style>