@@ -138,7 +138,7 @@
|
||||
const img = document.getElementById('cert-img');
|
||||
const hint = document.getElementById('click-hint');
|
||||
|
||||
if (img.src && img.complete) {
|
||||
if (img.src && img.complete && img.naturalWidth > 0) {
|
||||
img.style.display = 'block';
|
||||
if (hint) hint.style.display = 'none';
|
||||
return;
|
||||
@@ -148,14 +148,14 @@
|
||||
hint.innerHTML = '<span class="hint-orb">载</span><strong>图片加载中</strong><span>正在读取证书原件,请稍候。</span>';
|
||||
}
|
||||
|
||||
img.src = `img/${certNumber}.svg`;
|
||||
img.src = `https://s3.biss.click/CERTS/${encodeURIComponent(certNumber)}.svg`;
|
||||
img.onload = () => {
|
||||
img.style.display = 'block';
|
||||
if (hint) hint.style.display = 'none';
|
||||
};
|
||||
img.onerror = () => {
|
||||
if (hint) {
|
||||
hint.innerHTML = '<span class="hint-orb">!</span><strong>图片加载失败</strong><span>未找到对应证书图片文件,请检查 `img` 目录资源。</span>';
|
||||
hint.innerHTML = '<span class="hint-orb">!</span><strong>图片加载失败</strong><span>未找到对应证书图片文件</span>';
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -188,7 +188,7 @@
|
||||
img.onerror = () => {
|
||||
reject(new Error('证书图片加载失败'));
|
||||
};
|
||||
img.src = `img/${certNumber}.svg`;
|
||||
img.src = `https://s3.biss.click/CERTS/${encodeURIComponent(certNumber)}.svg`;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user