my-popup.vue 6.6 KB

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