6.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <div class="hotNewsBox">
  3. <div class="listNewsTitle">
  4. <div>热点精选</div>
  5. </div>
  6. <!--样式1-->
  7. <div class="hotNewsContent_skin2" v-if="componentStyle == 1">
  8. <div v-for="(item, index) in component_style1_News1Array">
  9. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  10. :target="item.islink == 1 ? '_blank' : '_self'">
  11. <span>{{ index + 1 }}</span>
  12. {{ item.title }}
  13. </NuxtLink>
  14. </div>
  15. </div>
  16. <!--样式2-->
  17. <div class="hotNewsContent_skin2 hotNewsStyle2" v-if="componentStyle == 2">
  18. <div v-for="(item, index) in component_style1_News1Array">
  19. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  20. :target="item.islink == 1 ? '_blank' : '_self'">
  21. <span>{{ index + 1 }}</span>
  22. {{ item.title }}
  23. </NuxtLink>
  24. </div>
  25. </div>
  26. <!-- 样式3 -->
  27. <div class="hotNewsContent_skin2 hotNewsStyle3" v-if="componentStyle == 3">
  28. <div v-for="(item, index) in component_style1_News1Array">
  29. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  30. :target="item.islink == 1 ? '_blank' : '_self'">
  31. <span>{{ index + 1 }}</span>
  32. {{ item.title }}
  33. </NuxtLink>
  34. </div>
  35. </div>
  36. <!-- 样式4 -->
  37. <div class="hotNewsContent_skin2 hotNewsStyle4" v-if="componentStyle == 4">
  38. <div v-for="(item, index) in component_style1_News1Array">
  39. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  40. :target="item.islink == 1 ? '_blank' : '_self'">
  41. <span>{{ index + 1 }}</span>
  42. {{ item.title }}
  43. </NuxtLink>
  44. </div>
  45. </div>
  46. <!-- 样式5 -->
  47. <div class="hotNewsContent_skin2 hotNewsStyle5" v-if="componentStyle == 5">
  48. <div v-for="(item, index) in component_style1_News1Array" :key="index">
  49. <NuxtLink :href="getLinkPathDetail(item)" :title="item.title"
  50. :target="item.islink == 1 ? '_blank' : '_self'">
  51. {{ item.title }}
  52. </NuxtLink>
  53. </div>
  54. </div>
  55. </div>
  56. </template>
  57. <script setup>
  58. //引入vue
  59. import { ref } from 'vue';
  60. //获得新闻数据
  61. const props = defineProps({
  62. componentStyle: Number,//样式编号
  63. });
  64. const component_style1_News1Array = ref([]);
  65. //component_style1_News1Array.value = props.templateData.text.slice(0,8);
  66. async function getPageData() {
  67. const mkdata = await requestDataPromise('/web/getWebsiteArticlett', {
  68. method: 'GET',
  69. query: {
  70. 'imgnum': 0,
  71. 'textnum': 8,
  72. 'level': 5,
  73. 'placeid': 0,
  74. 'id': 0
  75. },
  76. });
  77. if (mkdata.code == 200) {
  78. component_style1_News1Array.value = mkdata.data.text;
  79. }
  80. }
  81. getPageData();
  82. </script>
  83. <style lang="less" scoped>
  84. //基本样式 start ---------------------------------------->
  85. .hotNewsBox {
  86. .listNewsTitle {
  87. display: flex;
  88. align-items: flex-start;
  89. justify-content: flex-start;
  90. // border-bottom: 1px solid #999999;
  91. height: 38px;
  92. margin-bottom: 20px;
  93. div {
  94. height: 35px;
  95. width: 138px;
  96. line-height: 32px;
  97. font-size: 22px;
  98. font-weight: bold;
  99. color: #333333;
  100. cursor: pointer;
  101. overflow: hidden;
  102. text-overflow: ellipsis;
  103. white-space: nowrap;
  104. color: #154079;
  105. background: url("https://img.bjzxtw.org.cn/pre/image/png/20251104/1762224944805589.png") bottom left no-repeat;
  106. }
  107. }
  108. .hotNewsContent_skin2 {
  109. font-size: 18px;
  110. color: #333333;
  111. div {
  112. a {
  113. display: block;
  114. color: #333333;
  115. overflow: hidden;
  116. white-space: nowrap;
  117. text-overflow: ellipsis;
  118. }
  119. padding-bottom:20px;
  120. border-bottom:1px solid #E4E4E4;
  121. margin-bottom: 22px;
  122. overflow: hidden;
  123. white-space: nowrap;
  124. text-overflow: ellipsis;
  125. span {
  126. margin-right: 15px;
  127. font-size: 20px;
  128. font-weight: bold;
  129. font-style: italic;
  130. color: #D9D9D9;
  131. }
  132. &:nth-child(1) span,
  133. &:nth-child(2) span,
  134. &:nth-child(3) span {
  135. color: #154079;
  136. }
  137. }
  138. }
  139. }
  140. //基本样式 end ---------------------------------------->
  141. //样式2 start ---------------------------------------->
  142. .hotNewsBox {
  143. .hotNewsStyle2 {
  144. font-size: 18px;
  145. color: #333333;
  146. div {
  147. padding-bottom: 20px;
  148. border-bottom: 1px solid #E4E4E4;
  149. margin-bottom: 22px;
  150. overflow: hidden;
  151. white-space: nowrap;
  152. text-overflow: ellipsis;
  153. span {
  154. margin-right: 15px;
  155. font-size: 20px;
  156. font-weight: bold;
  157. font-style: italic;
  158. color: #154079;
  159. }
  160. }
  161. }
  162. }
  163. //样式2 end ---------------------------------------->
  164. //样式3 start ---------------------------------------->
  165. .hotNewsBox {
  166. .hotNewsStyle3 {
  167. font-size: 18px;
  168. color: #333333;
  169. div {
  170. border-bottom: 1px dashed #E4E4E4;
  171. }
  172. }
  173. }
  174. //样式3 end ---------------------------------------->
  175. //样式4 start ---------------------------------------->
  176. .hotNewsBox {
  177. .hotNewsStyle4 {
  178. font-size: 18px;
  179. color: #333333;
  180. div {
  181. padding-bottom: 20px;
  182. border-bottom: 1px dashed #E4E4E4;
  183. margin-bottom: 22px;
  184. overflow: hidden;
  185. white-space: nowrap;
  186. text-overflow: ellipsis;
  187. span {
  188. margin-right: 15px;
  189. font-size: 20px;
  190. font-weight: bold;
  191. font-style: italic;
  192. color: #154079;
  193. }
  194. }
  195. }
  196. }
  197. //样式4 end ---------------------------------------->
  198. //样式5 start ---------------------------------------->
  199. .hotNewsBox {
  200. .hotNewsStyle5 {
  201. font-size: 18px;
  202. color: #333333;
  203. div {
  204. padding-bottom: 20px;
  205. border-bottom: 1px dashed #E4E4E4;
  206. margin-bottom: 22px;
  207. overflow: hidden;
  208. white-space: nowrap;
  209. text-overflow: ellipsis;
  210. span {
  211. margin-right: 15px;
  212. font-size: 20px;
  213. font-weight: bold;
  214. font-style: italic;
  215. color: #154079;
  216. }
  217. }
  218. }
  219. }
  220. </style>