PageMessage.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <div class="topNews">
  3. <div class="newsTitle">今日头条</div>
  4. <div class="newsContent">
  5. <div class="newsItem">
  6. <a href="#">十四届全国人大常委会第十九次会议举行第二次全体会议 审议执法检查报告、专项工作报告等 赵乐际出席会议</a>
  7. </div>
  8. <div class="newsItem">
  9. <a href="#">最高检调研组在四川调研</a>
  10. </div>
  11. <div class="newsItem">
  12. <a href="#">辽宁高院深入学习贯彻中央经济工作会议精神</a>
  13. </div>
  14. <div class="newsItem">
  15. <a href="#">省检察院召开党组(扩大)会议 传达学习中央经济工作会议精神</a>
  16. </div>
  17. </div>
  18. </div>
  19. </template>
  20. <script setup>
  21. //0.加载必备依赖 start ---------------------------------------->
  22. import { NuxtLink } from "#components";
  23. import { ref, onMounted } from "vue"
  24. const nuxtApp = useNuxtApp();
  25. const axios = nuxtApp.$axios;
  26. const getLinkPathDetail = (item) => {
  27. if (item.islink == 1) {
  28. return `${item.linkurl}`;
  29. } else {
  30. return `/${item.pinyin}/${item.id}.html`;
  31. }
  32. }
  33. //0.加载必备依赖 end ---------------------------------------->
  34. //1.获得板块数据 start ---------------------------------------->
  35. //大标题
  36. const headlinelist = ref([])
  37. //大标题下面的二级内容
  38. const headlinelist1 = ref([])
  39. async function getModelData1() {
  40. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  41. method: 'GET',
  42. query: {
  43. 'imgnum': 0,
  44. 'textnum': 3,
  45. 'level': 1,
  46. 'placeid': 0,
  47. 'id': ''
  48. },
  49. });
  50. if (mkdata.code == 200) {
  51. for (let index in mkdata.data.text) {
  52. if (index < 1) {
  53. headlinelist.value.push(mkdata.data.text[index])
  54. } else {
  55. headlinelist1.value.push(mkdata.data.text[index])
  56. }
  57. }
  58. } else {
  59. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  60. console.log("错误位置:设置大标题")
  61. console.log("后端错误反馈:", mkdata.message)
  62. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  63. }
  64. }
  65. getModelData1()
  66. const hotNewsList = ref("")
  67. async function getModelData3() {
  68. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  69. method: 'GET',
  70. query: {
  71. 'imgnum': 0,
  72. 'textnum': 8,
  73. 'level': 6,
  74. 'placeid': 0,
  75. 'id': ''
  76. },
  77. });
  78. if (mkdata.code == 200) {
  79. hotNewsList.value = mkdata.data.text;
  80. } else {
  81. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  82. // console.log("错误位置:获取首页今日热点")
  83. // console.log("后端错误反馈:", mkdata.message)
  84. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  85. }
  86. }
  87. getModelData3()
  88. //1.获得板块数据 end ---------------------------------------->
  89. </script>
  90. <style lang="less" scoped>
  91. // >1400px
  92. @media screen and (min-width: 1401px) {
  93. .topNews {
  94. width: 1400PX;
  95. height: 32PX;
  96. margin: 20PX auto;
  97. background-color: #f0f0f0;
  98. position: relative;
  99. font-family: "微软雅黑", "microsoft yahei";
  100. .newsTitle {
  101. position: absolute;
  102. top: 0;
  103. left: -2PX;
  104. width: 140PX;
  105. height: 32PX;
  106. line-height: 32PX;
  107. background: url("../../public/index/titleIcon.jpg") no-repeat center center;
  108. color: #fff;
  109. font-size: 18PX;
  110. padding-left: 25PX;
  111. box-sizing: border-box;
  112. }
  113. .newsContent {
  114. width: 1400PX;
  115. height: 32PX;
  116. line-height: 32PX;
  117. padding-left: 180PX;
  118. box-sizing: border-box;
  119. font-size: 12PX;
  120. color: #000;
  121. display: flex;
  122. .newsItem {
  123. width: 305PX;
  124. text-align: center;
  125. position: relative;
  126. a {
  127. display: inline-block;
  128. width: 300PX;
  129. overflow: hidden;
  130. text-overflow: ellipsis;
  131. white-space: nowrap;
  132. color: #000;
  133. padding: 0 20PX;
  134. box-sizing: border-box;
  135. }
  136. }
  137. .newsItem::after {
  138. content: "";
  139. position: absolute;
  140. right: 0;
  141. /* 贴元素右侧 */
  142. top: 25%;
  143. /* 边框顶部距离元素顶部20%,可改固定值如10PX */
  144. width: 1PX;
  145. /* 边框宽度 */
  146. height: 50%;
  147. /* 边框长度(核心!改数值即可调整长短) */
  148. background-color: #ccc;
  149. /* 边框颜色,和原样式一致 */
  150. }
  151. .newsItem:last-child::after {
  152. display: none;
  153. /* 直接隐藏伪元素 */
  154. /* 或用 visibility: hidden; 效果一致,按需选 */
  155. }
  156. }
  157. }
  158. }
  159. // 801px-1400px
  160. @media screen and (min-width: 801px) and (max-width: 1400px) {
  161. .topNews {
  162. width: 100%;
  163. height: 32PX;
  164. margin: 20PX auto;
  165. background-color: #f0f0f0;
  166. position: relative;
  167. font-family: "微软雅黑", "microsoft yahei";
  168. .newsTitle {
  169. position: absolute;
  170. top: 0;
  171. left: -2PX;
  172. width: 140PX;
  173. height: 32PX;
  174. line-height: 32PX;
  175. background: url("../../public/index/titleIcon.jpg") no-repeat center center;
  176. color: #fff;
  177. font-size: 18PX;
  178. padding-left: 25PX;
  179. box-sizing: border-box;
  180. }
  181. .newsContent {
  182. width: 100%;
  183. height: 32PX;
  184. line-height: 32PX;
  185. padding-left: 180PX;
  186. box-sizing: border-box;
  187. font-size: 12PX;
  188. color: #000;
  189. display: flex;
  190. .newsItem {
  191. width: 25%;
  192. text-align: center;
  193. position: relative;
  194. a {
  195. display: inline-block;
  196. width: 90%;
  197. overflow: hidden;
  198. text-overflow: ellipsis;
  199. white-space: nowrap;
  200. color: #000;
  201. padding: 0 20PX;
  202. box-sizing: border-box;
  203. }
  204. }
  205. .newsItem::after {
  206. content: "";
  207. position: absolute;
  208. right: 0;
  209. /* 贴元素右侧 */
  210. top: 25%;
  211. /* 边框顶部距离元素顶部20%,可改固定值如10PX */
  212. width: 1PX;
  213. /* 边框宽度 */
  214. height: 50%;
  215. /* 边框长度(核心!改数值即可调整长短) */
  216. background-color: #ccc;
  217. /* 边框颜色,和原样式一致 */
  218. }
  219. .newsItem:last-child::after {
  220. display: none;
  221. }
  222. }
  223. }
  224. }
  225. // <=800px
  226. @media screen and (max-width: 800px) {
  227. .topNews {
  228. display: none;
  229. }
  230. }
  231. </style>