PageMessage.vue 9.7 KB

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