PageMessage.vue 9.5 KB

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