news.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <!-- 新闻播报 -->
  3. <view v-show="!isSortType">
  4. <view class='news acea-row row-middle' :class="{pageOn:bgStyle===1}" v-if="itemNew.length" :style="'margin:0 '+prConfig*2+'rpx;margin-top:'+mbConfig*2+'rpx;color:'+txtColor+';background-color:'+bgColor+';'">
  5. <!-- ../../../static/images/news.png -->
  6. <view class='pictrue skeleton-rect'>
  7. <image :src='logoConfig'></image>
  8. </view>
  9. <view class='swiperTxt skeleton-rect'>
  10. <view class="acea-row row-between-wrapper" v-if="direction" @click="moreTab(itemNew[0].chiild[1].val)">
  11. <uniNoticeBar scrollable="true" showGetMore="true" :prConfig="prConfig" background-color="#fff" color="#333" 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'
  22. :style="'text-align:'+ (txtStyle==1?'center':txtStyle==2?'right':'left') +';color:'+txtColor+';'">
  23. {{item.chiild[0].val}}</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. import uniNoticeBar from '@/components/uniNoticeBar/uni-notice-bar.vue';
  36. export default {
  37. components:{
  38. uniNoticeBar
  39. },
  40. name: 'news',
  41. props: {
  42. dataConfig: {
  43. type: Object,
  44. default: () => {}
  45. },
  46. isSortType: {
  47. type: String | Number,
  48. default: 0
  49. }
  50. },
  51. data() {
  52. return {
  53. indicatorDots: false,
  54. autoplay: true,
  55. duration: 500,
  56. itemNew: this.dataConfig.listConfig.list,
  57. logoConfig: this.dataConfig.logoConfig.url,
  58. mbConfig: this.dataConfig.mbConfig.val,
  59. txtStyle: this.dataConfig.txtStyle.type,
  60. txtColor: this.dataConfig.txtColor.color[0].item,
  61. bgColor: this.dataConfig.bgColor.color[0].item,
  62. bgStyle: this.dataConfig.bgStyle.type,
  63. prConfig: this.dataConfig.prConfig.val,
  64. direction:this.dataConfig.direction?this.dataConfig.direction.type:0
  65. };
  66. },
  67. created() {
  68. },
  69. mounted() {
  70. this.$emit('onNews',this.itemNew);
  71. },
  72. watch: {
  73. itemNew(newValue, oldValue) {
  74. this.$emit('onNews',newValue)
  75. }
  76. },
  77. methods: {
  78. moreTab(url){
  79. this.$util.JumpPath(url);
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss">
  85. .pageOn{
  86. border-radius: 12rpx!important;
  87. }
  88. .news {
  89. display: flex;
  90. align-items: center;
  91. flex-wrap: nowrap;
  92. height: 77rpx;
  93. border-top: 1rpx solid #f4f4f4;
  94. padding: 0 20rpx;
  95. box-shadow: 0 10rpx 30rpx #f5f5f5;
  96. }
  97. .news .pictrue {
  98. width: 130rpx;
  99. height: 36rpx;
  100. border-right: 1rpx solid #ddd;
  101. padding-right: 23rpx;
  102. box-sizing: content-box;
  103. }
  104. .news .pictrue image {
  105. width: 100%;
  106. height: 100%;
  107. }
  108. .news .swiperTxt {
  109. width: 536rpx;
  110. height: 100%;
  111. line-height: 77rpx;
  112. overflow: hidden;
  113. margin-left: 22rpx;
  114. }
  115. .news .swiperTxt .text {
  116. width: 89%;
  117. }
  118. .news .swiperTxt .text .label {
  119. font-size: 20rpx;
  120. color: #ff4c48;
  121. width: 64rpx;
  122. height: 30rpx;
  123. border-radius: 40rpx;
  124. text-align: center;
  125. line-height: 28rpx;
  126. border: 2rpx solid #ff4947;
  127. }
  128. .news .swiperTxt .text .newsTitle {
  129. width: 100%;
  130. font-size: 24rpx;
  131. color: #666;
  132. }
  133. .news .swiperTxt .iconfont {
  134. font-size: 28rpx;
  135. color: #888;
  136. }
  137. .news .swiperTxt swiper {
  138. height: 100%;
  139. }
  140. </style>