my-popup.vue 5.1 KB

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