// 数据处理功能 // 从身份证号提取生日 export function getBirthdayByIdNO(IdNO) { let birthday = '' if (IdNO.length === 18) { birthday = IdNO.substr(6, 8) return birthday.replace(/(.{4})(.{2})/, '$1-$2-') } else if (IdNO.length === 15) { birthday = '19' + IdNO.substr(6, 6) return birthday.replace(/(.{4})(.{2})/, '$1-$2-') } else { return '' } } // 从身份证号提取性别,1表示男,2表示女 export function getSexByIdNO(IdNO) { if (IdNO.length === 18) { return IdNO.charAt(16) % 2 === 0 ? '2' : '1' } else if (IdNO.length === 15) { return IdNO.charAt(14) % 2 === 0 ? '2' : '1' } else { return '' } }