const verifySuperIdNo = (code) => {
let ws = [3, 7, 9, 10, 5, 8, 4, 2],
str = '0123456789ABCDEFGHIJKLMNOPQRStuVWXYZ',
reg = /^([0-9A-Z]){8}$/,
sum = 0,
values = code.split('-');
for(var i=0; i<8; i++){
sum += str.indexOf(values[0].charAt(i))*ws[i];
}
let C9 = 11 - (sum%11),
YC9 = values[1]+'';
if(!reg.test(values[0])){
return false
}
if(C9 == 11){
C9 = '0'
}else if(C9 == 10){
C9 = 'X'
}else{
C9 = C9+''
}
return YC9 == C9
}
ws[]数组的8个数字分别与code的前八位相乘,结果累加。把累加的结果除以11取余数,再将余数与code的第9个数字比对。返回结果。