push.blade.php 4.67 KB
<style>
    .box-card {
        width: 400px;
        border: 1px solid rgb(220, 223, 230);
        border-radius: 40px;
        margin-right: 24px;
        padding: 37px 20px;
        min-height: 679px;
    }

    .phone-content {
        border: 1px solid rgb(220, 223, 230);
        height: 625px;
        overflow: hidden;
        position: relative;
        background: rgb(245, 245, 245);
    }

    .notification-app-name,
    .notification-title,
    .notification-detail{
        position: absolute;
        overflow: hidden;
        color: #181919;
    }

    .notification-app-name{
        width: 160px;
        font-size: 13px;
        top: 222px;
        left: 92px;
    }
    .notification-title{
        width: 210px;
        font-size: 14px;
        top: 242px;
        left: 67px;
    }
    .notification-detail{
        width: 230px;
        font-size: 13px;
        top: 265px;
        left: 67px;
        word-break: break-all;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
</style>
<button type="button" class="btn btn-primary sync"><i class="feather icon-repeat"></i> 预览看效果</button>
<hr>
<div class="box-card">
    <div class="phone-content">
        <img src="{{asset('storage/images/ios1-2.png')}}" alt="" width="358" height="625" id="bg_img">
        <div class="notification-app-name"> 一言-临境 </div>
        <div class="notification-title"> Demo 标题 </div>
        <div class="notification-detail"> 开发者249d42a097c1944e进行了广播推送,这是一条广播 </div>
    </div>
</div>

<script>
    Dcat.ready(function () {
        var asset = "{{asset('/storage/')}}";

        $(document).off('click', '.sync').on('click', '.sync', function () {
            let terminal = parseInt($('.terminal:checked').val());
            if (terminal === 1) {
                $('#bg_img').attr('src', asset + '/images/android-2.png');
                $('.notification-app-name').css('top','244px').css('left','80px');
                $('.notification-title').css('top','264px').css('left','57px');
                $('.notification-detail').css('top','287px').css('left','57px');
            }else{
                $('#bg_img').attr('src', asset + '/images/ios1-2.png');
                $('.notification-app-name').css('top','222px').css('left','92px');
                $('.notification-title').css('top','242px').css('left','67px');
                $('.notification-detail').css('top','265px').css('left','67px');
            }

            if ($('.title').val()) {
                $('.notification-title').html($('.title').val());
            }

            if ($('.push_content').val()) {
                $('.notification-detail').html($('.push_content').val());
            }





            // let ori_top = 80;
            // let top = parseInt($('.field_top').val()) + ori_top;
            // let left = $('.field_left').val();
            // let font = $('.field_font_size').val();
            // let content_size = 12 + parseInt(font);
            // let title_size = 14 + parseInt(font);
            // let text_color = $('.text_color').val() || 'whitesmoke';
            // let text_bg_color = $('.text_bg_color').val() || '#5c6bc6';
            // let opacity = parseInt($('.opacity').val()) / 100;
            //
            // $('.poem-block').css('top', top + 'px').css('left', left + 'px')
            //     .css('background-color', text_bg_color).css('opacity', opacity);
            // $('.poem-title').css('font-size', title_size + 'px').css('color', text_color);
            // $('.poem-content').css('font-size', content_size + 'px').css('color', text_color);
            //
            //
            // let bg_img_url = $('.bg_img_url').find("input[type='hidden'][name='bg_url']").val();
            // if (bg_img_url !== '') {
            //     $('.bg_img').attr('src', asset + '/' + bg_img_url).css('display', 'block');
            // }
            //
            // let bg_video_url = $('.bg_video_url').find("input[type='hidden'][name='bg_url']").val();
            // if (bg_video_url !== ''){
            //     $('#bg_video').attr('src', asset + '/' + bg_video_url).css('display', 'block');
            //     let bg_video = document.getElementById('bg_video');
            //     bg_video.autoplay = true;
            //     bg_video.loop = true;
            // }
            //
            // let bgm_url = $('.bgm_url').find("input[type='hidden'][name='bgm_url']").val();
            // if (bgm_url !== ''){
            //     $('#bg_audio').attr('src', asset + '/' + bgm_url);
            //     let bg_audio = document.getElementById('bg_audio');
            //     bg_audio.autoplay = true;
            //     bg_audio.loop = true;
            // }
        })

    })
</script>