PageMessage.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <div class="message">
  3. <div class="inner">
  4. <div class="bigTitle">
  5. <div class="inner" v-for="(item, index) in headlinelist" :key="index">
  6. <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/head/mainTitleicon.png" alt="" class="left">
  7. <NuxtLink :to="item.linkurl" v-if="item.islink==1" :title="item.title">
  8. <h1 class="left">{{ item.title }}</h1>
  9. </NuxtLink>
  10. <NuxtLink :to="`/newsDetail/${item.id}`" v-if="item.islink==0" :title="item.title">
  11. <h1 class="left">{{ item.title }}</h1>
  12. </NuxtLink>
  13. </div>
  14. </div>
  15. <HomeBigTitleList></HomeBigTitleList>
  16. <div class="messageLeft">
  17. <HomeBigSwiper></HomeBigSwiper>
  18. </div>
  19. <div class="messageRight">
  20. <div class="hotTop">
  21. <h3>今日热点</h3>
  22. <ul>
  23. <li v-for="(item, index) in hotNewsList" :key="index">
  24. <strong>{{ index + 1 }}</strong>
  25. <NuxtLink :to="item.linkurl" v-if="item.islink==1" :title="item.title">{{ item.title }}</NuxtLink>
  26. <NuxtLink :to="`/newsDetail/${item.id}`" v-if="item.islink==0" :title="item.title">{{ item.title }}</NuxtLink>
  27. </li>
  28. </ul>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </template>
  34. <script setup>
  35. import { NuxtLink } from "#components";
  36. import { ref, onMounted } from "vue"
  37. const nuxtApp = useNuxtApp();
  38. const axios = nuxtApp.$axios;
  39. //1.获得板块数据 start ---------------------------------------->
  40. //大标题
  41. const headlinelist = ref("")
  42. async function getModelData1() {
  43. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  44. method: 'GET',
  45. query: {
  46. 'pageSize': 1,
  47. 'level': 1,
  48. 'placeid': 0
  49. },
  50. });
  51. if(mkdata.code == 200){
  52. headlinelist.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. getModelData1()
  61. // const recommendImage = ref("")
  62. // async function getModelData2() {
  63. // const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  64. // method: 'GET',
  65. // query: {
  66. // 'pageSize': 3,
  67. // 'level': 3,
  68. // 'placeid': 0
  69. // },
  70. // });
  71. // if(mkdata.code == 200){
  72. // recommendImage.value = mkdata.data;
  73. // }else{
  74. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  75. // console.log("错误位置:设置轮播图")
  76. // console.log("后端错误反馈:",mkdata.message)
  77. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  78. // }
  79. // }
  80. // getModelData2()
  81. const hotNewsList = ref("")
  82. async function getModelData3() {
  83. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  84. method: 'GET',
  85. query: {
  86. 'pageSize': 8,
  87. 'level': 6,
  88. 'placeid': 0
  89. },
  90. });
  91. if(mkdata.code == 200){
  92. hotNewsList.value = mkdata.data;
  93. }else{
  94. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  95. console.log("错误位置:获取首页今日热点")
  96. console.log("后端错误反馈:",mkdata.message)
  97. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  98. }
  99. }
  100. getModelData3()
  101. //1.获得板块数据 end ---------------------------------------->
  102. </script>
  103. <style lang="less" scoped>
  104. // 大标题
  105. .bigTitle {
  106. width: 100%;
  107. height: 50px;
  108. margin-top: 20px;
  109. img {
  110. width: 57px;
  111. height: 52px;
  112. margin: 6px 17px 9px 97px;
  113. vertical-align: middle;
  114. }
  115. h1 {
  116. width: 960px;
  117. height: 70px;
  118. font-family: PingFang SC, PingFang SC;
  119. font-weight: 600;
  120. font-size: 30px;
  121. // font-size: 38px;
  122. //margin-bottom: 25px;
  123. white-space: nowrap;
  124. /* 防止文本换行 */
  125. overflow: hidden;
  126. /* 隐藏溢出的内容 */
  127. text-overflow: ellipsis;
  128. color: #49A769;
  129. line-height: 59px;
  130. text-align: left;
  131. font-style: normal;
  132. text-transform: none;
  133. }
  134. }
  135. // 资讯
  136. .message {
  137. width: 100%;
  138. height: 520px;
  139. .messageLeft,
  140. .messageRight {
  141. float: left;
  142. }
  143. // 左侧
  144. .messageLeft {
  145. // 轮播图
  146. >img {
  147. width: 790px;
  148. height: 440px;
  149. }
  150. // 轮播图下小图列表
  151. .smallList {
  152. width: 790px;
  153. height: 140px;
  154. margin-top: 16px;
  155. >li {
  156. width: 250px;
  157. height: 140px;
  158. float: left;
  159. padding-right: 20px;
  160. position: relative;
  161. // background-color: #f5f5f5;
  162. img {
  163. width: 250px;
  164. height: 140px;
  165. }
  166. p {
  167. position: absolute;
  168. bottom: 0;
  169. left: 0;
  170. width: 250px;
  171. height: 30px;
  172. white-space: nowrap;
  173. overflow: hidden;
  174. text-overflow: ellipsis;
  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: 450px;
  197. height: 405px;
  198. margin-left: 30px;
  199. .hotTop,
  200. .suggest {
  201. width: 450px;
  202. height: 283px;
  203. >h3 {
  204. height: 40px;
  205. line-height: 40px;
  206. font-family: Source Han Sans, Source Han Sans;
  207. font-weight: bold;
  208. font-size: 24px;
  209. color: #000000;
  210. line-height: 28px;
  211. text-align: left;
  212. font-style: normal;
  213. text-transform: none;
  214. border-bottom: 1px solid #139602;
  215. >span {
  216. float: right;
  217. width: 56px;
  218. height: 20px;
  219. line-height: 24px;
  220. font-family: PingFang SC, PingFang SC;
  221. font-weight: 400;
  222. font-size: 14px;
  223. color: #999999;
  224. font-style: normal;
  225. text-transform: none;
  226. }
  227. }
  228. ul {
  229. >li {
  230. height: 25px;
  231. padding-top: 20px;
  232. >strong {
  233. display: inline-block;
  234. width: 24px;
  235. height: 24px;
  236. line-height: 24px;
  237. background-color: #cecece;
  238. padding-left: 6px;
  239. box-sizing: border-box;
  240. font-family: Source Han Sans, Source Han Sans;
  241. font-weight: 500;
  242. font-size: 18px;
  243. color: #FFFFFF;
  244. font-style: normal;
  245. text-transform: none;
  246. vertical-align: -2px;
  247. }
  248. &:nth-child(1)>strong {
  249. background-color: #00C524;
  250. }
  251. &:nth-child(2)>strong {
  252. background-color: #FFDF27;
  253. }
  254. &:nth-child(3)>strong {
  255. background-color: #F3C57F;
  256. }
  257. >em {
  258. display: inline-block;
  259. width: 6px;
  260. height: 6px;
  261. border-radius: 10px;
  262. border: 2px solid #8CBA86;
  263. vertical-align: -1px;
  264. }
  265. >a,
  266. >span {
  267. display: inline-block;
  268. width: 416px;
  269. height: 25px;
  270. font-family: PingFang SC, PingFang SC;
  271. font-weight: 500;
  272. font-size: 18px;
  273. color: #333333;
  274. line-height: 21px;
  275. text-align: left;
  276. font-style: normal;
  277. text-transform: none;
  278. padding-left: 9px;
  279. white-space: nowrap;
  280. overflow: hidden;
  281. text-overflow: ellipsis;
  282. vertical-align: middle;
  283. }
  284. >a:hover,
  285. >span:hover {
  286. color: #139609;
  287. }
  288. }
  289. }
  290. }
  291. .hotTop {
  292. width: 450px;
  293. }
  294. .suggest {
  295. margin-top: 32px;
  296. }
  297. }
  298. }
  299. </style>