PageMessage.vue 10 KB

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