1.vue 7.3 KB

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