//限制身份证号码的输入
if( !(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(this.verification.cardNo)) ){ this.$u.toast('输入的身份证号长度不对,或者号码不符合规定!15位号码应全为数字,18位号码末位可以为数字或X。'); return }
//获取生日和性别
getBirth(idCard) {
var birthday = "";
if(idCard != null && idCard != ""){
if(idCard.length == 15){
birthday = "19"+idCard.slice(6,12);
} else if(idCard.length == 18){
birthday = idCard.slice(6,14);
}
this.studentForm.birthday = birthday.replace(/(.{4})(.{2})/,"$1-$2-");
//通过正则表达式来指定输出格式为:1990-01-01
}
if (parseInt(idCard.slice(-2, -1)) % 2 == 1) {
this.studentForm.sex = '0';
}
else {
this.studentForm.sex = '1';
}
},