mirror of
https://github.com/ddCat-main/cursor-auto-register.git
synced 2025-12-24 13:38:01 +08:00
@@ -36,6 +36,14 @@ function initializeApplication() {
|
||||
|
||||
// 绑定所有事件处理函数
|
||||
bindEventHandlers();
|
||||
|
||||
// 在自动刷新指示器中添加最后更新时间显示
|
||||
$(".position-fixed.bottom-0.end-0 .d-flex").append(
|
||||
'<span class="ms-2">最后更新: <span id="last-update-time">--:--:--</span></span>'
|
||||
);
|
||||
|
||||
// 立即更新一次时间,显示页面初始加载时间
|
||||
updateLastRefreshTime();
|
||||
}
|
||||
|
||||
// 事件处理绑定函数 - 将所有事件绑定集中在一起
|
||||
@@ -185,8 +193,11 @@ function hideLoading() {
|
||||
}
|
||||
|
||||
// 加载账号数据
|
||||
function loadAccounts(page = 1, perPage = itemsPerPage, search = '', sortField = currentSortField, sortOrder = currentSortOrder) {
|
||||
showLoading();
|
||||
function loadAccounts(page = 1, perPage = itemsPerPage, search = '', sortField = currentSortField, sortOrder = currentSortOrder, showLoadingOverlay = true) {
|
||||
// 只在需要时显示加载遮罩
|
||||
if (showLoadingOverlay) {
|
||||
showLoading();
|
||||
}
|
||||
|
||||
// 构建URL查询参数
|
||||
let params = new URLSearchParams({
|
||||
@@ -249,14 +260,20 @@ function loadAccounts(page = 1, perPage = itemsPerPage, search = '', sortField =
|
||||
// 淡入表格
|
||||
$("#accounts-table").animate({opacity: 1}, 300);
|
||||
|
||||
hideLoading();
|
||||
if (showLoadingOverlay) {
|
||||
hideLoading();
|
||||
}
|
||||
} else {
|
||||
if (showLoadingOverlay) {
|
||||
hideLoading();
|
||||
}
|
||||
showAlert('danger', '加载账号失败: ' + response.message);
|
||||
hideLoading();
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
hideLoading();
|
||||
if (showLoadingOverlay) {
|
||||
hideLoading();
|
||||
}
|
||||
showAlert('danger', '加载账号失败: ' + (xhr.responseJSON?.detail || xhr.statusText));
|
||||
}
|
||||
});
|
||||
@@ -1546,7 +1563,11 @@ function setupTaskRefresh() {
|
||||
|
||||
// 如果在账号管理页面,刷新账号列表
|
||||
if ($("#tasks-accounts").hasClass('active')) {
|
||||
loadAccounts(currentPage, itemsPerPage, $("#search-input").val(), currentSortField, currentSortOrder);
|
||||
// 静默刷新,不显示loading框
|
||||
loadAccounts(currentPage, itemsPerPage, $("#search-input").val(), currentSortField, currentSortOrder, false);
|
||||
|
||||
// 更新最后刷新时间
|
||||
updateLastRefreshTime();
|
||||
}
|
||||
}, REFRESH_INTERVAL);
|
||||
|
||||
@@ -1554,6 +1575,15 @@ function setupTaskRefresh() {
|
||||
checkTaskStatus();
|
||||
}
|
||||
|
||||
// 更新最后刷新时间的函数
|
||||
function updateLastRefreshTime() {
|
||||
const now = new Date();
|
||||
const timeString = now.getHours().toString().padStart(2, '0') + ":" +
|
||||
now.getMinutes().toString().padStart(2, '0') + ":" +
|
||||
now.getSeconds().toString().padStart(2, '0');
|
||||
$("#last-update-time").text(timeString);
|
||||
}
|
||||
|
||||
// 检查任务状态
|
||||
function checkTaskStatus() {
|
||||
fetch('/registration/status')
|
||||
|
||||
Reference in New Issue
Block a user