feat: 마이페이지 AI 추천에 제품 이미지 표시
- /api/recommendation API에서 product_images DB 조회
- 제품명 매칭으로 썸네일 이미지 반환
- 이미지 있으면 실제 사진, 없으면 💊 이모지 표시
This commit is contained in:
@@ -466,7 +466,10 @@
|
||||
</div>
|
||||
<div style="padding:0 24px 32px;">
|
||||
<div style="text-align:center;padding:8px 0 20px;">
|
||||
<div style="font-size:48px;margin-bottom:16px;">💊</div>
|
||||
<div id="rec-image-container" style="margin-bottom:16px;">
|
||||
<img id="rec-image" style="width:100px;height:100px;object-fit:contain;border-radius:12px;display:none;" alt="추천 제품">
|
||||
<div id="rec-emoji" style="font-size:48px;">💊</div>
|
||||
</div>
|
||||
<div id="rec-message" style="color:#343a40;font-size:16px;font-weight:500;line-height:1.6;letter-spacing:-0.3px;margin-bottom:16px;"></div>
|
||||
<div id="rec-product" style="display:inline-block;background:linear-gradient(135deg,#6366f1,#8b5cf6);color:#fff;font-size:14px;font-weight:600;padding:8px 20px;border-radius:20px;letter-spacing:-0.2px;"></div>
|
||||
</div>
|
||||
@@ -575,6 +578,17 @@
|
||||
_recId = data.recommendation.id;
|
||||
document.getElementById('rec-message').textContent = data.recommendation.message;
|
||||
document.getElementById('rec-product').textContent = data.recommendation.product;
|
||||
|
||||
// 제품 이미지 표시
|
||||
if (data.recommendation.image) {
|
||||
document.getElementById('rec-image').src = 'data:image/jpeg;base64,' + data.recommendation.image;
|
||||
document.getElementById('rec-image').style.display = 'block';
|
||||
document.getElementById('rec-emoji').style.display = 'none';
|
||||
} else {
|
||||
document.getElementById('rec-image').style.display = 'none';
|
||||
document.getElementById('rec-emoji').style.display = 'block';
|
||||
}
|
||||
|
||||
document.getElementById('rec-sheet').style.display = 'block';
|
||||
document.getElementById('rec-backdrop').onclick = dismissRec;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user