HotNews2.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <div class="hotNews">
  3. <div class="title">
  4. <h4> 热点推荐 </h4>
  5. </div>
  6. <!-- 列表 -->
  7. <ul class="rightList">
  8. <li v-for="item in hotNewsList">
  9. <NuxtLink :to="item.linkurl" v-show="item.islink == 1" :title="item.title">
  10. <img class="hotNewsImg" :src="item.imgurl">
  11. <div class="hotNewsText">
  12. <div class="textTitle">{{ item.title }}</div>
  13. <div class="content dot3">{{ item.introduce }}</div>
  14. </div>
  15. </NuxtLink>
  16. <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
  17. <img class="hotNewsImg" :src="item.imgurl">
  18. <div class="hotNewsText">
  19. <div class="textTitle dot1">{{ item.title }}</div>
  20. <div class="content dot3">{{ item.introduce }}</div>
  21. </div>
  22. </NuxtLink>
  23. </li>
  24. </ul>
  25. </div>
  26. </template>
  27. <script setup>
  28. const hotNewsList = ref([])
  29. async function getPageData() {
  30. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  31. method: 'GET',
  32. query: {
  33. 'textnum': 0,
  34. 'imgnum': 6,
  35. 'level': 5,
  36. 'placeid': 0,
  37. 'id': 0
  38. },
  39. });
  40. console.log("获取热点精选", mkdata);
  41. if (mkdata.code == 200) {
  42. for (let item of mkdata.data.img) {
  43. if (item.imgurl) {
  44. hotNewsList.value.push(item)
  45. if (hotNewsList.value.length == 6) {
  46. break;
  47. }
  48. }
  49. }
  50. } else {
  51. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  52. console.log("错误位置:获取热点精选")
  53. console.log("后端错误反馈:", mkdata.message)
  54. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  55. }
  56. }
  57. getPageData();
  58. </script>
  59. <style lang="less" scoped>
  60. @media screen and (min-width: 1401px) {
  61. .hotNews {
  62. font-family: "微软雅黑";
  63. width: 100%;
  64. height: auto;
  65. overflow: hidden;
  66. border: 1PX solid #C6E9FF;
  67. border-top-left-radius: 5PX;
  68. border-top-right-radius: 5PX;
  69. padding-bottom: 10PX;
  70. margin-bottom: 10PX;
  71. box-sizing: border-box;
  72. .title {
  73. width: 100%;
  74. height: 37PX;
  75. line-height: 37PX;
  76. overflow: hidden;
  77. padding: 0 10PX;
  78. box-sizing: border-box;
  79. background: url(../../public/index/hotNewsBg.jpg) no-repeat center top;
  80. background-size: 100% 100%;
  81. h4 {
  82. font-size: 18PX;
  83. color: #fff;
  84. font-weight: bold;
  85. }
  86. }
  87. .rightList {
  88. padding-top: 5PX;
  89. li {
  90. width: 99%;
  91. height: auto;
  92. overflow: hidden;
  93. margin-top: 10PX;
  94. padding: 0 20PX;
  95. box-sizing: border-box;
  96. a {
  97. display: flex;
  98. .hotNewsImg {
  99. width: 92PX;
  100. height: 94PX;
  101. border-radius: 4PX;
  102. }
  103. .hotNewsText {
  104. width: 70%;
  105. height: 94PX;
  106. padding-left: 10PX;
  107. font-size: 14PX;
  108. color: #000;
  109. line-height: 24PX;
  110. .textTitle {
  111. width: 98%;
  112. line-height: 30PX;
  113. font-size: 14PX;
  114. color: #0293ff;
  115. font-weight: bold;
  116. overflow: hidden;
  117. white-space: nowrap;
  118. text-overflow: ellipsis;
  119. }
  120. .content {
  121. width: 98%;
  122. height: 60PX;
  123. line-height: 20PX;
  124. font-size: 12PX;
  125. color: #000;
  126. }
  127. }
  128. }
  129. }
  130. }
  131. }
  132. .dot3 {
  133. display: -webkit-box;
  134. -webkit-box-orient: vertical;
  135. -webkit-line-clamp: 3;
  136. overflow: hidden;
  137. text-overflow: ellipsis;
  138. word-break: break-all;
  139. }
  140. .hotNewsImg {
  141. float: left;
  142. width: 150PX;
  143. height: 100PX;
  144. border-radius: 4PX;
  145. }
  146. }
  147. @media screen and (min-width: 801px) and (max-width: 1400px) {
  148. .hotNews {
  149. font-family: "微软雅黑";
  150. width: 100%;
  151. height: auto;
  152. overflow: hidden;
  153. border: 1PX solid #C6E9FF;
  154. border-top-left-radius: 5PX;
  155. border-top-right-radius: 5PX;
  156. padding-bottom: 10PX;
  157. margin-bottom: 10PX;
  158. .title {
  159. width: 100%;
  160. height: 37PX;
  161. line-height: 37PX;
  162. overflow: hidden;
  163. padding: 0 10PX;
  164. background: url(../../public/index/hotNewsBg.jpg) no-repeat center top;
  165. background-size: 100% 100%;
  166. h4 {
  167. font-size: 18PX;
  168. color: #fff;
  169. font-weight: bold;
  170. }
  171. }
  172. .rightList {
  173. box-sizing: border-box;
  174. padding-top: 5PX;
  175. li {
  176. width: 100%;
  177. height: auto;
  178. overflow: hidden;
  179. margin-top: 10PX;
  180. padding: 0 20PX;
  181. box-sizing: border-box;
  182. a {
  183. width: 100%;
  184. display: flex;
  185. .hotNewsImg {
  186. width: 92PX;
  187. height: 94PX;
  188. border-radius: 4PX;
  189. }
  190. .hotNewsText {
  191. width: calc(100% - 92PX);
  192. height: 94PX;
  193. padding-left: 10PX;
  194. font-size: 14PX;
  195. color: #000;
  196. line-height: 24PX;
  197. box-sizing: border-box;
  198. .textTitle {
  199. width: 98%;
  200. line-height: 30PX;
  201. font-size: 14PX;
  202. color: #0293ff;
  203. font-weight: bold;
  204. overflow: hidden;
  205. white-space: nowrap;
  206. text-overflow: ellipsis;
  207. }
  208. .content {
  209. width: 98%;
  210. height: 60PX;
  211. line-height: 20PX;
  212. font-size: 12PX;
  213. color: #000;
  214. }
  215. }
  216. }
  217. }
  218. }
  219. }
  220. .dot3 {
  221. display: -webkit-box;
  222. -webkit-box-orient: vertical;
  223. -webkit-line-clamp: 3;
  224. overflow: hidden;
  225. text-overflow: ellipsis;
  226. word-break: break-all;
  227. }
  228. .hotNewsImg {
  229. float: left;
  230. width: 150PX;
  231. height: 100PX;
  232. border-radius: 4PX;
  233. }
  234. }
  235. @media screen and (max-width: 800px) {
  236. .hotNews {
  237. font-family: "微软雅黑";
  238. width: 100%;
  239. height: auto;
  240. overflow: hidden;
  241. border: 2px solid #C6E9FF;
  242. border-top-left-radius: 10px;
  243. border-top-right-radius: 10px;
  244. padding-bottom: 20px;
  245. margin-bottom: 20px;
  246. .title {
  247. width: 100%;
  248. height: 74px;
  249. line-height: 74px;
  250. overflow: hidden;
  251. padding: 0 20px;
  252. background: url(../../public/index/hotNewsBg.jpg) no-repeat center top;
  253. background-size: 100% 100%;
  254. h4 {
  255. font-size: 36px;
  256. color: #fff;
  257. font-weight: bold;
  258. }
  259. }
  260. .rightList {
  261. padding-top: 10px;
  262. li {
  263. width: 100%;
  264. height: auto;
  265. overflow: hidden;
  266. margin-top: 20px;
  267. padding: 0 40px;
  268. box-sizing: border-box;
  269. font-family: "微软雅黑";
  270. a {
  271. display: flex;
  272. .hotNewsImg {
  273. float: left;
  274. width: 224px;
  275. height: 180px;
  276. border-radius: 4px;
  277. }
  278. .hotNewsText {
  279. width: 70%;
  280. height: 180px;
  281. padding-left: 20px;
  282. font-size: 28px;
  283. color: #000;
  284. line-height: 48px;
  285. .textTitle {
  286. width: 98%;
  287. line-height: 60px;
  288. font-size: 32px;
  289. color: #0293ff;
  290. font-weight: bold;
  291. overflow: hidden;
  292. white-space: nowrap;
  293. text-overflow: ellipsis;
  294. }
  295. .content {
  296. width: 98%;
  297. height: 120px;
  298. line-height: 40px;
  299. font-size: 26px;
  300. color: #000;
  301. }
  302. }
  303. }
  304. }
  305. }
  306. }
  307. .dot1 {
  308. white-space: nowrap;
  309. overflow: hidden;
  310. text-overflow: ellipsis;
  311. }
  312. .dot3 {
  313. display: -webkit-box;
  314. -webkit-box-orient: vertical;
  315. -webkit-line-clamp: 3;
  316. overflow: hidden;
  317. text-overflow: ellipsis;
  318. word-break: break-all;
  319. }
  320. }
  321. </style>