From 8ac34dbb51b47f47cecebd8057f3c50982c8d1a3 Mon Sep 17 00:00:00 2001 From: x1ao4 Date: Sat, 5 Jul 2025 16:17:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=98=BE=E7=A4=BA=E5=BD=93?= =?UTF-8?q?=E6=97=A5=E6=9B=B4=E6=96=B0=E6=A0=87=E8=AF=86=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E5=A4=B9=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E9=A2=9C=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 对于当日更新的内容,在任务列表的任务名称、转存记录的转存为名称、文件整理的文件名后方显示当日更新标识(星星图标) - 新增显示设置选项:始终显示/悬停显示/禁用 - 完全向后兼容,不影响现有功能 - 把表格中的文件夹图标由黄色改为蓝色,视觉效果更统一和谐 --- app/run.py | 8 ++- app/static/css/main.css | 62 +++++++++++++------ app/templates/index.html | 130 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 171 insertions(+), 29 deletions(-) diff --git a/app/run.py b/app/run.py index 37abac0..d63b749 100644 --- a/app/run.py +++ b/app/run.py @@ -1427,10 +1427,14 @@ def get_task_latest_info(): timestamp = timestamp / 1000 # 转换为秒级时间戳 if 0 < timestamp < 4102444800: # 从1970年到2100年的合理时间戳范围 - # 格式化为月-日格式 + # 格式化为月-日格式(用于显示)和完整日期(用于今日判断) date_obj = datetime.fromtimestamp(timestamp) formatted_date = date_obj.strftime("%m-%d") - task_latest_records[task_name] = formatted_date + full_date = date_obj.strftime("%Y-%m-%d") + task_latest_records[task_name] = { + "display": formatted_date, # 显示用的 MM-DD 格式 + "full": full_date # 比较用的 YYYY-MM-DD 格式 + } except (ValueError, TypeError, OverflowError): pass # 忽略无效的时间戳 diff --git a/app/static/css/main.css b/app/static/css/main.css index f2f41f6..99bc8db 100644 --- a/app/static/css/main.css +++ b/app/static/css/main.css @@ -1678,7 +1678,7 @@ button.close:focus, } #fileSelectModal .table .text-warning { - color: #ffc107 !important; + color: #098eff !important; } /* 弹窗内表格行悬停效果 */ @@ -3928,7 +3928,7 @@ table.selectable-records .expand-button:hover { /* 模态框通用文件夹图标样式 */ #fileSelectModal .bi-folder-fill { - color: #ffc107; + color: #098eff; font-size: 0.95rem; margin-right: 4px !important; position: relative; @@ -4020,7 +4020,6 @@ table.selectable-records .expand-button:hover { /* 任务按钮悬停显示样式 */ .task-buttons .hover-only { opacity: 0; - transition: opacity 0.2s ease-in-out; position: absolute; right: 0; visibility: hidden; @@ -4087,6 +4086,45 @@ table.selectable-records .expand-button:hover { padding-right: 4px !important; } +/* 当天更新指示器样式 */ +.task-today-indicator { + display: inline-block; + font-size: 0.92rem; + font-weight: bold; +} + +.task-today-indicator i { + background: linear-gradient(45deg, #03d5ff 25%, var(--focus-border-color) 60%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; + color: var(--focus-border-color); /* 备用颜色,以防渐变不支持 */ +} + +/* 当日更新图标悬停显示样式 */ +.task-today-indicator.hover-only { + opacity: 0; + visibility: hidden; +} + +/* 任务列表页面悬停显示 */ +.task:hover .task-today-indicator.hover-only { + opacity: 1; + visibility: visible; +} + +/* 转存记录页面悬停显示 */ +.table-hover tbody tr:hover .task-today-indicator.hover-only { + opacity: 1; + visibility: visible; +} + +/* 文件整理页面悬停显示 */ +.selectable-files tbody tr:hover .task-today-indicator.hover-only { + opacity: 1; + visibility: visible; +} + .display-setting-row { margin-left: -4px !important; margin-right: -4px !important; @@ -4130,22 +4168,6 @@ table.selectable-records .expand-button:hover { cursor: default; } -/* 任务按钮悬停显示样式 */ -.task-buttons .hover-only { - opacity: 0; - transition: opacity 0.2s ease-in-out; - position: absolute; - right: 0; - visibility: hidden; -} - -/* 修改悬停触发范围到整个任务单元 */ -.task:hover .task-buttons .hover-only { - opacity: 1; - visibility: visible; - position: static; -} - /* 确保按钮容器在悬停时保持宽度 */ .task-buttons { position: relative; @@ -5311,7 +5333,7 @@ body .selectable-files tr.selected-file:has([style*="white-space: normal"]) .fil position: relative; top: 1px; /* 可微调垂直对齐 */ left: -1px; /* 可微调水平对齐 */ - color: #ffc107; /* 保持黄色 */ + color: #098eff; /* 55%接近深蓝色 */ } /* 文件整理页面无法识别剧集编号样式 */ diff --git a/app/templates/index.html b/app/templates/index.html index d445fbd..643f4b7 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -73,7 +73,7 @@ function getFileIconClass(fileName, isDir = false) { // 如果是文件夹,返回文件夹图标 if (isDir) { - return 'bi-folder-fill text-warning'; + return 'bi-folder-fill'; } // 获取文件扩展名(转为小写) @@ -730,6 +730,18 @@ +
+
+
+ 当日更新标识 +
+ +
+
@@ -810,13 +822,18 @@ - · {{ taskLatestRecords[task.taskname] }} + · {{ getTaskLatestRecordDisplay(task.taskname) }} · {{ taskLatestFiles[task.taskname] }} + + +
@@ -1073,17 +1090,27 @@
-
{{ record.renamed_to }} + + +
{{ record.renamed_to }} + + +
@@ -1326,10 +1353,20 @@ :title="file.file_name" v-check-file-overflow="index + '|file_name'"> {{ file.file_name }} + + +
{{ file.file_name }} + + +
@@ -1651,7 +1688,8 @@ refresh_plex: "always", refresh_alist: "always", latest_update_date: "always", - latest_transfer_file: "always" + latest_transfer_file: "always", + today_update_indicator: "always" }, file_performance: { api_page_size: 200, @@ -2580,7 +2618,8 @@ refresh_plex: "always", refresh_alist: "always", latest_update_date: "always", - latest_transfer_file: "always" + latest_transfer_file: "always", + today_update_indicator: "always" }; } // 确保最近更新日期配置存在(向后兼容) @@ -2591,6 +2630,10 @@ if (!config_data.button_display.latest_transfer_file) { config_data.button_display.latest_transfer_file = "always"; } + // 确保当日更新图标配置存在(向后兼容) + if (!config_data.button_display.today_update_indicator) { + config_data.button_display.today_update_indicator = "always"; + } // 确保文件整理性能配置存在 if (!config_data.file_performance) { config_data.file_performance = { @@ -4206,6 +4249,79 @@ console.error('获取任务最新信息失败:', error); }); }, + getTaskLatestRecordDisplay(taskName) { + // 获取任务最新记录的显示文本 + const latestRecord = this.taskLatestRecords[taskName]; + return latestRecord ? latestRecord.display : ''; + }, + isTaskUpdatedToday(taskName) { + // 检查任务是否在今天更新 + const latestRecord = this.taskLatestRecords[taskName]; + if (!latestRecord || !latestRecord.full) { + return false; + } + + // 获取今天的完整日期,格式为 YYYY-MM-DD + const today = new Date(); + const todayFormatted = today.getFullYear() + '-' + + String(today.getMonth() + 1).padStart(2, '0') + '-' + + String(today.getDate()).padStart(2, '0'); + + return latestRecord.full === todayFormatted; + }, + isRecordUpdatedToday(record) { + // 检查转存记录是否在今天更新 + if (!record || !record.transfer_time_readable) { + return false; + } + + // 获取今天的日期,格式为 YYYY-MM-DD + const today = new Date(); + const todayFormatted = today.getFullYear() + '-' + + String(today.getMonth() + 1).padStart(2, '0') + '-' + + String(today.getDate()).padStart(2, '0'); + + // 从 transfer_time_readable 中提取日期部分(格式通常为 "YYYY-MM-DD HH:MM:SS") + const recordDate = record.transfer_time_readable.split(' ')[0]; + + return recordDate === todayFormatted; + }, + isFileUpdatedToday(file) { + // 检查文件是否在今天更新(基于修改日期) + if (!file || !file.updated_at) { + return false; + } + + // 获取今天的日期,格式为 YYYY-MM-DD + const today = new Date(); + const todayFormatted = today.getFullYear() + '-' + + String(today.getMonth() + 1).padStart(2, '0') + '-' + + String(today.getDate()).padStart(2, '0'); + + // 使用与 formatDate 方法相同的逻辑处理时间戳 + try { + const fileDate = new Date(file.updated_at); + const fileDateFormatted = fileDate.getFullYear() + '-' + + String(fileDate.getMonth() + 1).padStart(2, '0') + '-' + + String(fileDate.getDate()).padStart(2, '0'); + + return fileDateFormatted === todayFormatted; + } catch (error) { + console.error('处理文件时间戳时出错:', error, file.updated_at); + return false; + } + }, + shouldShowTodayIndicator() { + // 检查是否应该显示当日更新图标 + return this.formData.button_display.today_update_indicator !== 'disabled'; + }, + getTodayIndicatorClass() { + // 获取当日更新图标的CSS类 + if (this.formData.button_display.today_update_indicator === 'hover') { + return 'hover-only'; + } + return ''; + }, openDatePicker(index) { // 使用$refs访问对应的日期选择器并打开它 const dateRef = this.$refs[`enddate_${index}`];