news.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view v-show="!isSortType">
  3. <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+';'">
  4. <!-- ../../../static/images/news.png -->
  5. <view class='pictrue skeleton-rect'>
  6. <image :src='logoConfig'></image>
  7. </view>
  8. <view class='swiperTxt skeleton-rect'>
  9. <swiper :indicator-dots="indicatorDots" :autoplay="autoplay" interval="2500" :duration="duration"
  10. vertical="true" circular="true">
  11. <block v-for="(item,index) in itemNew" :key='index'>
  12. <swiper-item catchtouchmove='catchTouchMove'>
  13. <view @click="jump(item.chiild[1].val)" class='acea-row row-between-wrapper'>
  14. <view class='text acea-row row-between-wrapper'>
  15. <view class='newsTitle line1'
  16. :style="'text-align:'+ (txtStyle==1?'center':txtStyle==2?'right':'left') +';color:'+txtColor+';'">
  17. {{item.chiild[0].val}}</view>
  18. </view>
  19. <view class='iconfont icon-xiangyou'></view>
  20. </view>
  21. </swiper-item>
  22. </block>
  23. </swiper>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. name: 'news',
  31. props: {
  32. dataConfig: {
  33. type: Object,
  34. default: () => {}
  35. },
  36. isSortType: {
  37. type: String | Number,
  38. default: 0
  39. }
  40. },
  41. data() {
  42. return {
  43. indicatorDots: false,
  44. autoplay: true,
  45. duration: 500,
  46. itemNew: this.dataConfig.listConfig.list,
  47. logoConfig: this.dataConfig.logoConfig.url,
  48. mbConfig: this.dataConfig.mbConfig.val,
  49. txtStyle: this.dataConfig.txtStyle.type,
  50. txtColor: this.dataConfig.txtColor.color[0].item,
  51. bgColor: this.dataConfig.bgColor.color[0].item,
  52. bgStyle: this.dataConfig.bgStyle.type,
  53. prConfig: this.dataConfig.prConfig.val
  54. };
  55. },
  56. created() {},
  57. mounted() {},
  58. methods: {
  59. jump(url){
  60. uni.navigateTo({
  61. url:url,
  62. fail:()=>{
  63. uni.switchTab({
  64. url:url
  65. })
  66. }
  67. })
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss">
  73. .pageOn{
  74. border-radius: 12rpx!important;
  75. }
  76. .news {
  77. display: flex;
  78. align-items: center;
  79. flex-wrap: nowrap;
  80. height: 77rpx;
  81. border-top: 1rpx solid #f4f4f4;
  82. padding: 0 20rpx;
  83. box-shadow: 0 10rpx 30rpx #f5f5f5;
  84. }
  85. .news .pictrue {
  86. width: 130rpx;
  87. height: 36rpx;
  88. border-right: 1rpx solid #ddd;
  89. padding-right: 23rpx;
  90. box-sizing: content-box;
  91. }
  92. .news .pictrue image {
  93. width: 100%;
  94. height: 100%;
  95. }
  96. .news .swiperTxt {
  97. width: 523rpx;
  98. height: 100%;
  99. line-height: 77rpx;
  100. overflow: hidden;
  101. margin-left: 22rpx;
  102. }
  103. .news .swiperTxt .text {
  104. width: 89%;
  105. }
  106. .news .swiperTxt .text .label {
  107. font-size: 20rpx;
  108. color: #ff4c48;
  109. width: 64rpx;
  110. height: 30rpx;
  111. border-radius: 40rpx;
  112. text-align: center;
  113. line-height: 28rpx;
  114. border: 2rpx solid #ff4947;
  115. }
  116. .news .swiperTxt .text .newsTitle {
  117. width: 100%;
  118. font-size: 24rpx;
  119. color: #666;
  120. }
  121. .news .swiperTxt .iconfont {
  122. font-size: 28rpx;
  123. color: #888;
  124. }
  125. .news .swiperTxt swiper {
  126. height: 100%;
  127. }
  128. </style>