feat: 키오스크 대기화면 슬라이드쇼 + 브랜딩 + 010 기본입력

- 대기화면: 3장 자동 슬라이드 (동물의약품/건기식/부외품, 30% 한도)
- 브랜딩: AI 에이전트 개발 약국, 복약안내 진심 약사, 모바일 약료 시스템
- 전화번호 010 고정 + 나머지 8자리만 입력
- 다크 배경 대기화면 → 밝은 적립/성공 화면

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
thug0bin 2026-02-25 13:30:07 +09:00
parent f80c19567a
commit a4410f5fe0

View File

@ -8,16 +8,11 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;900&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
background: #f5f7fa;
background: #0f0b2e;
height: 100vh;
overflow: hidden;
-webkit-font-smoothing: antialiased;
@ -27,70 +22,159 @@
/* ── 헤더 ── */
.header {
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
padding: 20px 32px;
padding: 16px 32px;
display: flex;
justify-content: space-between;
align-items: center;
}
.header-logo {
color: #fff;
font-size: 22px;
font-weight: 700;
letter-spacing: -0.5px;
}
.header-time {
color: rgba(255,255,255,0.8);
font-size: 16px;
}
.header-logo { color: #fff; font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.header-time { color: rgba(255,255,255,0.7); font-size: 15px; }
/* ── 메인 컨텐츠 ── */
/* ── 메인 ── */
.main {
height: calc(100vh - 70px);
height: calc(100vh - 56px);
display: flex;
justify-content: center;
align-items: center;
padding: 24px;
position: relative;
}
/* ── 화면 상태 ── */
.screen { display: none; width: 100%; max-width: 900px; }
.screen { display: none; width: 100%; height: 100%; }
.screen.active { display: flex; }
/* ══════════════════════════════════════
대기 화면
대기 화면 - 슬라이드쇼 + 브랜딩
══════════════════════════════════════ */
.idle-screen {
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
gap: 24px;
position: relative;
}
.idle-icon {
width: 120px;
height: 120px;
background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
border-radius: 32px;
/* 슬라이드 컨테이너 */
.slides-wrapper {
width: 100%;
max-width: 780px;
position: relative;
height: 380px;
}
.slide {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 20px;
opacity: 0;
transform: translateX(60px);
transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
pointer-events: none;
}
.slide.active {
opacity: 1;
transform: translateX(0);
pointer-events: auto;
}
.slide.exit {
opacity: 0;
transform: translateX(-60px);
}
.slide-icon {
width: 100px;
height: 100px;
border-radius: 28px;
display: flex;
align-items: center;
justify-content: center;
font-size: 56px;
animation: pulse 2s ease-in-out infinite;
font-size: 52px;
box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
@keyframes pulse {
0%, 100% { transform: scale(1); opacity: 0.9; }
50% { transform: scale(1.05); opacity: 1; }
}
.idle-title {
font-size: 32px;
.slide-tag {
display: inline-block;
padding: 6px 16px;
border-radius: 20px;
font-size: 13px;
font-weight: 700;
color: #1e1b4b;
letter-spacing: -0.5px;
letter-spacing: 0.5px;
}
.idle-subtitle {
font-size: 18px;
color: #6b7280;
.slide-title {
font-size: 30px;
font-weight: 900;
color: #fff;
letter-spacing: -0.8px;
line-height: 1.3;
}
.slide-desc {
font-size: 17px;
color: rgba(255,255,255,0.65);
line-height: 1.6;
max-width: 500px;
}
.slide-highlight {
display: inline-block;
padding: 10px 28px;
background: rgba(255,255,255,0.08);
border: 1px solid rgba(255,255,255,0.15);
border-radius: 14px;
color: rgba(255,255,255,0.9);
font-size: 15px;
font-weight: 600;
margin-top: 4px;
}
/* 슬라이드별 색상 */
.slide-1 .slide-icon { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.slide-1 .slide-tag { background: #fef3c7; color: #92400e; }
.slide-2 .slide-icon { background: linear-gradient(135deg, #34d399, #10b981); }
.slide-2 .slide-tag { background: #d1fae5; color: #065f46; }
.slide-3 .slide-icon { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.slide-3 .slide-tag { background: #dbeafe; color: #1e40af; }
/* 인디케이터 */
.slide-dots {
display: flex;
gap: 10px;
margin-top: 24px;
}
.slide-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background: rgba(255,255,255,0.2);
transition: all 0.3s;
}
.slide-dot.active {
width: 32px;
border-radius: 5px;
background: #8b5cf6;
}
/* 브랜딩 영역 */
.branding {
margin-top: 32px;
display: flex;
align-items: center;
gap: 32px;
}
.branding-divider {
width: 1px;
height: 48px;
background: rgba(255,255,255,0.1);
}
.branding-item {
display: flex;
align-items: center;
gap: 8px;
color: rgba(255,255,255,0.4);
font-size: 13px;
font-weight: 500;
}
.branding-item span.icon {
font-size: 18px;
}
/* ══════════════════════════════════════
@ -99,10 +183,11 @@
.claim-screen {
flex-direction: row;
gap: 48px;
align-items: stretch;
align-items: center;
justify-content: center;
max-width: 960px;
margin: 0 auto;
}
/* 왼쪽: QR + 안내 */
.claim-left {
flex: 1;
display: flex;
@ -119,41 +204,18 @@
text-align: center;
width: 100%;
}
.claim-amount-label {
font-size: 15px;
color: #6b7280;
margin-bottom: 4px;
}
.claim-amount {
font-size: 36px;
font-weight: 900;
color: #1e1b4b;
letter-spacing: -1px;
}
.claim-points {
font-size: 20px;
color: #6366f1;
font-weight: 700;
margin-top: 8px;
}
.claim-amount-label { font-size: 15px; color: #6b7280; margin-bottom: 4px; }
.claim-amount { font-size: 36px; font-weight: 900; color: #1e1b4b; letter-spacing: -1px; }
.claim-points { font-size: 20px; color: #6366f1; font-weight: 700; margin-top: 8px; }
.qr-container {
background: #fff;
border-radius: 20px;
padding: 24px;
box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.qr-container img {
width: 200px;
height: 200px;
}
.qr-hint {
font-size: 15px;
color: #6b7280;
text-align: center;
margin-top: 12px;
}
.qr-container img { width: 200px; height: 200px; }
.qr-hint { font-size: 15px; color: #6b7280; text-align: center; margin-top: 12px; }
/* 구분선 */
.divider {
display: flex;
flex-direction: column;
@ -161,55 +223,52 @@
justify-content: center;
gap: 12px;
}
.divider-line {
width: 2px;
height: 80px;
background: #e5e7eb;
}
.divider-text {
font-size: 16px;
color: #9ca3af;
font-weight: 500;
background: #f5f7fa;
padding: 8px 0;
}
.divider-line { width: 2px; height: 80px; background: #e5e7eb; }
.divider-text { font-size: 16px; color: #9ca3af; font-weight: 500; }
/* 오른쪽: 전화번호 입력 */
.claim-right {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 20px;
gap: 16px;
}
.phone-section-title {
font-size: 20px;
font-weight: 700;
color: #1e1b4b;
}
.phone-display {
.phone-section-title { font-size: 20px; font-weight: 700; color: #1e1b4b; }
/* 전화번호 디스플레이 */
.phone-display-wrap {
width: 100%;
max-width: 360px;
background: #fff;
border: 3px solid #e5e7eb;
border-radius: 16px;
padding: 16px 24px;
font-size: 32px;
padding: 14px 20px;
display: flex;
align-items: center;
transition: border-color 0.2s;
min-height: 64px;
}
.phone-display-wrap.focus { border-color: #6366f1; }
.phone-display-wrap.error { border-color: #ef4444; animation: shake 0.3s; }
.phone-prefix {
font-size: 28px;
font-weight: 700;
color: #9ca3af;
letter-spacing: 1px;
margin-right: 4px;
flex-shrink: 0;
}
.phone-number {
font-size: 28px;
font-weight: 700;
text-align: center;
color: #1e1b4b;
letter-spacing: 2px;
min-height: 68px;
transition: border-color 0.2s;
}
.phone-display.focus {
border-color: #6366f1;
}
.phone-display.error {
border-color: #ef4444;
animation: shake 0.3s;
flex: 1;
text-align: center;
}
.phone-number.placeholder { color: #d1d5db; }
@keyframes shake {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-8px); }
@ -217,57 +276,29 @@
}
/* 숫자 패드 */
.numpad {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
width: 100%;
max-width: 360px;
}
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; max-width: 360px; }
.numpad-btn {
background: #fff;
border: 2px solid #e5e7eb;
border-radius: 14px;
padding: 18px;
font-size: 28px;
padding: 16px;
font-size: 26px;
font-weight: 700;
color: #1e1b4b;
cursor: pointer;
transition: all 0.1s;
font-family: inherit;
}
.numpad-btn:active {
background: #6366f1;
color: #fff;
border-color: #6366f1;
transform: scale(0.95);
}
.numpad-btn.delete {
background: #fef2f2;
border-color: #fecaca;
color: #ef4444;
font-size: 20px;
}
.numpad-btn.delete:active {
background: #ef4444;
color: #fff;
}
.numpad-btn.clear {
background: #f5f5f5;
border-color: #d4d4d4;
color: #737373;
font-size: 16px;
}
.numpad-btn.clear:active {
background: #737373;
color: #fff;
}
.numpad-btn:active { background: #6366f1; color: #fff; border-color: #6366f1; transform: scale(0.95); }
.numpad-btn.delete { background: #fef2f2; border-color: #fecaca; color: #ef4444; font-size: 18px; }
.numpad-btn.delete:active { background: #ef4444; color: #fff; }
.numpad-btn.clear { background: #f5f5f5; border-color: #d4d4d4; color: #737373; font-size: 14px; }
.numpad-btn.clear:active { background: #737373; color: #fff; }
/* 적립 버튼 */
.submit-btn {
width: 100%;
max-width: 360px;
padding: 18px;
padding: 16px;
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
color: #fff;
border: none;
@ -277,15 +308,11 @@
cursor: pointer;
font-family: inherit;
transition: all 0.2s;
letter-spacing: -0.3px;
}
.submit-btn:active {
transform: scale(0.97);
}
.submit-btn:disabled {
background: #d1d5db;
cursor: not-allowed;
}
.submit-btn:active { transform: scale(0.97); }
.submit-btn:disabled { background: #d1d5db; cursor: not-allowed; }
.error-msg { color: #ef4444; font-size: 14px; font-weight: 500; min-height: 20px; }
/* ══════════════════════════════════════
성공 화면
@ -298,82 +325,40 @@
gap: 20px;
}
.success-icon {
width: 120px;
height: 120px;
width: 120px; height: 120px;
background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
display: flex; align-items: center; justify-content: center;
font-size: 60px;
animation: pop 0.4s ease-out;
}
@keyframes pop {
0% { transform: scale(0); }
80% { transform: scale(1.1); }
100% { transform: scale(1); }
}
.success-title {
font-size: 36px;
font-weight: 900;
color: #16a34a;
}
.success-points {
font-size: 48px;
font-weight: 900;
color: #1e1b4b;
letter-spacing: -1px;
}
.success-balance {
font-size: 20px;
color: #6b7280;
}
.success-balance strong {
color: #6366f1;
font-weight: 700;
}
.success-countdown {
font-size: 15px;
color: #9ca3af;
margin-top: 8px;
}
/* ── 에러 메시지 ── */
.error-msg {
color: #ef4444;
font-size: 15px;
font-weight: 500;
min-height: 22px;
}
@keyframes pop { 0% { transform: scale(0); } 80% { transform: scale(1.1); } 100% { transform: scale(1); } }
.success-title { font-size: 36px; font-weight: 900; color: #16a34a; }
.success-points { font-size: 48px; font-weight: 900; color: #1e1b4b; letter-spacing: -1px; }
.success-balance { font-size: 20px; color: #6b7280; }
.success-balance strong { color: #6366f1; font-weight: 700; }
.success-countdown { font-size: 15px; color: #9ca3af; margin-top: 8px; }
/* ── 로딩 ── */
.loading-overlay {
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
background: rgba(0,0,0,0.3);
display: none;
align-items: center;
justify-content: center;
z-index: 100;
}
.loading-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.3); display: none; align-items: center; justify-content: center; z-index: 100; }
.loading-overlay.active { display: flex; }
.loading-spinner {
width: 60px;
height: 60px;
border: 6px solid #e5e7eb;
border-top-color: #6366f1;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
.loading-spinner { width: 60px; height: 60px; border: 6px solid #e5e7eb; border-top-color: #6366f1; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* ── 반응형 (세로 모드) ── */
/* ── 적립/성공 화면 배경 밝게 ── */
.claim-screen, .success-screen { background: #f5f7fa; border-radius: 24px; padding: 32px; }
/* ── 반응형 ── */
@media (max-width: 700px) {
.claim-screen { flex-direction: column; gap: 24px; }
.claim-screen { flex-direction: column; gap: 20px; padding: 20px; }
.divider { flex-direction: row; }
.divider-line { width: 80px; height: 2px; }
.divider-line { width: 60px; height: 2px; }
.claim-amount { font-size: 28px; }
.qr-container img { width: 150px; height: 150px; }
.branding { flex-direction: column; gap: 12px; }
.branding-divider { display: none; }
.slide-title { font-size: 24px; }
.slides-wrapper { height: 320px; }
}
</style>
</head>
@ -388,19 +373,65 @@
<!-- 메인 -->
<div class="main">
<!-- 1. 대기 화면 -->
<!-- 1. 대기 화면 (슬라이드쇼 + 브랜딩) -->
<div class="screen idle-screen active" id="idleScreen">
<div class="idle-icon">💊</div>
<div class="idle-title">마일리지 적립</div>
<div class="idle-subtitle">
약사님이 적립을 시작하면<br>
이 화면에서 바로 적립할 수 있습니다
<div class="slides-wrapper">
<!-- 슬라이드 1: 동물의약품 -->
<div class="slide slide-1 active" data-slide="0">
<div class="slide-icon">🐾</div>
<div class="slide-tag">반려동물 케어</div>
<div class="slide-title">우리 아이 약도<br>마일리지로 구매!</div>
<div class="slide-desc">
청춘약국 마일리지로<br>
동물의약품을 구매할 수 있어요
</div>
<div class="slide-highlight">총 결제금액의 30% 한도 내 사용 가능</div>
</div>
<!-- 슬라이드 2: 건기식 -->
<div class="slide slide-2" data-slide="1">
<div class="slide-icon">🌿</div>
<div class="slide-tag">건강기능식품</div>
<div class="slide-title">팜큐 건강기능식품<br>마일리지로 챙기세요</div>
<div class="slide-desc">
비타민, 유산균, 오메가3 등<br>
엄선된 건기식을 포인트로 구매!
</div>
<div class="slide-highlight">총 결제금액의 30% 한도 내 사용 가능</div>
</div>
<!-- 슬라이드 3: 부외품 -->
<div class="slide slide-3" data-slide="2">
<div class="slide-icon">💧</div>
<div class="slide-tag">약국 용품</div>
<div class="slide-title">투약병, 부외품도<br>마일리지로 OK</div>
<div class="slide-desc">
물약병, 연고통, 밴드 등<br>
필요한 약국 용품을 포인트로!
</div>
<div class="slide-highlight">총 결제금액의 30% 한도 내 사용 가능</div>
</div>
</div>
<!-- 인디케이터 -->
<div class="slide-dots">
<div class="slide-dot active" data-dot="0"></div>
<div class="slide-dot" data-dot="1"></div>
<div class="slide-dot" data-dot="2"></div>
</div>
<!-- 브랜딩 -->
<div class="branding">
<div class="branding-item"><span class="icon">🤖</span> AI 에이전트 개발 약국</div>
<div class="branding-divider"></div>
<div class="branding-item"><span class="icon">💊</span> 복약안내에 진심인 약사</div>
<div class="branding-divider"></div>
<div class="branding-item"><span class="icon">📱</span> 모바일 약료 시스템 도입</div>
</div>
</div>
<!-- 2. 적립 화면 -->
<div class="screen claim-screen" id="claimScreen">
<!-- 왼쪽: QR + 금액 -->
<div class="claim-left">
<div class="claim-info-card">
<div class="claim-amount-label">결제 금액</div>
@ -413,17 +444,18 @@
</div>
</div>
<!-- 구분선 -->
<div class="divider" id="dividerEl" style="display:none;">
<div class="divider-line"></div>
<div class="divider-text">또는</div>
<div class="divider-line"></div>
</div>
<!-- 오른쪽: 전화번호 입력 -->
<div class="claim-right">
<div class="phone-section-title">전화번호로 적립하기</div>
<div class="phone-display" id="phoneDisplay">-</div>
<div class="phone-display-wrap" id="phoneWrap">
<span class="phone-prefix">010 -</span>
<span class="phone-number placeholder" id="phoneDisplay">0000-0000</span>
</div>
<div class="error-msg" id="errorMsg"></div>
<div class="numpad">
<button class="numpad-btn" onclick="numPress('1')">1</button>
@ -460,16 +492,62 @@
</div>
<script>
// ── 상태 관리 ──
let phoneNumber = '';
// ── 상태 ──
let phoneNumber = ''; // 010 이후 8자리만 관리
let currentSession = null;
let pollingInterval = null;
let successTimeout = null;
// ── 슬라이드쇼 ──
let currentSlide = 0;
const TOTAL_SLIDES = 3;
const SLIDE_INTERVAL = 4000; // 4초
let slideTimer = null;
function nextSlide() {
const slides = document.querySelectorAll('.slide');
const dots = document.querySelectorAll('.slide-dot');
// 현재 슬라이드 exit
slides[currentSlide].classList.remove('active');
slides[currentSlide].classList.add('exit');
dots[currentSlide].classList.remove('active');
// 다음 슬라이드
currentSlide = (currentSlide + 1) % TOTAL_SLIDES;
// exit 클래스 제거 (transition 후)
setTimeout(() => {
document.querySelectorAll('.slide.exit').forEach(s => s.classList.remove('exit'));
}, 600);
slides[currentSlide].classList.add('active');
dots[currentSlide].classList.add('active');
}
function startSlideshow() {
if (slideTimer) clearInterval(slideTimer);
slideTimer = setInterval(nextSlide, SLIDE_INTERVAL);
}
function stopSlideshow() {
if (slideTimer) { clearInterval(slideTimer); slideTimer = null; }
}
startSlideshow();
// ── 화면 전환 ──
function showScreen(name) {
document.querySelectorAll('.screen').forEach(s => s.classList.remove('active'));
document.getElementById(name + 'Screen').classList.add('active');
if (name === 'idle') {
document.body.style.background = '#0f0b2e';
startSlideshow();
} else {
document.body.style.background = '#f5f7fa';
stopSlideshow();
}
}
// ── 시계 ──
@ -482,34 +560,35 @@ function updateClock() {
updateClock();
setInterval(updateClock, 30000);
// ── 전화번호 포맷 (010-1234-5678) ──
function formatPhone(num) {
if (num.length <= 3) return num;
if (num.length <= 7) return num.slice(0, 3) + '-' + num.slice(3);
return num.slice(0, 3) + '-' + num.slice(3, 7) + '-' + num.slice(7);
// ── 전화번호 (010 고정, 나머지 8자리) ──
function formatSuffix(num) {
if (num.length <= 4) return num + '●'.repeat(Math.max(0, 4 - num.length)) + '-' + '●●●●';
return num.slice(0, 4) + '-' + num.slice(4) + '●'.repeat(Math.max(0, 8 - num.length));
}
function updatePhoneDisplay() {
const display = document.getElementById('phoneDisplay');
const wrap = document.getElementById('phoneWrap');
const btn = document.getElementById('submitBtn');
if (phoneNumber.length === 0) {
display.textContent = '-';
display.classList.remove('focus');
display.textContent = '0000-0000';
display.className = 'phone-number placeholder';
wrap.classList.remove('focus');
btn.disabled = true;
} else {
display.textContent = formatPhone(phoneNumber);
display.classList.add('focus');
btn.disabled = phoneNumber.length < 10;
display.textContent = formatSuffix(phoneNumber);
display.className = 'phone-number';
wrap.classList.add('focus');
btn.disabled = phoneNumber.length < 8;
}
display.classList.remove('error');
wrap.classList.remove('error');
document.getElementById('errorMsg').textContent = '';
}
// ── 숫자 패드 ──
function numPress(digit) {
if (phoneNumber.length >= 11) return;
if (phoneNumber.length >= 8) return;
phoneNumber += digit;
updatePhoneDisplay();
}
@ -524,10 +603,11 @@ function numClear() {
updatePhoneDisplay();
}
// ── 적립 제출 ──
// ── 적립 ──
async function submitClaim() {
if (phoneNumber.length < 10) {
document.getElementById('phoneDisplay').classList.add('error');
const fullPhone = '010' + phoneNumber;
if (fullPhone.length < 11) {
document.getElementById('phoneWrap').classList.add('error');
document.getElementById('errorMsg').textContent = '전화번호를 정확히 입력해주세요';
return;
}
@ -539,16 +619,15 @@ async function submitClaim() {
const resp = await fetch('/api/kiosk/claim', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ phone: phoneNumber })
body: JSON.stringify({ phone: fullPhone })
});
const data = await resp.json();
document.getElementById('loadingOverlay').classList.remove('active');
if (data.success) {
showSuccess(data.points, data.balance);
} else {
document.getElementById('phoneDisplay').classList.add('error');
document.getElementById('phoneWrap').classList.add('error');
document.getElementById('errorMsg').textContent = data.message || '적립 실패';
document.getElementById('submitBtn').disabled = false;
}
@ -565,7 +644,6 @@ function showSuccess(points, balance) {
document.getElementById('successBalance').textContent = balance.toLocaleString() + 'P';
showScreen('success');
// 5초 카운트다운 후 대기 화면
let countdown = 5;
const el = document.getElementById('successCountdown');
el.textContent = countdown + '초 후 처음 화면으로 돌아갑니다';
@ -573,16 +651,11 @@ function showSuccess(points, balance) {
if (successTimeout) clearInterval(successTimeout);
successTimeout = setInterval(() => {
countdown--;
if (countdown <= 0) {
clearInterval(successTimeout);
resetToIdle();
} else {
el.textContent = countdown + '초 후 처음 화면으로 돌아갑니다';
}
if (countdown <= 0) { clearInterval(successTimeout); resetToIdle(); }
else { el.textContent = countdown + '초 후 처음 화면으로 돌아갑니다'; }
}, 1000);
}
// ── 대기 화면 복귀 ──
function resetToIdle() {
phoneNumber = '';
currentSession = null;
@ -590,25 +663,20 @@ function resetToIdle() {
showScreen('idle');
}
// ── 폴링: 키오스크 세션 확인 (2초) ──
// ── 폴링 ──
async function pollKioskSession() {
try {
const resp = await fetch('/api/kiosk/current');
const data = await resp.json();
if (data.active && !currentSession) {
// 새 세션 감지 → 적립 화면 전환
currentSession = data;
phoneNumber = '';
updatePhoneDisplay();
// 금액, 포인트 표시
document.getElementById('claimAmount').textContent =
data.amount.toLocaleString() + '원';
document.getElementById('claimPoints').textContent =
data.points.toLocaleString();
document.getElementById('claimAmount').textContent = data.amount.toLocaleString() + '원';
document.getElementById('claimPoints').textContent = data.points.toLocaleString();
// QR 코드 (있으면 표시)
if (data.qr_url) {
document.getElementById('qrImage').src =
'https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=' +
@ -622,17 +690,13 @@ async function pollKioskSession() {
showScreen('claim');
} else if (!data.active && currentSession) {
// 세션 종료 (다른 곳에서 적립 완료 등)
resetToIdle();
}
} catch (err) {
// 네트워크 오류 시 무시 (다음 폴링에서 재시도)
}
} catch (err) { /* 다음 폴링에서 재시도 */ }
}
// ── 폴링 시작 ──
pollingInterval = setInterval(pollKioskSession, 1000);
pollKioskSession(); // 즉시 1회 실행
pollKioskSession();
</script>
</body>
</html>