<template>
    <view class="cu-modal" :class="{'show': visible}">
        <view class="mask" @click="close"></view>
        <view class="cu-dialog" style="background-color: transparent; width:100%">
            <view v-if="message" class="relative wrapper flex-column-align-center">
                <view class="paddingX20 color-white font8">{{message}}</view>
            </view>
            <view class="paddingT30 flex-align-center">
                <image :src="resource.close" class="x" @click="close" />
            </view>
        </view>
    </view>
</template>

<script>
import resource from '@/utils/resource'
export default {
    data() {
        return {
            resource,
            visible: false,
            message: null
        }
    },
    methods: {
        show(message, duration = 2000) {
            this.message = message
            this.visible = true
            setTimeout(() => {
                this.close()
            }, duration);
        },
        close() {
            this.visible = false
            this.message = ''
        }
    }
}
</script>

<style lang="scss" scoped>
.mask {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
}
.wrapper {
    padding: 63rpx 40rpx 82rpx;
    z-index: 1001;
    width: 604rpx;
    margin: 0 auto;
    position: relative;
    background: linear-gradient(135deg, #8B3DFF 0%, #4223C8 100%);
    box-shadow: 0px 0px 10rpx 0px rgba(255, 129, 0, 0.5);
    border-radius: 16rpx;
    border: 1rpx solid rgba(255, 211, 155, 0.4);
}
.x {
    width: 60rpx;
    height: 60rpx;
}
</style>