PageMessage.vue 10 KB

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