sfrz.js 1.38 KB
$(function () {
    layui.use('element', function () {
        let element = layui.element; //导航的hover效果、二级菜单等功能,需要依赖element模块
        //监听导航点击
        element.on('nav(demo)', function (elem) {
            layer.msg(elem.text());
        });
    });
    addTabs('#wssq')
    // 业务
    $('.feachBtn').click(function () {
        var tel = $("#tel").val();
        //正则表达式
        var reg = /(1[3-9]\d{9}$)/;
        if (!reg.test(tel)) {
            layui.use('layer', function(){
                var layer = layui.layer;
                layer.msg("请输入正确格式的手机号码", {
                    icon: 5
                });
              }); 
            return false;
        } else {
            let count = 5;
            $('.feachBtn').attr('disabled', true);
            $('.feachBtn').css({
                background: '#eee',
                color: '#707070',
            });
            count--;
            countDown = setInterval(() => {
                count--;
                $('.feachBtn').text(count + '秒后可重新获取');
                if (count === 0) {
                    $('.feachBtn').text('重新发送').removeAttr('disabled');
                    clearInterval(countDown);
                }
            }, 1000);
            $('.feachBtn').text(count + '秒后可重新获取');
        }
    })
})