3.vue 7.0 KB

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