WinningPopup.vue 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  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. <!-- <img src="../assets/popupImg/popuBody.jpg" alt /> -->
  13. <div class="back" :style="`background-image: url(${backimg});`">
  14. <img
  15. style="width: 180px; height:492px"
  16. src="../assets/prizeImg/HappyWnning.jpg"
  17. alt
  18. />
  19. </div>
  20. <div class="front">
  21. <img
  22. style="width: 180px; height:492px "
  23. src="../assets/prizeImg/HappyWnning.jpg"
  24. alt
  25. />
  26. </div>
  27. </div>
  28. </div>
  29. <div @click="cancel" class="dialog-footer">
  30. <img @click="cancel" class="btn" src="../assets/buttonImg/happyAccept.png" alt />
  31. </div>
  32. </div>
  33. <!-- 右侧 -->
  34. </div>
  35. </transition>
  36. </div>
  37. </div>
  38. </template>
  39. <script>
  40. export default {
  41. name: 'Popup',
  42. components: {},
  43. props: {
  44. show: {
  45. type: Boolean,
  46. default: false,
  47. required: true
  48. },
  49. cancelText: {
  50. type: String,
  51. default: '取消',
  52. required: false
  53. },
  54. currentMonth: {
  55. type: Object
  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. stater: null
  68. }
  69. },
  70. watch: {
  71. show(val) {
  72. console.log('🚀 ~ file: Popup.vue ~ line 78 ~ show ~ val', val)
  73. this.showSelf = val
  74. if (this.show === false) {
  75. this.myShareShow = false
  76. }
  77. this.transform()
  78. // if (!val) {
  79. // this.closeMyself()
  80. // } else {
  81. // this.showSelf = val
  82. // }
  83. }
  84. },
  85. created() {
  86. this.showSelf = this.show
  87. },
  88. mounted() {
  89. this.forbidScroll()
  90. if (this.show === true) {
  91. this.transform()
  92. }
  93. },
  94. methods: {
  95. canckle() {
  96. // this.showPopupCalendarPoster = false
  97. },
  98. shareClick() {
  99. this.$router.replace({
  100. path: 'SaveShare',
  101. query: { states: 0 }
  102. })
  103. },
  104. saveClick() {
  105. this.$router.replace({
  106. path: 'SaveShare',
  107. query: { states: 1 }
  108. })
  109. },
  110. transform() {
  111. setTimeout(() => {
  112. this.classDivAA = this.show
  113. }, 0)
  114. },
  115. /** 禁止页面滚动 */
  116. forbidScroll() {
  117. this.bodyOverflow = document.body.style.overflow
  118. document.body.style.overflow = 'hidden'
  119. },
  120. /** 每次获取之后 zindex 自动增加 */
  121. getZIndex() {
  122. let zIndexInit = 2022112
  123. return zIndexInit++
  124. },
  125. /** 取消按钮操作 */
  126. cancel() {
  127. this.$emit('cancel', true)
  128. },
  129. /** 确认按钮操作 */
  130. confirm() {
  131. this.$emit('confirm', true)
  132. },
  133. /** 点击遮罩关闭弹窗 */
  134. closeMyself(event) {
  135. // this.sloveBodyOverflow()
  136. },
  137. /** 恢复页面的滚动 */
  138. sloveBodyOverflow() {
  139. document.body.style.overflow = this.bodyOverflow
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="less" scoped>
  145. // 弹窗动画
  146. // 最外层 设置position定位
  147. // 遮罩 设置背景层,z-index值要足够大确保能覆盖,高度 宽度设置满 做到全屏遮罩
  148. .dialog {
  149. position: fixed;
  150. top: 0;
  151. right: 0;
  152. width: 100%;
  153. height: 100%;
  154. transition: opacity 1s;
  155. // 内容层 z-index要比遮罩大,否则会被遮盖
  156. .dialog-mark {
  157. position: relative;
  158. top: 0;
  159. height: 0;
  160. width: 100%;
  161. height: 100%;
  162. background: rgba(0, 0, 0, 0.6);
  163. left: 0;
  164. top: 0;
  165. z-index: 99;
  166. display: flex;
  167. align-items: center;
  168. justify-content: center;
  169. .sharetiptxt {
  170. background-size: 100% auto;
  171. background-repeat: no-repeat;
  172. z-index: 55;
  173. width: 20px;
  174. height: 320px;
  175. display: block;
  176. position: absolute;
  177. right: 1rem;
  178. top: 0.5em;
  179. animation: tipup 1s ease infinite;
  180. }
  181. }
  182. }
  183. @keyframes tipup {
  184. 0% {
  185. transform: translateY(0%);
  186. }
  187. 50% {
  188. transform: translateY(5%);
  189. }
  190. 100% {
  191. transform: translateY(0%);
  192. }
  193. }
  194. .dialog-sprite {
  195. width: 100vw;
  196. display: flex;
  197. justify-content: center;
  198. position: relative;
  199. .header {
  200. padding: 15px;
  201. text-align: center;
  202. font-size: 18px;
  203. font-weight: 700;
  204. color: #333;
  205. }
  206. .dialog-body {
  207. flex: 1;
  208. overflow-x: hidden;
  209. overflow-y: scroll;
  210. padding: 0 15px 20px 15px;
  211. //中间卡片
  212. .card-wrapper {
  213. perspective: 600px;
  214. margin-top: 2em;
  215. .dialog-popuImag {
  216. position: relative;
  217. display: flex;
  218. justify-content: center;
  219. transform-style: preserve-3d;
  220. transition: all 1.2s ease;
  221. // div {
  222. // // position: relative;
  223. // position: absolute;
  224. // width: 100%;
  225. // height: 100%;
  226. // /* 背面不显示 */
  227. // // backface-visibility: hidden;
  228. // }
  229. .front {
  230. }
  231. .back {
  232. position: absolute;
  233. transform: rotateY(180deg);
  234. width: 180px;
  235. height: 492px;
  236. background-size: 100% auto;
  237. background-repeat: no-repeat;
  238. // animation: change 0.8s linear forwards;
  239. }
  240. img {
  241. width: 48vw;
  242. }
  243. }
  244. .flipped {
  245. animation: change 0.8s linear forwards;
  246. }
  247. }
  248. @keyframes change {
  249. from {
  250. top: -20vh;
  251. left: -20vw;
  252. opacity: 0;
  253. transform: scale(0.5);
  254. }
  255. to {
  256. top: -0;
  257. left: -0;
  258. opacity: 2;
  259. transform: scale(1);
  260. transform: rotateY(180deg);
  261. }
  262. }
  263. //底部按钮
  264. .dialog-footer {
  265. width: 140px;
  266. margin: 10px auto 0;
  267. .btn {
  268. background-position: 50% 50%;
  269. background-repeat: no-repeat;
  270. padding-top: 0;
  271. width: 100%;
  272. }
  273. }
  274. }
  275. .section-box {
  276. position: absolute;
  277. right: 15vw;
  278. top: 98px;
  279. height: 394px;
  280. display: flex;
  281. flex-direction: column;
  282. width: 36px;
  283. justify-content: space-between;
  284. margin-top: 2em;
  285. img {
  286. width: 36px;
  287. background-size: 100% auto;
  288. margin-top: 0;
  289. border-radius: 18px;
  290. }
  291. &-receive {
  292. width: 36px;
  293. background-size: 100% auto;
  294. margin-top: 0;
  295. }
  296. &-save {
  297. width: 36px;
  298. border-radius: 18px;
  299. background-size: 100% auto;
  300. width: 36px;
  301. margin-top: 0;
  302. // background: url('../assets/popupImg/receiveImage.png') no-repeat;
  303. }
  304. }
  305. }
  306. </style>