diff --git a/certificate.html b/certificate.html index aad81c1..0988707 100644 --- a/certificate.html +++ b/certificate.html @@ -537,6 +537,12 @@ return phone.substring(0, 3) + '****' + phone.substring(7); } + // 隐藏主体名称中间部分,只显示第一个字和最后一个字 + function hideSubjectName(name) { + if (!name || name.length <= 2) return name; + return name.charAt(0) + '*'.repeat(name.length - 2) + name.charAt(name.length - 1); + } + // 显示合格证信息 function displayCertificate(certificate) { const container = document.getElementById('certificateInfo'); @@ -545,7 +551,7 @@ html += `
主体名称: - ${certificate.subjectName || ''} + ${hideSubjectName(certificate.subjectName) || ''}
产品名称: