123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- <template>
- <div v-if="showSelf" class="dialog">
- <CalendarPoster
- :show="showPopupCalendarPoster"
- @cancelPopus="canckle"
- :stater="stater"
- :current-month="currentMonth"
- />
-
- <!-- 我的奖品 -->
- <MyWinning
- :show="MyWinningShow"
- @cancelPopus="canclMyWinning"
- :current-month="currentMonth"
- :PrizeState="PrizeState"
- :Prize="isPrize"
- />
- <div class="dialog-mark" @click.self="closeMyself">
- <div v-show="myShareShow" class="sharetiptxt" style>
- <img style=" height:100%;" src="../assets/buttonImg/shareText.png" alt />
- </div>
- <transition name="dialog">
- <div class="dialog-sprite">
- <div class="dialog-body">
- <div class="card-wrapper">
- <div :class="`dialog-popuImag ${classDivAA?'flipped':''}`">
- <!-- <img src="../assets/buttonImg/popuBody.jpg" alt /> -->
- <div class="back">
- <img style="width: 48vw; height:492px" :src="currentMonth.popImg" alt />
- </div>
-
- <div class="front">
- <img style="width: 48vw; height:492px " :src="currentMonth.calendarImg" alt />
- </div>
- </div>
- </div>
-
- <div class="dialog-footer">
- <img @click="cancel" class="btn" src="../assets/buttonImg/closeBut.png" alt />
- </div>
- </div>
- <!-- 右侧 -->
- <div class="section-box">
- <div class="section-box-share" @click="()=>{this.MyWinningShow=true}" v-if="isPrize">
- <img src="../assets/buttonImg/myPrize.png" alt />
- </div>
- <div
- class="section-box-receive"
- @click="()=>{this.showPopupCalendarPoster=true,this.stater=0}"
- >
- <img src="../assets/buttonImg/saveHaibao.png" alt />
- </div>
- <div
- class="section-box-save"
- @click="()=>{this.showPopupCalendarPoster=true,this.stater=1}"
- >
- <img src="../assets/buttonImg/saveMonth.png" alt />
- </div>
- </div>
- </div>
- </transition>
- </div>
- </div>
- </template>
-
- <script>
- export default {
- name: 'Popup',
- components: {
- CalendarPoster: () => import('@/components/CalendarPoster.vue'),
- MyWinning: () => import('@/components/MyWinning.vue')
- },
- props: {
- show: {
- type: Boolean,
- default: false,
- required: true
- },
- currentMonth: {
- type: Object
- },
- isPrize: {
- type: Object
- },
- showCancel: {
- typs: Boolean,
- default: false,
- required: false
- },
- cancelText: {
- type: String,
- default: '取消',
- required: false
- },
- PrizeState: {
- type: Number
- }
- // LoadingShow: {
- // type: Boolean,
- // default: false,
- // required: true
- // }
- },
-
- data() {
- return {
- name: 'dialog',
- showSelf: false,
- zIndex: this.getZIndex(),
- bodyOverflow: '',
- classDivAA: false,
- myShareShow: false,
- showPopupCalendarPoster: false,
- stater: null,
- MyWinningShow: false
- }
- },
- watch: {
- show(val) {
- console.log(this.isPrize, 'aaaaaaaaaaaa')
-
- console.log('🚀 ~ file: Popup.vue ~ line 78 ~ show ~ val', val)
- this.showSelf = val
- if (this.show === false) {
- this.myShareShow = false
- }
- this.transform()
- }
- },
- created() {
- this.showSelf = this.show
- },
- mounted() {
- this.forbidScroll()
- if (this.show === true) {
- this.transform()
- }
- },
- methods: {
- canclMyWinning() {
- this.MyWinningShow = false
- },
- canckle() {
- this.showPopupCalendarPoster = false
- },
- shareClick() {
- this.$router.replace({
- path: 'SaveShare',
- query: { states: 0 }
- })
- },
- transform() {
- setTimeout(() => {
- this.classDivAA = this.show
- }, 0)
- },
- /** 禁止页面滚动 */
- forbidScroll() {
- this.bodyOverflow = document.body.style.overflow
- document.body.style.overflow = 'hidden'
- },
-
- /** 每次获取之后 zindex 自动增加 */
- getZIndex() {
- let zIndexInit = 2022112
- return zIndexInit++
- },
-
- /** 取消按钮操作 */
- cancel() {
- event.stopPropagation()
- this.$emit('cancel', true)
- },
-
- /** 点击遮罩关闭弹窗 */
- closeMyself(event) {
- // this.sloveBodyOverflow()
- },
-
- /** 恢复页面的滚动 */
- sloveBodyOverflow() {
- document.body.style.overflow = this.bodyOverflow
- }
- }
- }
- </script>
-
- <style lang="less" scoped>
- // 弹窗动画
-
- // 最外层 设置position定位
- // 遮罩 设置背景层,z-index值要足够大确保能覆盖,高度 宽度设置满 做到全屏遮罩
-
- .dialog {
- position: fixed;
- top: 0;
- right: 0;
- width: 100%;
- height: 100%;
- transition: opacity 1s;
-
- // 内容层 z-index要比遮罩大,否则会被遮盖
- .dialog-mark {
- position: relative;
- top: 0;
- height: 0;
- width: 100%;
- height: 100%;
- background: rgba(0, 0, 0, 0.6);
- left: 0;
- top: 0;
- z-index: 99;
- display: flex;
- align-items: center;
- justify-content: center;
- .sharetiptxt {
- background-size: 100% auto;
- background-repeat: no-repeat;
- z-index: 55;
- width: 20px;
- height: 320px;
- display: block;
- position: absolute;
- right: 1rem;
- top: 0.5em;
- animation: tipup 1s ease infinite;
- }
- }
- }
- @keyframes tipup {
- 0% {
- transform: translateY(0%);
- }
- 50% {
- transform: translateY(5%);
- }
- 100% {
- transform: translateY(0%);
- }
- }
-
- .dialog-sprite {
- width: 100vw;
- display: flex;
- justify-content: center;
- position: relative;
- .dialog-body {
- flex: 1;
- overflow-x: hidden;
- overflow-y: scroll;
- padding: 0 15px 20px 15px;
-
- //中间卡片
- .card-wrapper {
- perspective: 600px;
- margin-top: 2em;
-
- .dialog-popuImag {
- position: relative;
- display: flex;
- justify-content: center;
- transform-style: preserve-3d;
- transition: all 0.8s ease;
-
- .front {
- }
- .back {
- position: absolute;
- transform: rotateY(180deg);
- }
- }
- .flipped {
- animation: change 0.6s linear forwards;
- }
- }
- @keyframes change {
- from {
- top: -20vh;
- left: -20vw;
- opacity: 0;
- transform: scale(0.5);
- }
- to {
- top: -0;
- left: -0;
- opacity: 2;
- transform: scale(1);
- transform: rotateY(-180deg);
- }
- }
- //底部按钮
- .dialog-footer {
- width: 100%;
- background-size: 100% auto;
- margin: 10px auto 0;
- .btn {
- padding-top: 0;
- width: 40px;
- height: 34px;
- }
- }
- }
- .section-box {
- position: absolute;
- right: 15vw;
- top: 98px;
- height: 394px;
- display: flex;
- flex-direction: column;
- width: 36px;
- justify-content: space-between;
-
- img {
- width: 100%;
- background-size: 100% auto;
- margin-top: 0;
- border-radius: 18px;
- }
-
- &-receive {
- width: 36px;
- background-size: 100% auto;
- margin-top: 0;
- }
- &-save {
- width: 36px;
- border-radius: 18px;
- background-size: 100% auto;
- width: 36px;
- margin-top: 0;
- }
- }
- }
- </style>
|