2.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <div class="hotNewsBox">
  3. <div class="listNewsTitle_skin2" >
  4. <span><b>热点精选</b></span>
  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
  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_skin2 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_skin2 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_skin2 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_skin2 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_skin2 {
  102. font-size: 22px;
  103. font-weight: bold;
  104. height: 40px;
  105. line-height: 25px;
  106. border-bottom: 2px solid #A91B33;
  107. color: #A91B33;
  108. margin-bottom: 20px;
  109. box-sizing: border-box;
  110. span {
  111. color:#A91B33;
  112. height: 30px;
  113. line-height: 30px;
  114. border-left: 3px solid #A91B33;
  115. padding-left: 12px;
  116. }
  117. }
  118. .hotNewsContent_skin2 {
  119. font-size:18px;
  120. color:#333333;
  121. div {
  122. a {
  123. display: block;
  124. color:#333333;
  125. overflow: hidden;
  126. white-space: nowrap;
  127. text-overflow: ellipsis;
  128. }
  129. padding-bottom:20px;
  130. border-bottom:1px solid #E4E4E4;
  131. margin-bottom: 22px;
  132. overflow: hidden;
  133. white-space: nowrap;
  134. text-overflow: ellipsis;
  135. span {
  136. margin-right: 15px;
  137. font-size:20px;
  138. font-weight:bold;
  139. font-style: italic;
  140. color: #D9D9D9;
  141. }
  142. &:nth-child(1) span,
  143. &:nth-child(2) span,
  144. &:nth-child(3) span {
  145. color: #A91B33;
  146. }
  147. }
  148. }
  149. }
  150. //基本样式 end ---------------------------------------->
  151. //样式2 start ---------------------------------------->
  152. .hotNewsBox {
  153. .hotNewsStyle2 {
  154. font-size:18px;
  155. color:#333333;
  156. div {
  157. padding-bottom:20px;
  158. border-bottom:1px solid #E4E4E4;
  159. margin-bottom: 22px;
  160. overflow: hidden;
  161. white-space: nowrap;
  162. text-overflow: ellipsis;
  163. span {
  164. margin-right: 15px;
  165. font-size:20px;
  166. font-weight:bold;
  167. font-style: italic;
  168. color: #A91B33;
  169. }
  170. }
  171. }
  172. }
  173. //样式2 end ---------------------------------------->
  174. //样式3 start ---------------------------------------->
  175. .hotNewsBox {
  176. .hotNewsStyle3 {
  177. font-size:18px;
  178. color:#333333;
  179. div {
  180. border-bottom:1px dashed #E4E4E4;
  181. }
  182. }
  183. }
  184. //样式3 end ---------------------------------------->
  185. //样式4 start ---------------------------------------->
  186. .hotNewsBox {
  187. .hotNewsStyle4 {
  188. font-size:18px;
  189. color:#333333;
  190. div {
  191. padding-bottom:20px;
  192. border-bottom:1px dashed #E4E4E4;
  193. margin-bottom: 22px;
  194. overflow: hidden;
  195. white-space: nowrap;
  196. text-overflow: ellipsis;
  197. span {
  198. margin-right: 15px;
  199. font-size:20px;
  200. font-weight:bold;
  201. font-style: italic;
  202. color: #A91B33;
  203. }
  204. }
  205. }
  206. }
  207. //样式4 end ---------------------------------------->
  208. //样式5 start ---------------------------------------->
  209. .hotNewsBox {
  210. .hotNewsStyle5 {
  211. font-size:18px;
  212. color:#333333;
  213. div {
  214. padding-bottom:20px;
  215. border-bottom:1px dashed #E4E4E4;
  216. margin-bottom: 22px;
  217. overflow: hidden;
  218. white-space: nowrap;
  219. text-overflow: ellipsis;
  220. span {
  221. margin-right: 15px;
  222. font-size:20px;
  223. font-weight:bold;
  224. font-style: italic;
  225. color: #A91B33;
  226. }
  227. }
  228. }
  229. }
  230. </style>