| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <template>
- <view class="mask" :class="maskState===0 ? 'none' : maskState===1 ? 'show' : ''" >
- <view class="mask-content" @click.stop.prevent="stopPrevent">
- <view class="icon-wrap" @click.stop="toggleMask('none')">
- <u-icon name="/static/app/close.png" size="60rpx"></u-icon>
- </view>
- <!-- <view class="title">
- <image style="width: 262rpx;height: 52rpx" src="@/static/app/activity_title.png" mode="aspectFit"></image>
- </view>
- <view class="desc">
- <image style="width: 632rpx;height: 598rpx;" src="@/static/app/activity_content.png" mode="aspectFit"></image>
- </view> -->
-
- <view class="action-content">
- <u-button type="primary"
- style="margin-bottom: 30rpx;"
- shape="circle"
- class="c-button"
- :text="defautlOptions.confirmText"
- @click="confirm">
- </u-button>
- </view>
- </view>
- </view>
- </template>
- <script>
-
- export default {
- name:"c-pop-activity",
- data() {
- return {
- maskState: 0,
- defautlOptions: {
- title: '',
- content: '',
- confirmText: '我知道啦!开始打卡之旅!',
- confirmClass: 'text-red',
- cancelText: '我在想想',
- cancelClass: 'text-black'
- }
- };
- },
- methods: {
- stopPrevent(){
-
- },
- toggleMask(type){
- let timer = type === 'show' ? 10 : 30;
- let state = type === 'show' ? 1 : 0;
- this.maskState = 2;
- setTimeout(()=>{
- this.maskState = state;
- }, timer)
- },
- /**
- * @description 确认
- * @param {Object} title: String desc: String
- */
- $confirm(options = {}){
- // 继承原来的
- this.defautlOptions = Object.assign(this.defautlOptions, options);
- return new Promise((resolve,reject)=> {
- this.toggleMask('show')
- this._confirm = () => {
- resolve(1)
- this._confirm = null;
- }
- this._cancel = () => {
- resolve(0)
- this._cancel = null;
- }
- })
- },
- confirm() {
- if(this._confirm){
- this._confirm()
- this.toggleMask();
- }
- },
- cancel() {
- if(this._cancel){
- this._cancel()
- this.toggleMask();
- }
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .mask{
- display: flex;
- align-items: center;
- justify-content: center;
- position: fixed;
- left: 0;
- top: var(--window-top);
- bottom: 0;
- width: 100vw;
- background: rgba(0,0,0,0);
- z-index: 10001;
- transition: .6s;
-
- .mask-content{
- padding-top: 0rpx;
- display: flex;
- flex-direction: column;
- width: 720rpx;
- min-height: 806rpx;
- // background: #fff;
- background: url(@/static/app/activity_bg.png) no-repeat center center/ 720rpx 806rpx;
- border-radius: 15px;
- transition: transform .1s opacity 0.1s;
- transform: scale(1.2);
- transition-timing-function: ease-out;
- opacity: 0.3;
- }
-
- &.none{
- display: none;
- }
- &.show{
- background: rgba(0,0,0,.4);
-
- .mask-content{
- transition: transform .3s;
- opacity: 1;
- transform: scale(1);
- }
- }
- .title{
- padding-top: 20rpx;
- display: flex;
- justify-content: center;
- align-items: center;
-
- }
- .desc {
- margin-top: 55rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .action-content{
- padding-top: 40rpx;
- padding-left: 15rpx;
- padding-right: 15rpx;
- position: absolute;
- bottom: -130rpx;
- left: 0;
- right: 0;
- }
- }
- .icon-wrap{
- position: absolute;
- top: -40rpx;
- right: 20rpx;
- }
- </style>
|