my-popup.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <template>
  2. <uni-popup ref="popup" :mask-click="false" maskBackgroundColor="rgba(0, 0, 0, 0.6)">
  3. <view class="popup">
  4. <swiper ref="swiper" class="swiper" :current="swiperCurrent" @change="swiperChange" :indicator-dots="true"
  5. indicator-active-color="rgba(46, 133, 236, 1)" :autoplay="false" :interval="5000">
  6. <swiper-item v-for="(item, index) in dataList">
  7. <view class="swiper-item-view uni-column" v-if="item.type == 1">
  8. <text class="swiper-item-title">{{item.data.title}}</text>
  9. <image mode="aspectFit" class="swiper-item-image" :src="item.data.img"></image>
  10. <view class="swiper-item-time uni-row">
  11. <image mode="aspectFit" class="clock" src="/static/default/clock.png"></image>
  12. <text class="acttime">{{acttime}}</text>
  13. </view>
  14. <view class="swiper-item-content uni-column">
  15. <text
  16. class="introduce-content">{{item.data.content}}</text>
  17. </view>
  18. <button v-if="index < dataList.length - 1" class="swiper-item-button" @click="swiperNext">继续</button>
  19. <button v-else class="swiper-item-button" @click="popupClose">确定</button>
  20. </view>
  21. <view class="swiper-item-view uni-column" v-if="item.type == 2">
  22. <text class="swiper-item-title">{{item.data.title}}</text>
  23. <image mode="aspectFit" style="height: 474rpx; margin-bottom: 50rpx;" :src="item.data.img"></image>
  24. <button v-if="index < dataList.length - 1" class="swiper-item-button" @click="swiperNext">继续</button>
  25. <button v-else class="swiper-item-button" @click="popupClose">确定</button>
  26. </view>
  27. </swiper-item>
  28. </swiper>
  29. </view>
  30. </uni-popup>
  31. </template>
  32. <script>
  33. // import tools from '/common/tools';
  34. // import {
  35. // teamName
  36. // } from '/common/define';
  37. export default {
  38. name: "my-popup",
  39. props: {
  40. dataList: [{}],
  41. acttime: "", // 活动时间
  42. teamType: {
  43. type: Number,
  44. default: -1
  45. }
  46. },
  47. data() {
  48. return {
  49. swiperCurrent: 0, // swiper当前所在滑块的 index
  50. // item: {}
  51. };
  52. },
  53. methods: {
  54. //当前轮播索引
  55. swiperChange(e) {
  56. const curIndex = e.detail.current;
  57. // console.log("swiperChange", curIndex, this.swiperCurrent)
  58. this.swiperCurrent = curIndex;
  59. },
  60. swiperNext() {
  61. this.swiperCurrent++;
  62. },
  63. popupOpen() {
  64. if (this.dataList.length == 0) {
  65. console.log("[popupOpen] dataList为空,禁止弹窗");
  66. return;
  67. }
  68. this.swiperCurrent = 0;
  69. this.$refs.popup.open()
  70. },
  71. popupClose() {
  72. this.$refs.popup.close()
  73. },
  74. // getTeamName(teamType, teamIndex) {
  75. // return teamName[teamType][teamIndex];
  76. // },
  77. // onItemClick(item) {
  78. // this.data.item = item
  79. // this.$emit('my-combo-list-click', this.data);
  80. // }
  81. }
  82. }
  83. </script>
  84. <style lang="scss" scoped>
  85. .acttime {
  86. font-weight: 550;
  87. color: #333333;
  88. font-size: 30rpx;
  89. }
  90. .clock {
  91. width: 30rpx;
  92. height: 30rpx;
  93. margin-right: 20rpx;
  94. }
  95. .introduce-content {
  96. color: #333333;
  97. font-size: 25rpx;
  98. line-height: 36rpx;
  99. }
  100. .popup {
  101. width: 90vw;
  102. height: 920rpx;
  103. background-color: #FEFBF6;
  104. border-radius: 50rpx;
  105. }
  106. .swiper {
  107. height: 100%;
  108. }
  109. // .swiper-item {
  110. // justify-content: space-between;
  111. // /* background-color: lightblue; */
  112. // }
  113. .swiper-item-view {
  114. height: 100%;
  115. justify-content: space-between;
  116. }
  117. .swiper-item-title {
  118. margin-top: 60rpx;
  119. margin-bottom: 20rpx;
  120. font-size: 40rpx;
  121. font-weight: 550;
  122. }
  123. .swiper-item-image {
  124. height: 300rpx;
  125. }
  126. .swiper-item-time {
  127. height: 65rpx;
  128. margin-top: 20rpx;
  129. padding: 0 50rpx;
  130. justify-content: space-evenly;
  131. background-color: white;
  132. border: 0.5px solid;
  133. border-color: #e7e7e7;
  134. border-radius: 40rpx;
  135. box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.13);
  136. }
  137. .swiper-item-content {
  138. width: 80%;
  139. /* height: 100rpx; */
  140. margin-top: 30rpx;
  141. margin-bottom: 80rpx;
  142. justify-content: start;
  143. }
  144. .swiper-item-button {
  145. width: 80%;
  146. height: 106rpx;
  147. margin-bottom: 60rpx;
  148. color: #ffffff;
  149. /* font-weight: bold; */
  150. line-height: 106rpx;
  151. background-color: #2e85ec;
  152. border-radius: 27px;
  153. }
  154. ::v-deep .uni-swiper-dots-horizontal {
  155. bottom: 200rpx;
  156. }
  157. </style>