news.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. mounted() {},
  69. methods: {
  70. moreTab(url){
  71. this.$util.JumpPath(url);
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss">
  77. .pageOn{
  78. border-radius: 12rpx!important;
  79. }
  80. .news {
  81. display: flex;
  82. align-items: center;
  83. flex-wrap: nowrap;
  84. height: 77rpx;
  85. border-top: 1rpx solid #f4f4f4;
  86. padding: 0 20rpx;
  87. box-shadow: 0 10rpx 30rpx #f5f5f5;
  88. }
  89. .news .pictrue {
  90. width: 130rpx;
  91. height: 36rpx;
  92. border-right: 1rpx solid #ddd;
  93. padding-right: 23rpx;
  94. box-sizing: content-box;
  95. }
  96. .news .pictrue image {
  97. width: 100%;
  98. height: 100%;
  99. }
  100. .news .swiperTxt {
  101. width: 536rpx;
  102. height: 100%;
  103. line-height: 77rpx;
  104. overflow: hidden;
  105. margin-left: 22rpx;
  106. }
  107. .news .swiperTxt .text {
  108. width: 89%;
  109. }
  110. .news .swiperTxt .text .label {
  111. font-size: 20rpx;
  112. color: #ff4c48;
  113. width: 64rpx;
  114. height: 30rpx;
  115. border-radius: 40rpx;
  116. text-align: center;
  117. line-height: 28rpx;
  118. border: 2rpx solid #ff4947;
  119. }
  120. .news .swiperTxt .text .newsTitle {
  121. width: 100%;
  122. font-size: 24rpx;
  123. color: #666;
  124. }
  125. .news .swiperTxt .iconfont {
  126. font-size: 28rpx;
  127. color: #888;
  128. }
  129. .news .swiperTxt swiper {
  130. height: 100%;
  131. }
  132. </style>