fix(接口3测试页): base64 图片补 data:image/jpeg;base64, 前缀

后端返回的 hair_growth_image_base64 是裸 base64(无 data: 前缀),
原代码直接赋给 <img>.src,浏览器把 base64 当相对路径请求,
拼成 http://host:8187/9j/4AAQ... 发 GET 导致 400 Bad Request。

参照接口2 测试页的写法,手动拼接 data:image/jpeg;base64, 前缀。
后端代码无需改动(接口2 一直正常)。
This commit is contained in:
xsl
2026-07-19 15:14:41 +08:00
parent 6d9e92f710
commit f870c20f7f
+1 -1
View File
@@ -175,7 +175,7 @@ async function submitTest() {
$('hairlineType').style.display = 'inline-block';
}
const grownSrc = d.hair_growth_image_url || d.hair_growth_image_base64;
const grownSrc = d.hair_growth_image_url || (d.hair_growth_image_base64 ? 'data:image/jpeg;base64,' + d.hair_growth_image_base64 : '');
if (grownSrc) {
$('blendTop').src = grownSrc;
$('blendTop').style.display = 'block';