PageMessage.vue 9.4 KB

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