1.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <div>
  3. <div class="headLineStyle1">
  4. <div class="headLineTitle">
  5. <img src="http://img.bjzxtw.org.cn/pre/image/png/20250603/1748932387576488.png"/>
  6. <NuxtLink
  7. :href="getLinkPathDetail(templateData[0])"
  8. :title="templateData[0].title"
  9. :target="templateData[0].islink == 1 ? '_blank' : '_self'">
  10. <div class="left_content">
  11. {{ templateData[0].title }}
  12. </div>
  13. </NuxtLink>
  14. </div>
  15. <div class="headLineContent">
  16. <NuxtLink
  17. :href="getLinkPathDetail(templateData[0])"
  18. :title="templateData[0].title"
  19. :target="templateData[0].islink == 1 ? '_blank' : '_self'">
  20. <div class="left_content">
  21. {{ templateData[0].title }}
  22. </div>
  23. </NuxtLink>
  24. </div>
  25. </div>
  26. <!-- <div class="headLineStyle1_skin2" v-if="this.$store.state.template.editWebsiteClass==2">
  27. <div class="headTip">
  28. <img src="http://img.bjzxtw.org.cn/pre/image/jpeg/20250626/1750901450165042.jpg">
  29. </div>
  30. <div class="headLineContentBox" ref="contentBox">
  31. <div class="headLineSlider" :style="sliderStyle">
  32. <div class="headLineTitleBox">
  33. <div class="headLineTop">
  34. 深入推进周边命运共同体建设 以人工智能引领科研范式变革
  35. </div>
  36. <div class="headLineBottom">
  37. <div>深刻理解新形势下中国周边工作的理念与行动</div>
  38. <div>构建周边命运共同体 携手开创亚洲新未来</div>
  39. <div>抢抓人工智能发展的历史性机遇</div>
  40. </div>
  41. </div>
  42. <div class="headLineTitleBox">
  43. <div class="headLineTop">
  44. 民航局:禁止旅客携带无3C标识及被召回的充电宝乘坐境内航班
  45. </div>
  46. <div class="headLineBottom">
  47. <div>深刻理解新形势下中国周边工作的理念与行动</div>
  48. <div>构建周边命运共同体 携手开创亚洲新未来</div>
  49. <div>抢抓人工智能发展的历史性机遇</div>
  50. </div>
  51. </div>
  52. <div class="headLineTitleBox">
  53. <div class="headLineTop">
  54. 吴奇隆刘诗诗一家三口同框 共同带孩子回家破婚变传闻
  55. </div>
  56. <div class="headLineBottom">
  57. <div>深刻理解新形势下中国周边工作的理念与行动</div>
  58. <div>构建周边命运共同体 携手开创亚洲新未来</div>
  59. <div>抢抓人工智能发展的历史性机遇</div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. <div class="headLineIcon">
  65. <div @mouseover="setActive(0)" :class="{active: activeIndex === 0}"></div>
  66. <div @mouseover="setActive(1)" :class="{active: activeIndex === 1}"></div>
  67. <div @mouseover="setActive(2)" :class="{active: activeIndex === 2}"></div>
  68. </div>
  69. </div> -->
  70. </div>
  71. </template>
  72. <script setup>
  73. //引入vue
  74. import { ref,onMounted } from 'vue';
  75. //获得新闻数据
  76. const props = defineProps({
  77. templateData:Array,//新闻数据
  78. });
  79. //样式2的效果 start ---------------------------------------->
  80. //选中的
  81. const activeIndex = ref(0);
  82. const setActive = (index) => {
  83. activeIndex.value = index;
  84. }
  85. const sliderStyle = () => {
  86. // 每个headLineTitleBox的高度是70px + 间距30px = 100px
  87. const translateY = -(this.activeIndex * 100);
  88. return {
  89. transform: `translateY(${translateY}px)`,
  90. transition: 'transform 0.3s ease-in-out'
  91. };
  92. }
  93. //样式2的效果 end ---------------------------------------->
  94. </script>
  95. <style lang="less">
  96. .headLineStyle1 {
  97. width: 1200px;
  98. height: 140px;
  99. margin: 0 auto;
  100. box-sizing: border-box;
  101. padding: 30px 100px 30px 100px;
  102. .headLineTitle {
  103. display: flex;
  104. align-items: center;
  105. justify-content: center;
  106. font-size: 30px;
  107. font-weight: bold;
  108. color: #004564;
  109. margin-bottom: 10px;
  110. img {
  111. margin-right: 20px;
  112. }
  113. a {
  114. color: #004564;
  115. }
  116. }
  117. .headLineContent{
  118. display: flex;
  119. align-items: center;
  120. justify-content: center;
  121. font-size: 18px;
  122. color:#333333;
  123. div {
  124. margin-right: 40px;
  125. overflow: hidden;
  126. text-overflow: ellipsis;
  127. white-space: nowrap;
  128. &:last-child {
  129. margin-right: 0;
  130. }
  131. }
  132. }
  133. }
  134. .headLineStyle1_skin2 {
  135. border:1px solid #E4E4E4;
  136. width: 1200px;
  137. height: 140px;
  138. box-sizing: border-box;
  139. padding:32px 15px 32px 40px;
  140. display: flex;
  141. align-items: center;
  142. justify-content: space-between;
  143. .headLineContentBox {
  144. width: 1000px;
  145. height: 70px;
  146. overflow: hidden;
  147. position: relative;
  148. .headLineSlider {
  149. display: flex;
  150. flex-direction: column; // 改为垂直方向
  151. width: 100%;
  152. height: 210px; // 3个titleBox,每个70px高
  153. }
  154. }
  155. .headLineTitleBox {
  156. text-align: center;
  157. height: 70px; // 明确设置高度
  158. width: 100%;
  159. margin-bottom: 30px;
  160. flex-shrink: 0; // 防止收缩
  161. display: flex;
  162. flex-direction: column;
  163. justify-content: center;
  164. .headLineTop {
  165. font-size: 30px;
  166. color:#A91B33;
  167. margin-bottom: 15px;
  168. font-weight: bold;
  169. }
  170. .headLineBottom {
  171. display: flex;
  172. align-items: center;
  173. justify-content: center;
  174. div {
  175. width: 32%;
  176. margin-right: 30px;
  177. font-size: 18px;
  178. color:#333333;
  179. white-space: nowrap;
  180. overflow: hidden;
  181. text-overflow: ellipsis;
  182. &:last-child {
  183. margin-right: 0;
  184. }
  185. }
  186. }
  187. }
  188. .headLineIcon {
  189. div {
  190. width: 10px;
  191. height: 10px;
  192. background: #EDEDED;
  193. margin-bottom: 10px;
  194. cursor: pointer;
  195. transition: background 0.3s ease;
  196. &:last-child {
  197. margin-bottom: 0;
  198. }
  199. &.active {
  200. background: #A91B33;
  201. }
  202. &:hover {
  203. background: #A91B33;
  204. }
  205. }
  206. }
  207. }
  208. </style>