Pnotify 不停点击只出现一个提示框(不停点击,防止接口不停调用)

function load_overview() {
    var timecount = 0;
    if (orHavaAuthorityStatus == "have") {
        if (needUpdateStr.indexOf('ck_overview') != -1) {
            sessionStorage.setItem("authrorityStatus", "have")
        } else {
            sessionStorage.setItem("authrorityStatus", "nohave")
        }
    } else {
        sessionStorage.setItem("authrorityStatus", "nohave")
    }
    var lastclickTime = sessionStorage.getItem("load_overview_time");
    var newclickTime = getClickTime(clicktime);
    sessionStorage.setItem("load_overview_time", newclickTime); //每次点击的时候把当前时间存一下
    if (lastclickTime != null) {
        var d1 = new Date(lastclickTime); //上次
        var d2 = new Date(newclickTime); //这次
        if (parseInt(d2 - d1) < 2000) { //单位是毫秒
            var last_timecount = sessionStorage.getItem("load_overview_timecount");
            var code = "操作太快,请稍后...x" + last_timecount;
            if (last_timecount == null) {
                last_timecount = 0;
            }
            PNotify.removeAll();
            new PNotify({
                text: code,
                styling: 'bootstrap3',
                hide: true,
                delay: 1000,
            });
            timecount = parseInt(last_timecount) + 1;
            sessionStorage.setItem("load_overview_timecount", timecount);


        } else {
            sessionStorage.setItem("load_overview_timecount", 1);
            clearTimeoutAll("load_overview");
            $('#kanbanID').empty();
            $('#kanbanID').load('productStatus/workShopOverview.jsp');
        }
    } else {
        sessionStorage.setItem("load_overview_timecount", 1);
        clearTimeoutAll("load_overview");
        $('#kanbanID').empty();
        $('#kanbanID').load('productStatus/workShopOverview.jsp');
    }
}

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值