WinningPopup.vue 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <div v-if="showSelf" class="dialog">
  3. <div class="dialog-mark" @click.self="closeMyself">
  4. <div class="sharetiptxt" style>
  5. <img style=" height:100%;" src="../assets/buttonImg/shareText.png" alt />
  6. </div>
  7. <transition name="dialog">
  8. <div class="dialog-sprite">
  9. <div class="dialog-body">
  10. <div class="card-wrapper">
  11. <div :class="`dialog-popuImag ${classDivAA?'flipped':''}`">
  12. <!-- <div class="back" :style="`background-image: url(${backimg});`"> -->
  13. <!-- <img
  14. style="width: 48vw; height:492px"
  15. src="../assets/prizeImg/HappyWnning.jpg"
  16. alt
  17. />-->
  18. <!-- </div> -->
  19. <div class="front">
  20. <img
  21. style="width: 48vw; height:492px "
  22. src="../assets/prizeImg/HappyWnning.jpg"
  23. alt
  24. />
  25. <div class="PrizeImg">
  26. <img style="width: 100%; height:100% " :src="Prize.thumb" alt />
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. <div @click="cancel" class="dialog-footer">
  32. <img @click="cancel" class="btn" src="../assets/buttonImg/happyAccept.png" alt />
  33. </div>
  34. </div>
  35. <!-- 右侧 -->
  36. </div>
  37. </transition>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. export default {
  43. name: 'WinningPopup',
  44. props: {
  45. show: {
  46. type: Boolean,
  47. default: false,
  48. required: true
  49. },
  50. currentMonth: {
  51. type: Object
  52. },
  53. Prize: {
  54. type: Object,
  55. default: () => ({})
  56. }
  57. },
  58. data() {
  59. return {
  60. name: 'dialog',
  61. showSelf: false,
  62. zIndex: this.getZIndex(),
  63. bodyOverflow: '',
  64. classDivAA: false,
  65. myShareShow: false,
  66. backimg: require('../assets/luckyImg/2.jpg')
  67. }
  68. },
  69. watch: {
  70. show(val) {
  71. this.showSelf = val
  72. if (this.show === false) {
  73. this.myShareShow = false
  74. }
  75. this.transform()
  76. }
  77. },
  78. created() {
  79. this.showSelf = this.show
  80. },
  81. mounted() {
  82. this.forbidScroll()
  83. if (this.show === true) {
  84. this.transform()
  85. }
  86. },
  87. methods: {
  88. transform() {
  89. setTimeout(() => {
  90. this.classDivAA = this.show
  91. }, 0)
  92. },
  93. /** 禁止页面滚动 */
  94. forbidScroll() {
  95. this.bodyOverflow = document.body.style.overflow
  96. document.body.style.overflow = 'hidden'
  97. },
  98. /** 每次获取之后 zindex 自动增加 */
  99. getZIndex() {
  100. let zIndexInit = 2022112
  101. return zIndexInit++
  102. },
  103. /** 取消按钮操作 */
  104. cancel() {
  105. this.$emit('cancel', true)
  106. },
  107. /** 确认按钮操作 */
  108. confirm() {
  109. this.$emit('confirm', true)
  110. },
  111. /** 点击遮罩关闭弹窗 */
  112. closeMyself(event) {
  113. // this.sloveBodyOverflow()
  114. },
  115. /** 恢复页面的滚动 */
  116. sloveBodyOverflow() {
  117. document.body.style.overflow = this.bodyOverflow
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="less" scoped>
  123. // 弹窗动画
  124. // 最外层 设置position定位
  125. // 遮罩 设置背景层,z-index值要足够大确保能覆盖,高度 宽度设置满 做到全屏遮罩
  126. .dialog {
  127. position: fixed;
  128. top: 0;
  129. right: 0;
  130. width: 100%;
  131. height: 100%;
  132. transition: opacity 1s;
  133. // 内容层 z-index要比遮罩大,否则会被遮盖
  134. .dialog-mark {
  135. position: relative;
  136. top: 0;
  137. height: 0;
  138. width: 100%;
  139. height: 100%;
  140. background: rgba(0, 0, 0, 0.6);
  141. left: 0;
  142. top: 0;
  143. z-index: 99;
  144. display: flex;
  145. align-items: center;
  146. justify-content: center;
  147. .sharetiptxt {
  148. background-size: 100% auto;
  149. background-repeat: no-repeat;
  150. z-index: 55;
  151. width: 20px;
  152. height: 320px;
  153. display: block;
  154. position: absolute;
  155. right: 1rem;
  156. top: 0.5em;
  157. animation: tipup 1s ease infinite;
  158. }
  159. }
  160. }
  161. @keyframes tipup {
  162. 0% {
  163. transform: translateY(0%);
  164. }
  165. 50% {
  166. transform: translateY(5%);
  167. }
  168. 100% {
  169. transform: translateY(0%);
  170. }
  171. }
  172. .dialog-sprite {
  173. width: 100vw;
  174. display: flex;
  175. justify-content: center;
  176. position: relative;
  177. .header {
  178. padding: 15px;
  179. text-align: center;
  180. font-size: 18px;
  181. font-weight: 700;
  182. color: #333;
  183. }
  184. .dialog-body {
  185. flex: 1;
  186. overflow-x: hidden;
  187. overflow-y: scroll;
  188. padding: 0 15px 20px 15px;
  189. //中间卡片
  190. .card-wrapper {
  191. perspective: 600px;
  192. margin-top: 2em;
  193. .dialog-popuImag {
  194. position: relative;
  195. display: flex;
  196. justify-content: center;
  197. transform-style: preserve-3d;
  198. transition: all 1.2s ease;
  199. .front {
  200. position: relative;
  201. display: flex;
  202. justify-content: center;
  203. .PrizeImg {
  204. width: 55vw;
  205. position: absolute;
  206. height: 48vw;
  207. top: 20vh;
  208. }
  209. }
  210. .back {
  211. transform: rotateY(180deg);
  212. width: 180px;
  213. height: 492px;
  214. background-size: 100% auto;
  215. background-repeat: no-repeat;
  216. }
  217. img {
  218. width: 48vw;
  219. }
  220. }
  221. .flipped {
  222. }
  223. }
  224. //底部按钮
  225. .dialog-footer {
  226. width: 140px;
  227. margin: 10px auto 0;
  228. .btn {
  229. background-position: 50% 50%;
  230. background-repeat: no-repeat;
  231. padding-top: 0;
  232. width: 90%;
  233. }
  234. }
  235. }
  236. }
  237. </style>