document.addEventListener('DOMContentLoaded', function() { loadUserInfo(); }); function loadUserInfo() { const isLoggedIn = localStorage.getItem('isLoggedIn'); const userName = localStorage.getItem('userName'); const userCompany = localStorage.getItem('userCompany'); const isBound = localStorage.getItem('isBound'); const userAvatar = document.getElementById('userAvatar'); const userNameEl = document.getElementById('userName'); const accountStatus = document.getElementById('accountStatus'); const emptyRecords = document.getElementById('emptyRecords'); const recordsGrid = document.getElementById('recordsGrid'); if (isLoggedIn && userName) { userAvatar.innerHTML = ''; const userInfo = document.getElementById('userInfo'); userInfo.innerHTML = `
${userName}
${userCompany || ''}
`; if (isBound) { accountStatus.textContent = userName; accountStatus.style.color = '#333'; emptyRecords.style.display = 'none'; recordsGrid.style.display = 'grid'; } } } function handleAccountClick() { const isBound = localStorage.getItem('isBound'); if (isBound) { document.getElementById('unbindModal').classList.add('active'); } else { window.location.href = 'bind-account.html'; } } function closeUnbindModal() { document.getElementById('unbindModal').classList.remove('active'); } function confirmUnbind() { localStorage.removeItem('isBound'); closeUnbindModal(); document.getElementById('accountStatus').textContent = '未绑定'; document.getElementById('accountStatus').style.color = '#999'; document.getElementById('emptyRecords').style.display = 'flex'; document.getElementById('recordsGrid').style.display = 'none'; }