my-popup.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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 v-if="item.type == 1" class="swiper-item-view uni-column">
  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 v-if="item.type == 2" class="swiper-item-view uni-column">
  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 v-if="item.type == 3" class="swiper-item-view swiper-item-view-bg uni-column">
  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 v-if="item.type == 4" class="swiper-item-view swiper-item-view-bg2 uni-jct uni-column">
  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. <!-- 标题 + 图片(点击图片打开地图APP进行地点定位) -->
  61. <view v-if="item.type == 5" class="swiper-item-view uni-column">
  62. <text class="swiper-item-title">{{item.data.title}}</text>
  63. <image mode="aspectFit" style="height: 474rpx; margin-bottom: 50rpx;" :src="item.data.img" @click="dealNavClick(item.data.point)">
  64. </image>
  65. <button v-if="index < dataList.length - 1" class="swiper-item-button" @click="swiperNext">继
  66. 续</button>
  67. <button v-else class="swiper-item-button" @click="popupClose">确 定</button>
  68. </view>
  69. </swiper-item>
  70. </swiper>
  71. </view>
  72. </uni-popup>
  73. </template>
  74. <script>
  75. // import tools from '/common/tools';
  76. // import {
  77. // teamName
  78. // } from '/common/define';
  79. export default {
  80. name: "my-popup",
  81. props: {
  82. dataList: [{}],
  83. acttime: "", // 活动时间
  84. teamType: {
  85. type: Number,
  86. default: -1
  87. }
  88. },
  89. data() {
  90. return {
  91. swiperCurrent: 0, // swiper当前所在滑块的 index
  92. isOpen: false,
  93. // item: {}
  94. };
  95. },
  96. methods: {
  97. //当前轮播索引
  98. swiperChange(e) {
  99. const curIndex = e.detail.current;
  100. // console.log("swiperChange", curIndex, this.swiperCurrent)
  101. this.swiperCurrent = curIndex;
  102. },
  103. swiperNext() {
  104. this.swiperCurrent++;
  105. },
  106. popupOpen() {
  107. if (this.dataList.length == 0) {
  108. console.log("[popupOpen] dataList为空,禁止弹窗");
  109. return;
  110. }
  111. this.swiperCurrent = 0;
  112. this.$refs.popup.open()
  113. this.isOpen = true;
  114. },
  115. popupClose() {
  116. this.$refs.popup.close()
  117. this.isOpen = false;
  118. this.$emit('popup-close');
  119. },
  120. dealNavClick(navPoint) {
  121. const url =
  122. `action://to_map_app?title=${navPoint.name}&latitude=${navPoint.latitude}&longitude=${navPoint.longitude}`;
  123. window.location.href = url;
  124. // tools.appAction(url);
  125. }
  126. // getTeamName(teamType, teamIndex) {
  127. // return teamName[teamType][teamIndex];
  128. // },
  129. // onItemClick(item) {
  130. // this.data.item = item
  131. // this.$emit('my-combo-list-click', this.data);
  132. // }
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .acttime {
  138. font-weight: 550;
  139. color: #333333;
  140. font-size: 30rpx;
  141. }
  142. .clock {
  143. width: 30rpx;
  144. height: 30rpx;
  145. margin-right: 20rpx;
  146. }
  147. .introduce-content {
  148. color: #333333;
  149. font-size: 25rpx;
  150. line-height: 36rpx;
  151. }
  152. .popup {
  153. width: 90vw;
  154. height: 920rpx;
  155. background-color: #FEFBF6;
  156. border-radius: 50rpx;
  157. }
  158. .swiper {
  159. height: 100%;
  160. }
  161. // .swiper-item {
  162. // justify-content: space-between;
  163. // /* background-color: lightblue; */
  164. // }
  165. .swiper-item-view {
  166. height: 100%;
  167. justify-content: space-between;
  168. }
  169. .swiper-item-view-bg {
  170. background-image: url("/static/backgroud/top_colorbar.png"), url("/static/backgroud/oval.png");
  171. background-repeat: no-repeat;
  172. background-position-x: center;
  173. background-position-y: 150rpx, 380rpx;
  174. background-size: 80%, 70%;
  175. }
  176. .swiper-item-view-bg2 {
  177. background-image: url("/static/backgroud/oval.png");
  178. background-repeat: no-repeat;
  179. background-position-x: center;
  180. background-position-y: 316rpx;
  181. background-size: 70%;
  182. }
  183. .swiper-item-title {
  184. margin-top: 60rpx;
  185. margin-bottom: 20rpx;
  186. font-size: 40rpx;
  187. font-weight: 550;
  188. }
  189. .swiper-item-image {
  190. height: 300rpx;
  191. }
  192. .swiper-item-time {
  193. height: 65rpx;
  194. margin-top: 20rpx;
  195. padding: 0 50rpx;
  196. justify-content: space-evenly;
  197. background-color: white;
  198. border: 0.5px solid;
  199. border-color: #e7e7e7;
  200. border-radius: 40rpx;
  201. box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.13);
  202. }
  203. .swiper-item-content {
  204. width: 80%;
  205. /* height: 100rpx; */
  206. margin-top: 30rpx;
  207. margin-bottom: 80rpx;
  208. justify-content: start;
  209. }
  210. .swiper-item-content2 {
  211. width: 80%;
  212. /* height: 100rpx; */
  213. margin-top: 30rpx;
  214. margin-bottom: 20rpx;
  215. // justify-content: center;
  216. text-align: center;
  217. font-size: 28rpx;
  218. line-height: 80rpx;
  219. }
  220. .swiper-item-content3 {
  221. width: 80%;
  222. margin-top: 10rpx;
  223. text-align: center;
  224. }
  225. .swiper-item-button {
  226. width: 80%;
  227. height: 106rpx;
  228. margin-bottom: 60rpx;
  229. color: #ffffff;
  230. /* font-weight: bold; */
  231. line-height: 106rpx;
  232. background-color: #2e85ec;
  233. border-radius: 27px;
  234. }
  235. ::v-deep .uni-swiper-dots-horizontal {
  236. bottom: 200rpx;
  237. }
  238. // ::v-deep .uni-swiper-dot-active {
  239. // background: #ff870e !important;
  240. // }
  241. </style>