news.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <view class="new" :style="colorStyle">
  3. <view class="news default" v-if="isIframe && !itemNew.length">{{$t(`暂无新闻,请上传新闻`)}}</view>
  4. <view class='news acea-row row-between-wrapper skeleton-rect' v-if="isShow && itemNew.length">
  5. <view class='pictrue'>
  6. <image :src='img'></image>
  7. </view>
  8. <view class='swiperTxt'>
  9. <swiper :indicator-dots="indicatorDots" :autoplay="autoplay" interval="2500" :duration="duration"
  10. vertical="true" circular="true" disable-touch="true">
  11. <block v-for="(item,index) in itemNew" :key='index'>
  12. <swiper-item catchtouchmove='catchTouchMove'>
  13. <view class='acea-row row-between-wrapper' hover-class='none'
  14. @click="gopage(item.chiild[1].val)">
  15. <view class='text acea-row row-between-wrapper'>
  16. <view class='newsTitle line1'>{{item.chiild[0].val}}</view>
  17. </view>
  18. <view class='iconfont icon-xiangyou'></view>
  19. </view>
  20. </swiper-item>
  21. </block>
  22. </swiper>
  23. </view>
  24. </view>
  25. <view class='news acea-row row-between-wrapper' v-if="!isShow && isIframe && itemNew.length">
  26. <view class='pictrue'>
  27. <image :src='img'></image>
  28. </view>
  29. <view class='swiperTxt'>
  30. <swiper :indicator-dots="indicatorDots" :autoplay="autoplay" interval="2500" :duration="duration"
  31. vertical="true" circular="true">
  32. <block v-for="(item,index) in itemNew" :key='index'>
  33. <swiper-item catchtouchmove='catchTouchMove'>
  34. <view class='acea-row row-between-wrapper' hover-class='none'
  35. @click="gopage(item.chiild[1].val)">
  36. <view class='text acea-row row-between-wrapper'>
  37. <view class='newsTitle line1'>{{item.chiild[0].val}}</view>
  38. </view>
  39. <view class='iconfont icon-xiangyou'></view>
  40. </view>
  41. </swiper-item>
  42. </block>
  43. </swiper>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. let app = getApp()
  50. import colors from '@/mixins/color.js';
  51. import {
  52. goPage
  53. } from '@/libs/order.js'
  54. export default {
  55. name: 'news',
  56. props: {
  57. dataConfig: {
  58. type: Object,
  59. default: () => {}
  60. },
  61. },
  62. mixins: [colors],
  63. watch: {
  64. dataConfig: {
  65. immediate: true,
  66. handler(nVal, oVal) {
  67. if (nVal) {
  68. this.img = nVal.imgUrl.url;
  69. this.itemNew = nVal.newList.list;
  70. this.isShow = nVal.isShow.val;
  71. }
  72. }
  73. }
  74. },
  75. data() {
  76. return {
  77. indicatorDots: false,
  78. autoplay: true,
  79. duration: 500,
  80. img: '',
  81. itemNew: [],
  82. name: this.$options.name,
  83. isIframe: false,
  84. isShow: true
  85. };
  86. },
  87. created() {
  88. this.isIframe = app.globalData.isIframe;
  89. },
  90. mounted() {},
  91. methods: {
  92. gopage(url) {
  93. goPage().then(res => {
  94. this.$util.JumpPath(url);
  95. })
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss">
  101. .new {
  102. background-color: #fff;
  103. padding: 20rpx 0;
  104. }
  105. .news {
  106. height: 60rpx;
  107. padding: 0 26rpx;
  108. // box-shadow: 0 10rpx 30rpx #f5f5f5;
  109. background-color: var(--view-op-point-four);
  110. margin: 0 $uni-index-margin-col;
  111. border-radius: 60rpx;
  112. // box-shadow: $uni-index-box-shadow;
  113. &.default {
  114. text-align: center;
  115. line-height: 77rpx;
  116. }
  117. }
  118. .news .pictrue {
  119. width: 116rpx;
  120. height: 28rpx;
  121. line-height: 28rpx;
  122. border-right: 1rpx solid #ddd;
  123. padding-right: 23rpx;
  124. box-sizing: content-box;
  125. }
  126. .news .pictrue image {
  127. width: 100%;
  128. height: 100%;
  129. }
  130. .news .swiperTxt {
  131. width: 470rpx;
  132. height: 100%;
  133. line-height: 60rpx;
  134. overflow: hidden;
  135. }
  136. .news .swiperTxt .text {
  137. line-height: 28rpx;
  138. margin-bottom: 4rpx;
  139. }
  140. .news .swiperTxt .text .label {
  141. font-size: 20rpx;
  142. color: #ff4c48;
  143. width: 64rpx;
  144. height: 30rpx;
  145. border-radius: 40rpx;
  146. text-align: center;
  147. line-height: 28rpx;
  148. border: 2rpx solid #ff4947;
  149. }
  150. .news .swiperTxt .text .newsTitle {
  151. width: 400rpx;
  152. font-size: 24rpx;
  153. line-height: 28rpx;
  154. color: #666;
  155. }
  156. .news .swiperTxt .iconfont {
  157. font-size: 28rpx;
  158. color: #888;
  159. }
  160. .news .swiperTxt swiper {
  161. height: 100%;
  162. }
  163. </style>