jiqing9006
<script>
    function remind() {
        // 新订单提醒
        $.ajax({
            type    :\'POST\',
            url     :\'__APP__/Index/checkNewOrder\',
            data    : {},
            dataType:\'json\',
            success:function(data){
                console.log(data);
                if (data.data == 1){
                    // 右下角弹框
                    layer.open({
                        type:0,
                        title: \'提示\',
                        content: \'您有新的订单,请及时查看\',
                        anim: 2,
                        shade:0,
                        offset:"rb"
                    });
                }
            }
        });


        // 新订单提醒
        $.ajax({
            type    :\'POST\',
            url     :\'__APP__/Index/checkNewGroupOrder\',
            data    : {},
            dataType:\'json\',
            success:function(data){
                console.log(data);
                if (data.data == 1){
                    // 右下角弹框
                    layer.open({
                        type:0,
                        title: \'提示\',
                        content: \'您有新的【拼团】订单,请及时查看\',
                        anim: 2,
                        shade:0,
                        offset:"rb"
                    });
                }
            }
        });

    }
    setInterval("remind()",10000);
</script>

增加提示音

<script>
    function remind() {
        // 新订单提醒
        $.ajax({
            type: \'POST\',
            url: \'__APP__/Index/checkNewOrder\',
            data: {},
            dataType: \'json\',
            success: function (data) {
                console.log(data);
                if (data.data == 1) {
                    playSound();
                    // 右下角弹框
                    layer.open({
                        type: 0,
                        title: \'提示\',
                        content: \'您有新的订单,请及时查看\',
                        anim: 2,
                        shade: 0,
                        offset: "rb"
                    });
                }
            }
        });


        // 新订单提醒
        $.ajax({
            type: \'POST\',
            url: \'__APP__/Index/checkNewGroupOrder\',
            data: {},
            dataType: \'json\',
            success: function (data) {
                console.log(data);
                if (data.data == 1) {
                    playSound();
                    // 右下角弹框
                    layer.open({
                        type: 0,
                        title: \'提示\',
                        content: \'您有新的【拼团】订单,请及时查看\',
                        anim: 2,
                        shade: 0,
                        offset: "rb"
                    });
                }
            }
        });

    }


    let playSound = function () {
        let browser = window.navigator.userAgent.toLowerCase();
        if (browser.indexOf("ie") >= 0) {
            //IE内核浏览器
            let strEmbed = \'<embed name="embedPlay" src="/admin/image/voice.mp3" autostart="true" hidden="true" loop="false"></embed>\';
            if ($("body").find("embed").length <= 0)
                $("body").append(strEmbed);
            let embed = document.embedPlay;
            embed.volume = 100;
        } else {
            //非IE内核浏览器
            let strAudio = "<audio id=\'audioPlay\' src=\'/admin/image/voice.mp3\' hidden=\'true\'>";

            if ($("#audioPlay").length <= 0) {
                $("body").append(strAudio);
            }
            let audio = document.getElementById("audioPlay");
            //浏览器支持 audio
            audio.play();
        }
    }

    setInterval("remind()", 10000);
</script>

分类:

技术点:

相关文章:

  • 2021-06-17
  • 2022-12-23
  • 2021-11-02
  • 2021-06-27
  • 2021-12-26
  • 2022-12-23
猜你喜欢
  • 2021-06-04
  • 2022-12-23
  • 2021-05-24
  • 2021-09-22
  • 2022-12-23
  • 2021-09-25
  • 2021-12-24
相关资源
相似解决方案