PageMessage.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <!-- 资讯 -->
  2. <template>
  3. <div class="message">
  4. <div class="inner">
  5. <!-- 大标题 -->
  6. <div class="bigTitle">
  7. <div class="inner" v-for="(item, index) in headlinelist" :key="index">
  8. <img src="../../static/head/mainTitleicon.png" alt="" class="left">
  9. <!-- <h1 class="left">{{ item.title }}</h1> -->
  10. <!-- <a>{{ item.title }}</a> -->
  11. <NuxtLink :to="`/newsDetail/${item.id}`" target="_blank">
  12. <h1 class="left">{{ item.title }}</h1>
  13. </NuxtLink>
  14. </div>
  15. </div>
  16. <!-- 大标题下的列表 -->
  17. <HomeBigTitleList></HomeBigTitleList>
  18. <div class="messageLeft">
  19. <!-- 轮播图 -->
  20. <HomeBigSwiper></HomeBigSwiper>
  21. <!-- 小图列表 -->
  22. <!-- <ul class="smallList">
  23. <li v-for="(item, index) in recommendImage" :key="index">
  24. <NuxtLink :to="`/newsDetail/${item.id}`" target="_blank">
  25. <img :src="item.imgurl" alt="">
  26. <p>{{ item.title }}</p>
  27. </NuxtLink>
  28. </li>
  29. </ul> -->
  30. </div>
  31. <div class="messageRight">
  32. <!-- 列表 -->
  33. <div class="hotTop">
  34. <h3>
  35. 今日热点
  36. <!-- <span>查看更多</span> -->
  37. </h3>
  38. <ul>
  39. <li v-for="(item, index) in hotNewsList" :key="index">
  40. <strong>{{ index + 1 }}</strong>
  41. <NuxtLink :to="`/newsDetail/${item.id}`" target="_blank">{{ item.title }}</NuxtLink>
  42. </li>
  43. </ul>
  44. </div>
  45. <!-- <div class="suggest">
  46. <h3>
  47. 资讯推荐
  48. </h3>
  49. <ul>
  50. <li v-for="(item, index) in messageList" :key="index">
  51. <em></em>
  52. <NuxtLink :to="`/newsDetail/${item.id}`" target="_blank">{{ item.title }}</NuxtLink>
  53. </li>
  54. </ul>
  55. </div> -->
  56. </div>
  57. </div>
  58. </div>
  59. </template>
  60. <script setup>
  61. import { NuxtLink } from "#components";
  62. import { ref, onMounted } from "vue"
  63. const nuxtApp = useNuxtApp();
  64. const axios = nuxtApp.$axios;
  65. //大头条
  66. const headlinelist = useState("headlinelist", () => "");
  67. const headline = async () => {
  68. try {
  69. const response = await axios.get(`/web/getWebsiteArticlett?pageSize=${1}&level=${1}&placeid=${0}`);
  70. console.log('大标题', response.data);
  71. headlinelist.value = response.data;
  72. } catch (error) {
  73. console.error(error);
  74. }
  75. }
  76. //获取推荐图
  77. const recommendImage = useState("recommendImage", () => "");
  78. const recommendList = async () => {
  79. try {
  80. const response = await axios.get(`/web/getWebsiteArticlett?pageSize=${3}&level=${3}&placeid=${0}`);
  81. // console.log(response.data);
  82. recommendImage.value = response.data;
  83. } catch (error) {
  84. console.error(error);
  85. }
  86. }
  87. //热点资讯
  88. const hotNewsList = useState("hotNews", () => "");
  89. const hotNews = async () => {
  90. try {
  91. const response = await axios.get(`/web/getWebsiteArticlett?pageSize=${8}&level=${4}&placeid=${0}`);
  92. console.log('hotNewsList', response.data);
  93. hotNewsList.value = response.data;
  94. } catch (error) {
  95. console.error(error);
  96. }
  97. }
  98. //资讯推荐
  99. const messageList = useState("messagelist", () => "");
  100. const message = async () => {
  101. try {
  102. const response = await axios.get(`/web/getWebsiteArticlett?pageSize=${6}&level=${5}&placeid=${0}`);
  103. // console.log(response.data);
  104. messageList.value = response.data;
  105. } catch (error) {
  106. console.error(error);
  107. }
  108. }
  109. onMounted(() => {
  110. // 头条
  111. headline()
  112. //推荐图
  113. recommendList()
  114. // 热点资讯
  115. hotNews()
  116. //资讯推荐
  117. message()
  118. })
  119. </script>
  120. <style lang="less" scoped>
  121. // 大标题
  122. .bigTitle {
  123. width: 100%;
  124. height: 70px;
  125. margin-top: 38px;
  126. img {
  127. width: 57px;
  128. height: 52px;
  129. margin: 6px 17px 9px 97px;
  130. vertical-align: middle;
  131. }
  132. h1 {
  133. width: 960px;
  134. height: 70px;
  135. font-family: PingFang SC, PingFang SC;
  136. font-weight: 600;
  137. font-size: 30px;
  138. // font-size: 38px;
  139. margin-bottom: 25px;
  140. white-space: nowrap;
  141. /* 防止文本换行 */
  142. overflow: hidden;
  143. /* 隐藏溢出的内容 */
  144. text-overflow: ellipsis;
  145. color: #49A769;
  146. line-height: 59px;
  147. text-align: left;
  148. font-style: normal;
  149. text-transform: none;
  150. }
  151. }
  152. // 资讯
  153. .message {
  154. width: 100%;
  155. height: 570px;
  156. .messageLeft,
  157. .messageRight {
  158. float: left;
  159. }
  160. // 左侧
  161. .messageLeft {
  162. // 轮播图
  163. >img {
  164. width: 790px;
  165. height: 440px;
  166. }
  167. // 轮播图下小图列表
  168. .smallList {
  169. width: 790px;
  170. height: 140px;
  171. margin-top: 16px;
  172. >li {
  173. width: 250px;
  174. height: 140px;
  175. float: left;
  176. padding-right: 20px;
  177. position: relative;
  178. // background-color: #f5f5f5;
  179. img {
  180. width: 250px;
  181. height: 140px;
  182. }
  183. p {
  184. position: absolute;
  185. bottom: 0;
  186. left: 0;
  187. width: 250px;
  188. height: 30px;
  189. white-space: nowrap;
  190. overflow: hidden;
  191. text-overflow: ellipsis;
  192. line-height: 30px;
  193. padding-left: 4px;
  194. box-sizing: border-box;
  195. font-family: PingFang SC, PingFang SC;
  196. font-weight: 500;
  197. font-size: 16px;
  198. color: #FFFFFF;
  199. text-align: left;
  200. font-style: normal;
  201. text-transform: none;
  202. background: rgba(0, 0, 0, 0.5);
  203. border-radius: 0px 0px 2px 2px;
  204. }
  205. }
  206. >li:nth-child(3) {
  207. padding-right: 0px;
  208. }
  209. }
  210. }
  211. // 右侧
  212. .messageRight {
  213. width: 380px;
  214. height: 405px;
  215. margin-left: 30px;
  216. .hotTop,
  217. .suggest {
  218. width: 380px;
  219. height: 283px;
  220. >h3 {
  221. height: 40px;
  222. line-height: 40px;
  223. font-family: Source Han Sans, Source Han Sans;
  224. font-weight: bold;
  225. font-size: 24px;
  226. color: #000000;
  227. line-height: 28px;
  228. text-align: left;
  229. font-style: normal;
  230. text-transform: none;
  231. border-bottom: 1px solid #139602;
  232. >span {
  233. float: right;
  234. width: 56px;
  235. height: 20px;
  236. line-height: 24px;
  237. font-family: PingFang SC, PingFang SC;
  238. font-weight: 400;
  239. font-size: 14px;
  240. color: #999999;
  241. font-style: normal;
  242. text-transform: none;
  243. }
  244. }
  245. ul {
  246. >li {
  247. height: 25px;
  248. padding-top: 20px;
  249. >strong {
  250. display: inline-block;
  251. width: 24px;
  252. height: 24px;
  253. line-height: 24px;
  254. background-color: #cecece;
  255. padding-left: 6px;
  256. box-sizing: border-box;
  257. font-family: Source Han Sans, Source Han Sans;
  258. font-weight: 500;
  259. font-size: 18px;
  260. color: #FFFFFF;
  261. font-style: normal;
  262. text-transform: none;
  263. vertical-align: -2px;
  264. }
  265. &:nth-child(1)>strong {
  266. background-color: #00C524;
  267. }
  268. &:nth-child(2)>strong {
  269. background-color: #FFDF27;
  270. }
  271. &:nth-child(3)>strong {
  272. background-color: #F3C57F;
  273. }
  274. >em {
  275. display: inline-block;
  276. width: 6px;
  277. height: 6px;
  278. border-radius: 10px;
  279. border: 2px solid #8CBA86;
  280. vertical-align: -1px;
  281. }
  282. >a,
  283. >span {
  284. display: inline-block;
  285. width: 347px;
  286. height: 25px;
  287. font-family: PingFang SC, PingFang SC;
  288. font-weight: 500;
  289. font-size: 18px;
  290. color: #333333;
  291. line-height: 21px;
  292. text-align: left;
  293. font-style: normal;
  294. text-transform: none;
  295. padding-left: 9px;
  296. white-space: nowrap;
  297. overflow: hidden;
  298. text-overflow: ellipsis;
  299. vertical-align: middle;
  300. }
  301. >a:hover,
  302. >span:hover {
  303. color: #139609;
  304. }
  305. }
  306. }
  307. }
  308. .hotTop {
  309. width: 380px;
  310. }
  311. .suggest {
  312. margin-top: 32px;
  313. }
  314. }
  315. }
  316. </style>