news.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <!-- 新闻播报 -->
  3. <view>
  4. <view v-if="itemNew.length" class='news acea-row row-middle' :style="[boxStyle]">
  5. <view class='pictrue skeleton-rect'>
  6. <image :src='logoConfig'></image>
  7. </view>
  8. <view class='swiperTxt skeleton-rect'>
  9. <view class="acea-row row-between-wrapper" v-if="direction" @click="moreTab(itemNew[0].chiild[1].val)">
  10. <uniNoticeBar scrollable="true" showGetMore="true" background-color="#fff" :color="textColor"
  11. moreColor="#888" :speed='50' single="true" :text="itemNew[0].chiild[0].val"></uniNoticeBar>
  12. <view class="iconfont icon-xiangyou"></view>
  13. </view>
  14. <swiper v-else :indicator-dots="indicatorDots" :autoplay="autoplay" interval="2500" :duration="duration"
  15. vertical="true" circular="true">
  16. <block v-for="(item,index) in itemNew" :key='index'>
  17. <swiper-item catchtouchmove='catchTouchMove'>
  18. <view @click="moreTab(item.chiild[1].val)" class='acea-row row-between-wrapper'
  19. hover-class='none'>
  20. <view class='text acea-row row-between-wrapper'>
  21. <view class='newsTitle line1' :style="{color:textColor}">
  22. {{item.chiild[0].val}}
  23. </view>
  24. </view>
  25. <view class='iconfont icon-xiangyou'></view>
  26. </view>
  27. </swiper-item>
  28. </block>
  29. </swiper>
  30. </view>
  31. </view>
  32. </view>
  33. </template>
  34. <script>
  35. // +----------------------------------------------------------------------
  36. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  37. // +----------------------------------------------------------------------
  38. // | Copyright (c) 2016~2025 https://www.crmeb.com All rights reserved.
  39. // +----------------------------------------------------------------------
  40. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  41. // +----------------------------------------------------------------------
  42. // | Author: CRMEB Team <admin@crmeb.com>
  43. // +----------------------------------------------------------------------
  44. import uniNoticeBar from '@/components/uniNoticeBar/uni-notice-bar.vue';
  45. export default {
  46. components: {
  47. uniNoticeBar
  48. },
  49. name: 'news',
  50. props: {
  51. dataConfig: {
  52. type: Object,
  53. default: () => {}
  54. },
  55. isSortType: {
  56. type: String | Number,
  57. default: 0
  58. }
  59. },
  60. data() {
  61. return {
  62. indicatorDots: false,
  63. autoplay: true,
  64. duration: 500,
  65. };
  66. },
  67. computed: {
  68. //文本列表
  69. itemNew() {
  70. return this.dataConfig.listConfig.list
  71. },
  72. //图标设置
  73. logoConfig() {
  74. return this.dataConfig.logoConfig.url
  75. },
  76. //文本滚动方向
  77. direction() {
  78. return this.dataConfig.directionConfig.tabVal
  79. },
  80. //最外层盒子的样式
  81. boxStyle() {
  82. return {
  83. borderRadius: this.dataConfig.bgStyle.val * 2 + 'rpx',
  84. background: `linear-gradient(${this.dataConfig.bgColor.color[0].item}, ${this.dataConfig.bgColor.color[1].item})`,
  85. margin: this.dataConfig.mbConfig.val * 2 + 'rpx' + ' ' + this.dataConfig.lrConfig.val * 2 + 'rpx' +
  86. ' ' + 0,
  87. padding: this.dataConfig.upConfig.val * 2 + 'rpx' + ' ' + '20rpx' + ' ' + this.dataConfig.downConfig
  88. .val * 2 + 'rpx',
  89. color: this.dataConfig.textColor.color[0].item
  90. }
  91. },
  92. //文字位置
  93. txtStyle() {
  94. let txtStyle = this.dataConfig.textPosition.tabVal;
  95. if (txtStyle == 0) {
  96. return {
  97. 'text-align': 'left'
  98. }
  99. } else if (txtStyle == 1) {
  100. return {
  101. 'text-align': 'center'
  102. }
  103. } else {
  104. return {
  105. 'text-align': 'right'
  106. }
  107. }
  108. },
  109. //文字颜色
  110. textColor() {
  111. return this.dataConfig.textColor.color[0].item
  112. },
  113. },
  114. methods: {
  115. moreTab(url) {
  116. this.$util.navigateTo(url);
  117. }
  118. }
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .news {
  123. display: flex;
  124. align-items: center;
  125. flex-wrap: nowrap;
  126. box-shadow: 0 10rpx 30rpx #f5f5f5;
  127. }
  128. .news .pictrue {
  129. width: 130rpx;
  130. height: 36rpx;
  131. border-right: 1rpx solid #ddd;
  132. padding-right: 23rpx;
  133. box-sizing: content-box;
  134. }
  135. .news .pictrue image {
  136. width: 100%;
  137. height: 100%;
  138. }
  139. .news .swiperTxt {
  140. width: 536rpx;
  141. height: 78rpx;
  142. line-height: 78rpx;
  143. overflow: hidden;
  144. margin-left: 22rpx;
  145. }
  146. .news .swiperTxt .text {
  147. width: 89%;
  148. }
  149. .news .swiperTxt .text .label {
  150. font-size: 20rpx;
  151. color: #ff4c48;
  152. width: 64rpx;
  153. height: 30rpx;
  154. border-radius: 40rpx;
  155. text-align: center;
  156. line-height: 28rpx;
  157. border: 2rpx solid #ff4947;
  158. }
  159. .news .swiperTxt .text .newsTitle {
  160. width: 100%;
  161. font-size: 24rpx;
  162. color: #666;
  163. }
  164. .news .swiperTxt .iconfont {
  165. font-size: 28rpx;
  166. color: #888;
  167. }
  168. .news .swiperTxt swiper {
  169. height: 100%;
  170. }
  171. </style>