PageMessage.vue 9.8 KB

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