//限制身份證號碼的輸入
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';
}
},
