HotNews2.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div class="contlt">
  3. <a class="">热门文章</a>
  4. </div>
  5. <ul class="right_con_list">
  6. <template v-for="(item, per_index) in hotNewsList">
  7. <NuxtLink to="item.linkurl" v-if="item.islink == 1" :title="item.title">
  8. {{ item.title }}
  9. </NuxtLink>
  10. </template>
  11. <template v-for="(item, per_index) in hotNewsList">
  12. <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
  13. {{ item.title }}
  14. </NuxtLink>
  15. </template>
  16. </ul>
  17. <!-- 列表 -->
  18. <!-- <ul class="rightList">
  19. <li v-for="item in hotNewsList">
  20. <NuxtLink :to="item.linkurl" v-if="item.islink == 1" :title="item.title">
  21. {{ item.title }}
  22. </NuxtLink>
  23. <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
  24. {{ item.title }}
  25. </NuxtLink>
  26. </li>
  27. </ul> -->
  28. </template>
  29. <script setup>
  30. const hotNewsList = ref([])
  31. async function getPageData() {
  32. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  33. method: 'GET',
  34. query: {
  35. 'textnum': 0,
  36. 'imgnum': 5,
  37. 'level': 5,
  38. 'placeid': 0,
  39. 'id': 0
  40. },
  41. });
  42. console.log("获取热点精选", mkdata);
  43. if (mkdata.code == 200) {
  44. for (let item of mkdata.data.img) {
  45. if (item.imgurl) {
  46. hotNewsList.value.push(item)
  47. if (hotNewsList.value.length == 5) {
  48. break;
  49. }
  50. }
  51. }
  52. // hotNewsList.value = mkdata.data;
  53. } else {
  54. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  55. console.log("错误位置:获取热点精选")
  56. console.log("后端错误反馈:", mkdata.message)
  57. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  58. }
  59. }
  60. getPageData();
  61. </script>
  62. <style lang="less" scoped>
  63. .title {
  64. width: 100%;
  65. overflow: hidden;
  66. >h4 {
  67. width: 100%;
  68. height: 70px;
  69. line-height: 70px;
  70. background-size: 100% 100%;
  71. background: url('../../public/index/reconewsh2.gif') no-repeat #158d91;
  72. font-size: 22px;
  73. color: #fff;
  74. font-weight: bold;
  75. padding-left: 30px;
  76. box-sizing: border-box;
  77. >span {
  78. float: right;
  79. font-family: Microsoft YaHei, Microsoft YaHei;
  80. font-weight: 400;
  81. font-size: 14px;
  82. margin-right: 10px;
  83. color: #999999;
  84. text-align: left;
  85. font-style: normal;
  86. text-transform: none;
  87. }
  88. }
  89. }
  90. .rightList {
  91. padding-top: 20px;
  92. background-color: #f1f1f1;
  93. padding-bottom: 30px;
  94. >li {
  95. width: 90%;
  96. margin: 0 auto;
  97. border-bottom: 1px dashed #ccc;
  98. background: url(../../public/index/reconlia.png) no-repeat 0 20px;
  99. padding-left: 20px;
  100. box-sizing: border-box;
  101. a {
  102. display: block;
  103. width: 100%;
  104. height: 50px;
  105. line-height: 50px;
  106. font-size: 14px;
  107. color: #333;
  108. text-overflow: ellipsis;
  109. overflow: hidden;
  110. white-space: nowrap;
  111. }
  112. }
  113. }
  114. .title>h4 {
  115. height: 55PX;
  116. line-height: 55PX;
  117. font-size: 20PX;
  118. }
  119. .rightList {}
  120. .rightList>li a {
  121. height: 44PX;
  122. line-height: 44PX;
  123. font-size: 16PX;
  124. }
  125. .rightList>li {
  126. background-position-y: center;
  127. }
  128. .contlt {
  129. width: 100%;
  130. height: 40PX;
  131. overflow: hidden;
  132. border-bottom: solid 2PX #b41c2a;
  133. margin-bottom: 10PX;
  134. }
  135. .contlt a {
  136. display: block;
  137. width: 107PX;
  138. height: 40PX;
  139. line-height: 40PX;
  140. background: #b41c2a;
  141. text-align: center;
  142. color: #fff;
  143. font-size: 20PX;
  144. font-weight: bold;
  145. border-top-left-radius: 10PX;
  146. border-top-right-radius: 10PX;
  147. }
  148. .right_con_list {
  149. width: 100%;
  150. height: auto;
  151. overflow: hidden;
  152. display: block;
  153. }
  154. .right_con_list a {
  155. width: 100%;
  156. height: 45PX;
  157. line-height: 45PX;
  158. border-bottom: solid 1PX #ccc;
  159. font-size: 16PX;
  160. color: #333;
  161. background: url(public/index/index_42.png) no-repeat left center;
  162. background-size: auto 14PX;
  163. text-indent: 22PX;
  164. display: block;
  165. word-break: keep-all;
  166. white-space: nowrap;
  167. overflow: hidden;
  168. text-overflow: ellipsis;
  169. }
  170. .right_con_list a:nth-of-type(-n+3) {
  171. background-image: url(public/index/index_31.png);
  172. }
  173. @media screen and (min-width: 1401px) {
  174. //你的样式
  175. }
  176. @media screen and (max-width: 1400px) {}
  177. @media screen and (min-width: 801px) and (max-width: 1400px) {
  178. //你的样式
  179. }
  180. @media screen and (max-width: 800px) {
  181. .right_con_list {
  182. overflow: hidden;
  183. }
  184. .right_con_list a {
  185. width: 49%;
  186. }
  187. .right_con_list a:nth-of-type(odd) {
  188. float: left;
  189. }
  190. .right_con_list a:nth-of-type(even) {
  191. float: right;
  192. }
  193. .right_con_list a {
  194. height: 55px;
  195. line-height: 55px;
  196. font-size: 24px;
  197. background-size: auto 14px;
  198. text-indent: 22px;
  199. }
  200. .contlt {
  201. height: 40px;
  202. margin-bottom: 10px;
  203. }
  204. .contlt a {
  205. width: auto;
  206. height: 55px;
  207. line-height: 50px;
  208. float: left;
  209. padding: 0px 6px;
  210. font-size: 26px;
  211. border-top-left-radius: 10px;
  212. border-top-right-radius: 10px;
  213. }
  214. }
  215. </style>