HotNews2.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <div class="title">
  3. <h4>
  4. 热点精选
  5. </h4>
  6. </div>
  7. <!-- 列表 -->
  8. <ul class="rightList">
  9. <li v-for="item in hotNewsList">
  10. <NuxtLink :to="item.linkurl" v-if="item.islink == 1" :title="item.title">
  11. {{ item.title }}
  12. </NuxtLink>
  13. <NuxtLink :to="`/${item.pinyin}/${item.id}.html`" v-if="item.islink == 0" :title="item.title">
  14. {{ item.title }}
  15. </NuxtLink>
  16. </li>
  17. </ul>
  18. </template>
  19. <script setup>
  20. const hotNewsList = ref([])
  21. async function getPageData() {
  22. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  23. method: 'GET',
  24. query: {
  25. 'textnum': 0,
  26. 'imgnum': 5,
  27. 'level': 5,
  28. 'placeid': 0,
  29. 'id': 0
  30. },
  31. });
  32. console.log("获取热点精选", mkdata);
  33. if (mkdata.code == 200) {
  34. for (let item of mkdata.data.img) {
  35. if (item.imgurl) {
  36. hotNewsList.value.push(item)
  37. if (hotNewsList.value.length == 5) {
  38. break;
  39. }
  40. }
  41. }
  42. // hotNewsList.value = mkdata.data;
  43. } else {
  44. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  45. console.log("错误位置:获取热点精选")
  46. console.log("后端错误反馈:", mkdata.message)
  47. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  48. }
  49. }
  50. getPageData();
  51. </script>
  52. <style lang="less" scoped>
  53. .title {
  54. width: 100%;
  55. overflow: hidden;
  56. >h4 {
  57. width: 100%;
  58. height: 70px;
  59. line-height: 70px;
  60. background-size: 100% 100%;
  61. background: url('../../public/index/reconewsh2.gif') no-repeat #158d91;
  62. font-size: 22px;
  63. color: #fff;
  64. font-weight: bold;
  65. padding-left: 30px;
  66. box-sizing: border-box;
  67. >span {
  68. float: right;
  69. font-family: Microsoft YaHei, Microsoft YaHei;
  70. font-weight: 400;
  71. font-size: 14px;
  72. margin-right: 10px;
  73. color: #999999;
  74. text-align: left;
  75. font-style: normal;
  76. text-transform: none;
  77. }
  78. }
  79. }
  80. .rightList {
  81. padding-top: 20px;
  82. background-color: #f1f1f1;
  83. padding-bottom: 30px;
  84. >li {
  85. width: 90%;
  86. margin: 0 auto;
  87. border-bottom: 1px dashed #ccc;
  88. background: url(../../public/index/reconlia.png) no-repeat 0 20px;
  89. padding-left: 20px;
  90. box-sizing: border-box;
  91. a {
  92. display: block;
  93. width: 100%;
  94. height: 50px;
  95. line-height: 50px;
  96. font-size: 14px;
  97. color: #333;
  98. text-overflow: ellipsis;
  99. overflow: hidden;
  100. white-space: nowrap;
  101. }
  102. }
  103. }
  104. .title>h4 {
  105. height: 55PX;
  106. line-height: 55PX;
  107. font-size: 20PX;
  108. }
  109. .rightList {}
  110. .rightList>li a {
  111. height: 44PX;
  112. line-height: 44PX;
  113. font-size: 16PX;
  114. }
  115. .rightList>li {
  116. background-position-y: center;
  117. }
  118. @media screen and (min-width: 1401px) {
  119. //你的样式
  120. }
  121. @media screen and (max-width: 1400px) {}
  122. @media screen and (min-width: 801px) and (max-width: 1400px) {
  123. //你的样式
  124. }
  125. @media screen and (max-width: 800px) {
  126. .title>h4 {
  127. height: 55px;
  128. line-height: 55px;
  129. font-size: 20px;
  130. }
  131. .rightList {}
  132. .rightList>li {
  133. padding-left: 26px;
  134. }
  135. .rightList>li a {
  136. height: 55px;
  137. line-height: 55px;
  138. font-size: 22px;
  139. }
  140. }
  141. </style>