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:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user