123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339 |
- <template>
- <div v-if="showSelf" class="dialog">
- <ClickDIV :show="showPopupClickDIV" @cancelPopus="canckle" :stater="stater" />
-
- <div class="dialog-mark" @click.self="closeMyself">
- <div v-show="myShareShow" class="sharetiptxt" style>
- <img style="width:100%; height:100%;" src="../assets/popupImg/myShare.png" alt />
- </div>
- <transition name="dialog">
- <div class="dialog-sprite">
- <div class="dialog-body">
- <div class="card-wrapper">
- <div :class="`dialog-popuImag ${classDivAA?'flipped':''}`">
-
- <div class="back">
- <img style="width: 180px; height:492px" src="../assets/popupImg/popuBody.jpg" alt />
- </div>
-
- <div class="front">
- <img
- style="width: 180px; height:492px "
- src="../assets/popupImg/backImag.jpg"
- alt
- />
- </div>
- </div>
- </div>
-
- <div class="dialog-footer">
- <img @click="cancel" class="btn" src="../assets/popupImg/cancelmage.png" alt />
- </div>
- </div>
-
- <div class="section-box">
- <div class="section-box-share" @click="()=>{this.myShareShow=true}">
- <img src="../assets/popupImg/shareImage.png" alt />
- </div>
- <div
- class="section-box-receive"
- @click="()=>{this.showPopupClickDIV=true,this.stater=0}"
- >
- <img src="../assets/popupImg/receiveImage.png" alt />
- </div>
- <div class="section-box-save" @click="()=>{this.showPopupClickDIV=true,this.stater=1}">
- <img src="../assets/popupImg/saveImage.png" alt />
- </div>
- </div>
- </div>
- </transition>
- </div>
- </div>
- </template>
-
- <script>
- export default {
- name: 'Popup',
- components: {
- ClickDIV: () => import('@/components/ClickDIV.vue')
- },
- props: {
- show: {
- type: Boolean,
- default: false,
- required: true
- },
-
- cancelText: {
- type: String,
- default: '取消',
- required: false
- }
- },
-
- data() {
- return {
- name: 'dialog',
- showSelf: false,
- zIndex: this.getZIndex(),
- bodyOverflow: '',
- classDivAA: false,
- myShareShow: false,
- showPopupClickDIV: false,
- stater: null
- }
- },
- watch: {
- show(val) {
- 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: {
- canckle() {
- this.showPopupClickDIV = false
- },
- shareClick() {
- this.$router.replace({
- path: 'SaveShare',
- query: { states: 0 }
- })
- },
- saveClick() {
- this.$router.replace({
- path: 'SaveShare',
- query: { states: 1 }
- })
- },
- transform() {
- setTimeout(() => {
- this.classDivAA = this.show
- }, 0)
- },
-
- forbidScroll() {
- this.bodyOverflow = document.body.style.overflow
- document.body.style.overflow = 'hidden'
- },
-
-
- getZIndex() {
- let zIndexInit = 2022112
- return zIndexInit++
- },
-
-
- cancel() {
- this.$emit('cancel', true)
- },
-
-
- confirm() {
- this.$emit('confirm', true)
- },
-
-
- closeMyself(event) {
-
- },
-
-
- 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;
-
- .header {
- padding: 15px;
- text-align: center;
- font-size: 18px;
- font-weight: 700;
- color: #333;
- }
- .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 1.2s ease;
-
- // div {
- // // position: relative;
- // position: absolute;
- // width: 100%;
- // height: 100%;
- // /* 背面不显示 */
- // // backface-visibility: hidden;
- // }
- .front {
- }
- .back {
- position: absolute;
- transform: rotateY(180deg);
-
- // animation: change 0.8s linear forwards;
- }
-
- img {
- width: 48vw;
- }
- }
- .flipped {
- animation: change 0.8s 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: 32px;
- height: 32px;
- }
- }
- }
- .section-box {
- position: absolute;
- right: 15vw;
- top: 98px;
- height: 394px;
- display: flex;
- flex-direction: column;
- width: 36px;
- justify-content: space-between;
- margin-top: 2em;
-
- img {
- width: 36px;
- 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;
-
- // background: url('../assets/popupImg/receiveImage.png') no-repeat;
- }
- }
- }
- </style>
|