欢迎使用XR端口
系统已成功安装,请前往后台管理您的网站内容。
2026-07-05 11:14:15
// 悬浮窗功能
let currentPanel = null;
function togglePanel(type) {
const panelId = type + 'Panel';
const panel = document.getElementById(panelId);
if (panel.classList.contains('show')) {
panel.classList.remove('show');
currentPanel = null;
} else {
// 关闭其他面板
closeAllPanels();
// 打开当前面板
panel.classList.add('show');
currentPanel = panelId;
}
}
function closeAllPanels() {
document.querySelectorAll('.float-panel').forEach(p => p.classList.remove('show'));
currentPanel = null;
}
function showNotifyDetail(element) {
const title = element.querySelector('.notify-item-title').textContent.trim();
const content = element.querySelector('.notify-item-content').textContent.trim();
Swal.fire({
title: '' + title,
html: '' + content + '
',
icon: 'info',
confirmButtonText: '我知道了',
width: '400px'
});
// 标记为已读
if (element.classList.contains('unread')) {
element.classList.remove('unread');
// 更新红点
const unreadCount = document.querySelectorAll('.notify-item.unread').length;
const badge = document.getElementById('notifyBadge');
if (badge) {
if (unreadCount === 0) {
badge.remove();
} else {
badge.textContent = unreadCount;
}
}
}
}
// 点击其他区域关闭面板
document.addEventListener('click', function(e) {
if (currentPanel && !e.target.closest('.float-btn') && !e.target.closest('.float-panel')) {
closeAllPanels();
}
});
// ESC键关闭面板
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
closeAllPanels();
}
});
// 反馈提交功能
function openFeedback() {
Swal.fire({
title: '提交反馈',
html: '' +
'
' +
'' +
'' +
'
' +
'
' +
'' +
'' +
'
' +
'
' +
'' +
'' +
'
' +
'
',
confirmButtonText: ' 提交反馈',
cancelButtonText: ' 取消',
showCancelButton: true,
width: '480px',
padding: '1.5rem',
background: '#fff',
backdrop: 'rgba(0,0,0,0.6)',
preConfirm: () => {
const content = document.getElementById('fbContent').value.trim();
if (!content) {
Swal.showValidationMessage('请填写反馈内容');
return false;
}
return {
name: document.getElementById('fbName').value.trim(),
contact: document.getElementById('fbContact').value.trim(),
content: content
};
}
}).then((result) => {
if (result.isConfirmed) {
fetch('submit_feedback.php', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: 'name=' + encodeURIComponent(result.value.name) +
'&contact=' + encodeURIComponent(result.value.contact) +
'&content=' + encodeURIComponent(result.value.content)
}).then(response => response.json()).then(data => {
if (data.success) {
Swal.fire({
icon: 'success',
title: '反馈成功',
text: '感谢您的反馈!我们会尽快处理。',
timer: 2000,
showConfirmButton: false
});
} else {
Swal.fire({ icon: 'error', title: '提交失败', text: data.message || '请稍后重试' });
}
}).catch(() => {
Swal.fire({ icon: 'error', title: '提交失败', text: '网络错误,请稍后重试' });
});
}
});
}