PageMessage.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <!-- 新闻头条部分 -->
  3. <div class="topNewsPart">
  4. <div class="inner">
  5. <div class="toutiao" v-if="headlinelist">
  6. <div class="xwtt">
  7. <NuxtLink v-for="(item, index) in headlinelist" :href="getLinkPathDetail(item)" :title="item.title"
  8. :target="item.islink == 1 ? '_blank' : '_self'"
  9. :key="index">
  10. <h1 class="tttitle">{{ item.title }}</h1>
  11. </NuxtLink>
  12. </div>
  13. <ul class="toutiao1" v-if="headlinelist1">
  14. <li class="toutiaolist" v-for="item in headlinelist1">
  15. <NuxtLink :to="{ path: `/${item.pinyin}/${item.id}.html` }" :title="item.title">{{ item.title }}
  16. </NuxtLink>
  17. </li>
  18. </ul>
  19. </div>
  20. <div class="messageLeft">
  21. <div class="lunbo">
  22. <HomeBigSwiper></HomeBigSwiper>
  23. </div>
  24. <div class="messageleft_photo_text" v-if="moveBannerList">
  25. <div class="messageleft_photo" v-for="item in moveBannerList" :key="index">
  26. <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" :title="item.title">
  27. <img :src="item.imgurl">
  28. <div class="message_text">
  29. {{ item.title }}
  30. </div>
  31. </NuxtLink>
  32. </div>
  33. </div>
  34. </div>
  35. <div class="messageRight">
  36. <div class="messageRight_title ">
  37. 要闻
  38. </div>
  39. <!-- <div class="phone_name_box pc_none">
  40. <a class=" " title="">
  41. 要闻
  42. </a>
  43. </div> -->
  44. <ul class="messageRight_content" v-if="hotNewsList_data1">
  45. <li v-for="item in hotNewsList_data1" :key="index" class="messageRight_content_title">
  46. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  47. :target="item.islink == 1 ? '_blank' : '_self'">
  48. {{ item.title }}
  49. </NuxtLink>
  50. </li>
  51. </ul>
  52. <ul class="messageRight_content" v-if="hotNewsList_data2">
  53. <li v-for="item in hotNewsList_data2" :key="index" class="messageRight_content_title">
  54. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  55. :target="item.islink == 1 ? '_blank' : '_self'">
  56. {{ item.title }}
  57. </NuxtLink>
  58. </li>
  59. </ul>
  60. <ul class="messageRight_content" v-if="hotNewsList_data3">
  61. <li v-for="item in hotNewsList_data3" :key="index" class="messageRight_content_title">
  62. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  63. :target="item.islink == 1 ? '_blank' : '_self'">
  64. {{ item.title }}
  65. </NuxtLink>
  66. </li>
  67. </ul>
  68. </div>
  69. </div>
  70. </div>
  71. </template>
  72. <script setup>
  73. //0.加载必备依赖 start ---------------------------------------->
  74. import { NuxtLink } from "#components";
  75. import { ref, onMounted } from "vue"
  76. const nuxtApp = useNuxtApp();
  77. const axios = nuxtApp.$axios;
  78. const getLinkPathDetail = (item) => {
  79. if (item.islink == 1) {
  80. return `${item.linkurl}`;
  81. } else {
  82. return `/${item.pinyin}/${item.id}.html`;
  83. }
  84. }
  85. //0.加载必备依赖 end ---------------------------------------->
  86. //1.获得板块数据 start ---------------------------------------->
  87. //大标题
  88. const headlinelist = ref([])
  89. //大标题下面的二级内容
  90. const headlinelist1 = ref([])
  91. async function getModelData1() {
  92. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  93. method: 'GET',
  94. query: {
  95. 'imgnum': 0,
  96. 'textnum': 4,
  97. 'level': 1,
  98. 'placeid': 0,
  99. 'id': ''
  100. },
  101. });
  102. if (mkdata.code == 200) {
  103. if (mkdata.data.text.length != 0) {
  104. for (let i = 0; i < mkdata.data.text.length; i++) {
  105. if (i < 1) {
  106. headlinelist.value.push(mkdata.data.text[i])
  107. } else {
  108. headlinelist1.value.push(mkdata.data.text[i])
  109. }
  110. }
  111. }
  112. console.log("首页大标题:", headlinelist.value)
  113. console.log("首页大标题下面的二级内容:", headlinelist1.value)
  114. } else {
  115. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  116. console.log("错误位置:设置大标题")
  117. console.log("后端错误反馈:", mkdata.message)
  118. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  119. }
  120. }
  121. getModelData1()
  122. const moveBannerList = ref([])
  123. async function getModelData2() {
  124. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  125. method: 'GET',
  126. query: {
  127. 'imgnum': 2,
  128. 'textnum': 0,
  129. 'level': 2,
  130. 'placeid': 6,
  131. 'id': 0
  132. },
  133. });
  134. if (mkdata.code == 200) {
  135. moveBannerList.value = mkdata.data.img;
  136. } else {
  137. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  138. console.log("错误位置:获取首页轮播图下面的图文")
  139. console.log("后端错误反馈:", mkdata.message)
  140. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  141. }
  142. }
  143. getModelData2()
  144. const hotNewsList_data1 = ref([])
  145. const hotNewsList_data2 = ref([])
  146. const hotNewsList_data3 = ref([])
  147. async function getModelData3() {
  148. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  149. method: 'GET',
  150. query: {
  151. 'imgnum': 0,
  152. 'textnum': 15,
  153. 'level': 6,
  154. 'placeid': 0,
  155. 'id': ''
  156. },
  157. });
  158. if (mkdata.code == 200) {
  159. for (let i = 0; i < mkdata.data.text.length; i++) {
  160. if (i >= 0 && i <= 4) {
  161. hotNewsList_data1.value.push(mkdata.data.text[i])
  162. } else if (i >= 5 && i <= 9) {
  163. hotNewsList_data2.value.push(mkdata.data.text[i])
  164. } else if (i >= 10 && i <= 14) {
  165. hotNewsList_data3.value.push(mkdata.data.text[i])
  166. }
  167. }
  168. } else {
  169. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  170. // console.log("错误位置:获取首页今日热点")
  171. // console.log("后端错误反馈:", mkdata.message)
  172. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  173. }
  174. }
  175. getModelData3()
  176. //1.获得板块数据 end ---------------------------------------->
  177. </script>
  178. <style lang="less" scoped>
  179. @import url('@/assets/css/components/pagemessage.less');
  180. </style>
  181. <style lang="less" scoped>
  182. @media screen and (min-width:801px){/*pc*/
  183. .pc_none{display:none;}
  184. }
  185. @media screen and (max-width:800px){/*ipad_phone*/
  186. .topNewsPart .inner { margin:0 auto;
  187. overflow: hidden;
  188. width: 92%
  189. }
  190. .topNewsPart .inner .toutiao .xwtt{width:100%;height:auto;line-height:normal;margin-top:15px;}
  191. .topNewsPart .inner .toutiao .xwtt a{width:100%;height:auto;line-height:normal;}
  192. .topNewsPart .inner .toutiao .xwtt h1.tttitle{
  193. width:100%;height:33px;line-height:33px;font-size:22px;color:#333;
  194. }
  195. .topNewsPart .inner .toutiao .toutiao1{width:100%;padding:0px;height:22px;line-height:22px;margin-top:13px;overflow:hidden;text-align:center;}
  196. .topNewsPart .inner .toutiao .toutiao1 .toutiaolist{
  197. display:none;height:22px;overflow:hidden;width:90%;margin:0px auto;
  198. }
  199. .topNewsPart .inner .toutiao .toutiao1 .toutiaolist a{
  200. display:block;width:100%;height:22px;line-height:22px;text-align:center;
  201. word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;
  202. font-size:16px;color:#333;
  203. }
  204. .topNewsPart .inner .toutiao .toutiao1 .toutiaolist:nth-of-type(1){display:block;}
  205. .topNewsPart .inner .messageLeft{width:100%;float:none;}
  206. .topNewsPart .inner .messageLeft .lunbo{width:100%;height:55vw;overflow:hidden;}
  207. .topNewsPart .inner .messageRight{width:100%;float:none;}
  208. .messageRight_title{margin-top:27px;}
  209. .phone_name_box{
  210. width:100%;height:50px; margin-top:15px;
  211. a{
  212. float:left;height:50px;line-height:50px;font-size:18px;color:#DD7D18;font-weight:bold;
  213. box-sizing:border-box;
  214. }
  215. }
  216. .topNewsPart .inner .messageRight .messageRight_content{width:100%;display:block;margin:8px auto 15px;overflow:hidden;height:205px;}
  217. .topNewsPart .inner .messageRight .messageRight_content .messageRight_content_title{
  218. width:100%!important;display:block;height:40px!important;
  219. border-bottom:1px solid #E6E6E6;margin:0px!important;
  220. }
  221. .topNewsPart .inner .messageRight .messageRight_content .messageRight_content_title:nth-of-type(n+6){
  222. display:none;
  223. }
  224. .topNewsPart .inner .messageRight .messageRight_content .messageRight_content_title a{
  225. width:100%!important;display:block;font-weight:normal!important;
  226. line-height:40px;height:40px;position:relative;text-indent:18px;
  227. word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;font-size:16px;
  228. }
  229. .topNewsPart .inner .messageRight .messageRight_content .messageRight_content_title a::after{
  230. content: '';display: block;
  231. position:absolute;left:0px;top:18px;background:#E6E6E6;
  232. width:6px;height:6px;
  233. }
  234. .messageRight .messageRight_content:nth-of-type(n+2){display:none!important;}
  235. .topNewsPart .inner .messageLeft .messageleft_photo_text{display:none;}
  236. .phone_none{display:none;}
  237. }
  238. </style>