zoukankan      html  css  js  c++  java
  • 新订单提示效果

    <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>
    
  • 相关阅读:
    RocketMq总结(六) -- 顺序消息
    RocketMq总结(五) -- 消息队列负载均衡和再分配
    RocketMq总结(三) -- 消费者启动 MQClientInstance
    归并排序
    CMS垃圾收集器总结
    桶排序
    快速排序
    ThreadLocal的妙用
    NC_41 找最小的k个数
    RocketMq一条消息存储结构
  • 原文地址:https://www.cnblogs.com/jiqing9006/p/11857356.html
Copyright © 2011-2022 走看看