PageMessage.vue 8.8 KB

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