定时器:右下角滑动信息通知

模块中 _layout.cshtml 引用文件 :


        <script type="text/javascript" src="../../Content/artDialog/artDialog.source.js?skin=blue"></script>
        <script type="text/javascript" src="../../Content/artDialog/plugins/iframeTools.source.js"></script>

<script>
            (function () {
                //右下角滑动通知 每分钟执行一次,停留时秒
                window.setInterval(HaveNoVerifyPOrder, 60000);
            }())

            function HaveNoVerifyPOrder() {
                var url = "/Product/HaveNoVerifyProductOrder";
                $.ajax({
                    url: url,
                    type: "post",
                    datatype: "json",
                    success: EndAjaxHaveNoVerifyPOrder
                });
            }

            function EndAjaxHaveNoVerifyPOrder(e) {

                if (e.bl || e.bl == "True" || e.bl == "true") {

                    var ShowHtml = GetProductOrderInfo(e.Data);

                    $("#pring")[0].play();

                    //弹窗 调用示例:
                    art.dialog.notice({
                        title: '提示:有锁芯订单,请及时查看',
                        220,// 必须指定一个像素宽度值或者百分比,否则浏览器窗口改变可能导致artDialog收缩
                        content: ShowHtml,//'有锁芯订单,请及时查看',//
                        icon: 'face-sad',
                        time: 10
                    });
                }
            }
            //显示订单
            function GetProductOrderInfo(obj) {
                var strhtml = "<ul class='artDialogDiv'>";
                $.each(obj, function (i, item) {
                    strhtml += "<li>" + item.OrderNo + " <a href='/product/OrderIndex'>查看</a> </li>";
                });
                strhtml += "</ul>";
                return strhtml;
            }
            //右下角滑动通知  : 带动画效果10秒后自动消失
            artDialog.notice = function (options) {
                var opt = options || {},
                    api, aConfig, hide, wrap, top,
                    duration = 800;

                var config = {
                    id: 'Notice',
                    left: '100%',
                    top: '100%',
                    fixed: true,
                    drag: false,
                    resize: false,
                    follow: null,
                    lock: false,
                    init: function (here) {
                        api = this;
                        aConfig = api.config;
                        wrap = api.DOM.wrap;
                        top = parseInt(wrap[0].style.top);
                        hide = top + wrap[0].offsetHeight;

                        wrap.css('top', hide + 'px')
                            .animate({ top: top + 'px' }, duration, function () {
                                opt.init && opt.init.call(api, here);
                            });
                    },
                    close: function (here) {
                        wrap.animate({ top: hide + 'px' }, duration, function () {
                            opt.close && opt.close.call(this, here);
                            aConfig.close = $.noop;
                            api.close();
                        });

                        return false;
                    }
                };

                for (var i in opt) {
                    if (config[i] === undefined) config[i] = opt[i];
                };

                return artDialog(config);
            };

            </script>

后台方法:

 public JsonResult HaveNoVerifyProductOrder()
        {
            bool bl=false;
            using (EFContext ef = new EFContext())
            {
                List<ProductOrder> list = ef.FindAll<ProductOrder>(o => o.Status == 0 && o.RStatus == 0).ToList();
                if(list.Count>0)
                {
                    bl = true;
                }
                JsonResultInfo json = new JsonResultInfo();
                json.bl = bl;
                json.Data = list;

                var result = new JsonResult();
                result.Data = json;
                result.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                return result;
            }
        }

class:

/// <summary>
    /// 返回到前端的信息
    /// </summary>
    public class JsonResultInfo
    {
        //可以根据需求自定义
        public bool bl { get; set; }
        public string Msg { get; set; }
        public object Data { get; set; }

        
        public object List { get; set; }
        public int iNums { get; set; }

    }