banner.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <view class="banner">
  3. <view class="swiper-banner-msg">
  4. <view class="content">
  5. <view class="item le">
  6. <view class="item-icon">
  7. <text class="iconfont icon-zhengpin1"></text>
  8. </view>
  9. <view class="item-sm">
  10. <text>正品保证</text>
  11. </view>
  12. </view>
  13. <view class="item ce">
  14. <view class="item-icon">
  15. <text class="iconfont icon-jigou1"></text>
  16. </view>
  17. <view class="item-sm">
  18. <text>12000+机构</text>
  19. </view>
  20. </view>
  21. <view class="item ri">
  22. <view class="item-sm">
  23. <text>100+供应商</text>
  24. </view>
  25. <view class="item-icon">
  26. <text class="iconfont icon-gongyingshang1"></text>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="tui-rolling-view">
  32. <view class="tui-rolling-content">
  33. <view class="tui-rolling-news">
  34. <text class="tui-roll-label">公告:</text>
  35. <swiper vertical autoplay circular interval="3500" class="tui-swiper">
  36. <swiper-item v-for="(item, index) in list" :key="index" class="tui-swiper-item">
  37. <view class="tui-news-item" @tap="detail(item)">
  38. <text class="news-dot"></text> {{ item.title }}
  39. </view>
  40. </swiper-item>
  41. </swiper>
  42. <view class="tui-roll-more" @tap="newsList(item)">
  43. 更多<text class="iconfont icon-xiayibu"></text>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="swiper-banner-content">
  49. <view class="swiper-banner-box">
  50. <swiper
  51. class="tui-banner-swiper tui-banner tui-skeleton-fillet"
  52. :autoplay="true"
  53. :interval="5000"
  54. :duration="500"
  55. @change="swiperChange"
  56. :circular="true"
  57. >
  58. <swiper-item v-for="(item, index) in list" :key="index" @click.stop="NavToDetailPage(item)">
  59. <image :src="item.image" class="tui-slide-image" mode="scaleToFill" />
  60. </swiper-item>
  61. </swiper>
  62. <view class="swiper__dots-box" v-if="list.length > 1">
  63. <view
  64. v-for="(item, idx) in list"
  65. :key="idx"
  66. :class="[idx === current ? 'swiper__dots-long' : 'none']"
  67. :data-index="current"
  68. class="swiper__dots-item"
  69. >
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. import cmsMixins from '@/mixins/cmsMixins.js'
  78. export default {
  79. mixins: [cmsMixins],
  80. name: 'banner',
  81. props: {
  82. list: {
  83. type: Array
  84. },
  85. newsList: {
  86. type: Array
  87. }
  88. },
  89. data() {
  90. return {
  91. current: 0,
  92. StatusBar: this.StatusBar
  93. }
  94. },
  95. created() {},
  96. computed: {},
  97. methods: {
  98. detail(item){// 跳转公告详情
  99. this.$api.navigateTo(`/pages/service/news-detailes?id=${item.id}`)
  100. },
  101. newsList(){// 公告列表
  102. this.$api.navigateTo('/pages/service/news-list')
  103. },
  104. swiperChange(e) {
  105. //轮播图切换
  106. const index = e.detail.current
  107. this.current = index
  108. },
  109. NavToDetailPage(item) {
  110. //跳转
  111. this.cmsSysStatistics(1, item.id)
  112. this.$api.FlooryNavigateTo(item)
  113. }
  114. }
  115. }
  116. </script>
  117. <style lang="scss" scoped>
  118. .banner {
  119. margin-top: 50px;
  120. background: #f7f7f7;
  121. }
  122. .swiper-banner-content {
  123. width: 100%;
  124. height: auto;
  125. position: relative;
  126. background: linear-gradient(180deg, #FFFFFF 0%, rgba(255,255,255,0) 100%);
  127. }
  128. .swiper-banner-box {
  129. width: 100%;
  130. height: 360rpx;
  131. position: relative;
  132. background-size: cover;
  133. display: flex;
  134. opacity: 1;
  135. background: linear-gradient(180deg, #FFFFFF 0%, rgba(255,255,255,0) 100%);
  136. }
  137. .tui-banner-swiper {
  138. width: 700rpx;
  139. margin: 0 auto;
  140. height: 340rpx;
  141. border-radius: 16rpx;
  142. overflow: hidden;
  143. transform: translateY(0);
  144. background: linear-gradient(180deg, #FFFFFF 0%, rgba(255,255,255,0) 100%);
  145. .banner-item {
  146. border-radius: 16rpx;
  147. }
  148. .tui-slide-image {
  149. width: 100%;
  150. height: 340rpx;
  151. display: block;
  152. }
  153. }
  154. .swiper__dots-box {
  155. position: absolute;
  156. bottom: 30rpx;
  157. left: 0;
  158. right: 0;
  159. /* #ifndef APP-NVUE */
  160. display: flex;
  161. /* #endif */
  162. flex: 1;
  163. flex-direction: row;
  164. justify-content: center;
  165. align-items: center;
  166. .swiper__dots-item {
  167. width: 8rpx;
  168. height: 8rpx;
  169. border-radius: 100%;
  170. margin-left: 6px;
  171. background-color: rgba(255, 255, 255, 0.7);
  172. }
  173. .swiper__dots-long {
  174. width: 35rpx;
  175. height: 8rpx;
  176. border-radius: 4rpx;
  177. background-color: #ffff;
  178. transition: all 0.4s;
  179. }
  180. }
  181. .swiper-banner-msg {
  182. width: 100%;
  183. height: 48rpx;
  184. box-sizing: border-box;
  185. background-color: #ff5b00;
  186. padding: 0 24rpx;
  187. .content {
  188. width: 100%;
  189. height: 48rpx;
  190. box-sizing: border-box;
  191. padding: 0 24rpx;
  192. border-radius: 16rpx;
  193. .item {
  194. width: 30%;
  195. height: 48rpx;
  196. float: left;
  197. .item-icon{
  198. height: 48rpx;
  199. line-height: 48rpx;
  200. float: left;
  201. margin-right: 2px;
  202. .iconfont {
  203. color: #ffffff;
  204. font-size: $font-size-28;
  205. }
  206. }
  207. .item-sm{
  208. line-height: 48rpx;
  209. font-size: $font-size-22;
  210. color: #ffffff;
  211. float: left;
  212. }
  213. &.le {
  214. width: 37%;
  215. text-align: left;
  216. }
  217. &.ce {
  218. width: 25%;
  219. text-align: center;
  220. }
  221. &.ri {
  222. width: 37%;
  223. .item-icon{
  224. float: right;
  225. }
  226. .item-sm{
  227. float: right;
  228. }
  229. }
  230. }
  231. }
  232. }
  233. .tui-rolling-view {
  234. width: 100%;
  235. height: 96rpx;
  236. background-color: #FF5B00;
  237. }
  238. .tui-rolling-content{
  239. width: 100%;
  240. height: 100%;
  241. box-sizing: border-box;
  242. padding: 20rpx 24rpx;
  243. border-radius: 24rpx 24rpx 0 0;
  244. background-color: #FFFFFF;
  245. }
  246. .tui-rolling-news {
  247. width: 100%;
  248. padding: 0 20rpx;
  249. border-radius: 8rpx;
  250. box-sizing: border-box;
  251. display: flex;
  252. align-items: center;
  253. justify-content: center;
  254. flex-wrap: nowrap;
  255. line-height: 56rpx;
  256. background: #fff7f3;
  257. background-size: cover;
  258. .tui-roll-label {
  259. font-weight: bold;
  260. font-size: $font-size-26;
  261. color: #ff5b00;
  262. }
  263. .tui-roll-more {
  264. font-size: $font-size-24;
  265. color: #999999;
  266. .icon-xiayibu {
  267. font-size: $font-size-22;
  268. }
  269. }
  270. }
  271. .tui-swiper {
  272. font-size: 28rpx;
  273. height: 50rpx;
  274. flex: 1;
  275. }
  276. .tui-swiper-item {
  277. display: flex;
  278. align-items: center;
  279. }
  280. .tui-news-item {
  281. width: 480rpx;
  282. line-height: 28rpx;
  283. white-space: nowrap;
  284. overflow: hidden;
  285. text-overflow: ellipsis;
  286. font-size: $font-size-24;
  287. color: #666666;
  288. .news-dot {
  289. display: inline-block;
  290. width: 10rpx;
  291. height: 10rpx;
  292. background-color: #999999;
  293. border-radius: 50%;
  294. margin-right: 8rpx;
  295. float: left;
  296. margin-top: 10rpx;
  297. }
  298. }
  299. </style>