t-i-banner.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view>
  3. <view class="banner">
  4. <swiper class="box" autoplay circular @animationfinish="animationfinish">
  5. <swiper-item v-for="(item,index) in banner" :key="index" @click="go_link(item)">
  6. <view class="item">
  7. <view class="img">
  8. <image :src="item.imgURL" mode="aspectFill"></image>
  9. </view>
  10. <view class="title">
  11. <view class="text">{{item.title}}</view>
  12. <view class="num">
  13. <!-- — <text> {{index+1}} </text> — -->
  14. <text>{{index+1}} / {{banner.length}}</text>
  15. </view>
  16. </view>
  17. </view>
  18. </swiper-item>
  19. </swiper>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {goToLink} from "@/common/common.js"
  25. export default {
  26. name:"t-i-banner",
  27. props: [
  28. "banner",
  29. "mine_code"
  30. ],
  31. data() {
  32. return {
  33. }
  34. },
  35. methods:{
  36. go_link(item){
  37. if(this.mine_code != "zaoquan"){
  38. console.log(item.link)
  39. let item2 = {
  40. link:item.jumpURL
  41. }
  42. goToLink(item2,this.mine_code)
  43. }else{
  44. uni.navigateTo({
  45. url: "../../index/news/news_type/detail/detail?title=" + item.title,
  46. success: function(res) {
  47. res.eventChannel.emit('acceptDataFromOpenerPage', {
  48. data: item
  49. })
  50. }
  51. })
  52. }
  53. },
  54. animationfinish($event){
  55. this.$emit('change_top_bg_color_img',$event.detail.current)
  56. }
  57. }
  58. }
  59. </script>
  60. <style lang="scss">
  61. .banner{
  62. margin-top: -60rpx;
  63. .box{
  64. width: 750rpx;
  65. height: 430rpx;
  66. .item{
  67. width: 750rpx;
  68. position: relative;
  69. .img{
  70. margin: 0 auto;
  71. text-align: center;
  72. width: 700rpx;
  73. height: 400rpx;
  74. border-radius: 20rpx;
  75. overflow: hidden;
  76. image{
  77. margin-top: -20rpx;
  78. width: 700rpx;
  79. height: 440rpx;
  80. border-radius: 20rpx;
  81. }
  82. }
  83. .title{
  84. position: absolute;
  85. left: 0;
  86. bottom: 0;
  87. box-sizing: border-box;
  88. padding: 15rpx 50rpx;
  89. width: 750rpx;
  90. line-height: 1.5;
  91. font-size: 32rpx;
  92. display: flex;
  93. justify-content: space-between;
  94. .text{
  95. width: 520rpx;
  96. color: #FFFFFF;
  97. overflow: hidden;
  98. text-overflow: ellipsis;
  99. white-space: nowrap;
  100. }
  101. .num{
  102. color: #ACB0AC;
  103. text{
  104. // color: #23A2EE;
  105. color: #FFFFFF;
  106. }
  107. }
  108. }
  109. }
  110. }
  111. }
  112. </style>