1.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <template>
  2. <div class="scrollTextSectorBox">
  3. <div class="scrollTextSectorLeft">
  4. <el-carousel :interval="3333" height="405px" indicator-position="none" arrow="always" @change="change_fun">
  5. <el-carousel-item v-for="item in component_style1_News1Array" :key="item.id">
  6. <NuxtLink
  7. :href="getLinkPathDetail(item)"
  8. :title="item.title"
  9. :target="item.islink == 1 ? '_blank' : '_self'"
  10. >
  11. <img :src="item.imgurl" />
  12. <span class="swiper_dot1 dot1">
  13. {{ item.title }}
  14. </span>
  15. </NuxtLink>
  16. </el-carousel-item>
  17. <div class="roll_num_box">
  18. <span class="roll_num_box_new">{{ roll_num_this + 1 }}</span>/{{ roll_num_lang }}
  19. </div>
  20. </el-carousel>
  21. </div>
  22. <div class="scrollTextSectorRight">
  23. <div class="listNewsTitle">
  24. <NuxtLink
  25. v-if="titleLink.cid"
  26. :href="getLinkPath(titleLink)"
  27. :title="titleLink.alias"
  28. >
  29. {{titleLink.alias}}
  30. </NuxtLink>
  31. </div>
  32. <!-- 样式1 -->
  33. <div class="scrollTextSectorList" v-if="componentStyle==1">
  34. <div v-for="(item,index) in component_style1_News2Array">
  35. <NuxtLink
  36. :href="getLinkPathDetail(item)"
  37. :title="item.title"
  38. :target="item.islink == 1 ? '_blank' : '_self'"
  39. >
  40. <span>[{{titleLink.alias}}]</span>
  41. {{ item.title }}
  42. </NuxtLink>
  43. </div>
  44. </div>
  45. <!-- 样式2 -->
  46. <div class="scrollTextSectorList scrollTextSectorStyle2" v-if="componentStyle==2">
  47. <div v-for="item in component_style1_News2Array">
  48. <NuxtLink
  49. :href="getLinkPathDetail(item)"
  50. :title="item.title"
  51. :target="item.islink == 1 ? '_blank' : '_self'"
  52. >
  53. <span v-if="index!=0">[{{titleLink.alias}}]</span>
  54. {{ item.title }}
  55. </NuxtLink>
  56. </div>
  57. </div>
  58. <!--样式3-->
  59. <div class="scrollTextSectorList scrollTextSectorStyle3" v-if="componentStyle==3">
  60. <div v-for="item in component_style1_News2Array">
  61. <NuxtLink
  62. :href="getLinkPathDetail(item)"
  63. :title="item.title"
  64. :target="item.islink == 1 ? '_blank' : '_self'"
  65. >
  66. <span v-if="index!=0">[{{titleLink.alias}}]</span>
  67. {{ item.title }}
  68. </NuxtLink>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </template>
  74. <script setup>
  75. //引入vue
  76. import {ref} from 'vue';
  77. import { ElCarousel, ElCarouselItem } from 'element-plus'
  78. //获得新闻数据
  79. const props = defineProps({
  80. titleLink:Object,//板块名称
  81. templateData:Array,//新闻数据
  82. componentStyle:Number,//样式编号
  83. templateAdData:Object,//广告
  84. });
  85. //轮播图
  86. const roll_num_this = ref(0)
  87. const roll_num_lang = ref(props.templateData.imgnum.length - 1);
  88. const change_fun = (the_1) => {
  89. roll_num_this.value = the_1
  90. }
  91. //样式1与样式2共用 start ---------------------------------------->
  92. const component_style1_News1Array = ref([]);
  93. component_style1_News1Array.value = props.templateData.imgnum.slice(0,5);
  94. const component_style1_News2Array = ref([]);
  95. component_style1_News2Array.value = props.templateData.textnum.slice(0,9);
  96. //样式1与样式2共用 end ---------------------------------------->
  97. </script>
  98. <style lang="less" scoped>
  99. //基本样式 start ---------------------------------------->
  100. .scrollTextSectorBox {
  101. width: 1200px;
  102. height: 410px;
  103. position: relative;
  104. display: flex;
  105. align-items: center;
  106. justify-content: space-between;
  107. img{
  108. width: 720px;
  109. height: 405px;
  110. display: block;
  111. }
  112. .scrollTextSectorLeft {
  113. width: 720px;
  114. height: 405px;
  115. }
  116. .scrollTextSectorRight {
  117. width: 450px;
  118. height: 405px;
  119. .listNewsTitle {
  120. font-size:22px;
  121. font-weight:bold;
  122. height: 40px;
  123. line-height: 40px;
  124. border-bottom: 2px solid #004564;
  125. color:#004564;
  126. margin-bottom: 20px;
  127. box-sizing: border-box;
  128. a {
  129. color:#004564;
  130. display: block;
  131. height: 25px;
  132. line-height: 25px;
  133. }
  134. }
  135. .scrollTextSectorList {
  136. div{
  137. font-size: 18px;
  138. height: 24px;
  139. line-height: 24px;
  140. margin-bottom: 16px;
  141. overflow: hidden;
  142. white-space: nowrap;
  143. text-overflow: ellipsis;
  144. span {
  145. margin-right: 5px;
  146. color:#004564;
  147. }
  148. a {
  149. color:#333333;
  150. }
  151. &:last-child {
  152. margin-bottom: 0;
  153. }
  154. }
  155. }
  156. }
  157. }
  158. .roll_num_box {
  159. position: absolute;
  160. z-index: 2;
  161. left: 60px;
  162. bottom: 5px;
  163. height: 60px;
  164. line-height: 60px;
  165. color: #fff;
  166. font-size: 16px;
  167. .roll_num_box_new {
  168. font-size: 20px;
  169. }
  170. }
  171. .dot1 {
  172. display: block;
  173. word-break: keep-all;
  174. white-space: nowrap;
  175. overflow: hidden;
  176. text-overflow: ellipsis;
  177. }
  178. .swiper_dot1 {
  179. display: block;
  180. width: 100%;
  181. line-height: 60px;
  182. height: 60px;
  183. color: #fff;
  184. font-size: 18px;
  185. text-indent: 20px;
  186. position: absolute;
  187. bottom: 0;
  188. left: 0;
  189. z-index: 10;
  190. box-sizing: border-box;
  191. padding: 0 144px;
  192. background: linear-gradient(0deg, rgba(0, 0, 0, 0.5) 33%, rgba(0, 0, 0, 0) 100%);
  193. }
  194. .el-carousel {
  195. :deep(.el-carousel__arrow i) {
  196. font-size: 33px !important;
  197. }
  198. .roll_1_box {
  199. position: relative;
  200. }
  201. :deep(.el-carousel__arrow--left) {
  202. position: absolute;
  203. width: 35px;
  204. height: 57px;
  205. color: #fff;
  206. background: rgba(0, 0, 0, 0);
  207. left: 9px;
  208. border: none;
  209. border-radius: 0;
  210. top: 100%;
  211. margin-top: -36px;
  212. }
  213. :deep(.el-carousel__arrow--right) {
  214. width: 35px;
  215. height: 57px;
  216. color: #fff;
  217. background: rgba(0, 0, 0, 0);
  218. position: absolute;
  219. right: 9;
  220. border: none;
  221. border-radius: 0;
  222. top: 100%;
  223. margin-top: -36px;
  224. }
  225. :deep(.el-carousel__indicators) {
  226. // 指示器
  227. left: unset;
  228. transform: unset;
  229. right: 10px;
  230. bottom: 11px;
  231. }
  232. :deep(.el-carousel__button) {
  233. // 指示器按钮
  234. width: 10px;
  235. height: 10px;
  236. border: none;
  237. border-radius: 5px;
  238. background: #fff;
  239. opacity: 1;
  240. }
  241. :deep(.is-active .el-carousel__button) {
  242. // 指示器激活按钮
  243. background: #255590;
  244. width: 25px;
  245. opacity: 1;
  246. }
  247. :deep(.el-carousel__container) {
  248. height: 100%;
  249. }
  250. }
  251. .custom-indicator button {
  252. background-color: #fff;
  253. opacity: 1;
  254. width: 8px;
  255. height: 8px;
  256. }
  257. .custom-indicator button.is-active {
  258. background-color: #DD7D18;
  259. width: 58px;
  260. opacity: 1;
  261. }
  262. //基本样式 end ---------------------------------------->
  263. //样式2 start ---------------------------------------->
  264. .scrollTextSectorStyle2 {
  265. div:nth-child(1) {
  266. font-weight: bold;
  267. color: #333333;
  268. span {
  269. display: none;
  270. }
  271. }
  272. }
  273. //样式2 end ---------------------------------------->
  274. //样式3 start ---------------------------------------->
  275. .scrollTextSectorBox{
  276. .scrollTextSectorRight{
  277. .scrollTextSectorStyle3 {
  278. div:nth-child(1) {
  279. a{
  280. &:first-child {
  281. font-weight: bold;
  282. color: #004564;
  283. }
  284. }
  285. span{
  286. display: none;
  287. }
  288. }
  289. }
  290. }
  291. }
  292. // 样式3 end ---------------------------------------->
  293. </style>