basicInformationmod.js 1.84 KB
/**
 * Created by mac on 17/9/12.
 */
(function () {

    //提交事件
    $('#ifo_submit').on('click',function () {
        var flagAjax = 0;
        var peo_text = $.trim($('#peo_text').val()),
            peo_pho = $.trim($('#peo_pho').val()),
            peo_email = $.trim($('#peo_email').val());
        var reg = new RegExp("^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$");
        //负责人
        if(peo_text == ''||peo_text == null||peo_text == undefined){
            $('#peo_text').next().html('请输入负责人');
            flagAjax --;
        }else{
            $('#peo_text').next().html('');
            flagAjax ++;
        };
        //联系电话
        if(peo_pho == ''||peo_pho == null||peo_pho == undefined){
            $('#peo_pho').next().html('请输入手机号');
            flagAjax --;
        }else if(!/^1(3|4|5|7|8)\d{9}$/.test(peo_pho)){
            $('#peo_pho').next().html('请输入正确手机号');
            flagAjax --;
        }else{
            $('#peo_pho').next().html('');
            flagAjax ++;
        };
        //邮箱
        if(peo_email == ''||peo_email == null||peo_email == undefined){
            $('#peo_email').next().html('请输入邮箱');
            flagAjax --;
        }else if(!reg.test(peo_email)){
            $('#peo_email').next().html('请输入正确邮箱');
            flagAjax --;
        }else{
            $('#peo_email').next().html('');
            flagAjax ++;
        };
        console.log(flagAjax)
        if(flagAjax == 3){
            //请求接口ajax

            //ajax  成功后跳转basicInformation.html;    window.location.href = "basicInformation.html"
        }else{
            return false;
        }
    });
    //取消事件
    $('#ifo_cancle').on('click',function () {
        alert('取消后,您所。。。。')
    });
})();