news.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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" :backgroundColor="bgColor" 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. if (url.indexOf("http") != -1) {
  72. // #ifdef H5
  73. location.href = url
  74. // #endif
  75. // #ifdef MP || APP-PLUS
  76. uni.navigateTo({
  77. url: `/pages/annex/web_view/index?url=${url}`
  78. });
  79. // #endif
  80. } else {
  81. if (['/pages/goods_cate/goods_cate', '/pages/order_addcart/order_addcart', '/pages/user/index','/pages/store_cate/store_cate']
  82. .indexOf(url) == -1) {
  83. uni.navigateTo({
  84. url: url
  85. })
  86. } else {
  87. uni.reLaunch({
  88. url: url
  89. })
  90. }
  91. }
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss">
  97. .pageOn{
  98. border-radius: 12rpx!important;
  99. }
  100. .news {
  101. display: flex;
  102. align-items: center;
  103. flex-wrap: nowrap;
  104. height: 77rpx;
  105. border-top: 1rpx solid #f4f4f4;
  106. padding: 0 20rpx;
  107. box-shadow: 0 10rpx 30rpx #f5f5f5;
  108. }
  109. .news .pictrue {
  110. width: 130rpx;
  111. height: 36rpx;
  112. border-right: 1rpx solid #ddd;
  113. padding-right: 23rpx;
  114. box-sizing: content-box;
  115. }
  116. .news .pictrue image {
  117. width: 100%;
  118. height: 100%;
  119. }
  120. .news .swiperTxt {
  121. width: 536rpx;
  122. height: 100%;
  123. line-height: 77rpx;
  124. overflow: hidden;
  125. margin-left: 22rpx;
  126. }
  127. .news .swiperTxt .text {
  128. width: 89%;
  129. }
  130. .news .swiperTxt .text .label {
  131. font-size: 20rpx;
  132. color: #ff4c48;
  133. width: 64rpx;
  134. height: 30rpx;
  135. border-radius: 40rpx;
  136. text-align: center;
  137. line-height: 28rpx;
  138. border: 2rpx solid #ff4947;
  139. }
  140. .news .swiperTxt .text .newsTitle {
  141. width: 100%;
  142. font-size: 24rpx;
  143. color: #666;
  144. }
  145. .news .swiperTxt .iconfont {
  146. font-size: 28rpx;
  147. color: #888;
  148. }
  149. .news .swiperTxt swiper {
  150. height: 100%;
  151. }
  152. </style>