Popup.vue 7.3KB

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