feat: 优化文件表格样式,添加响应式布局和操作按钮文本

This commit is contained in:
2025-11-09 23:30:55 +08:00
parent 94b017eeec
commit 4a76292a27
2 changed files with 127 additions and 20 deletions

View File

@@ -28,8 +28,6 @@
body { body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 20px; padding: 20px;
background-color: var(--bg-color); background-color: var(--bg-color);
color: var(--text-color); color: var(--text-color);
@@ -41,6 +39,9 @@ body {
border-radius: 8px; border-radius: 8px;
box-shadow: 0 2px 4px var(--shadow-color); box-shadow: 0 2px 4px var(--shadow-color);
padding: 20px; padding: 20px;
width: calc(100% - 40px);
max-width: 1200px;
margin: 0 auto;
} }
h1 { h1 {
@@ -637,6 +638,20 @@ video.preview-content {
font-size: 12px; font-size: 12px;
padding: 15px; padding: 15px;
} }
.files-table .action-text {
display: none;
}
.files-table .action-link {
padding: 6px;
font-size: 1.1em;
}
.files-table td,
.files-table th {
padding: 8px 4px;
}
} }
/* 上传进度提示 */ /* 上传进度提示 */
@@ -819,3 +834,95 @@ video.preview-content {
.grid-action-btn.rename:hover { .grid-action-btn.rename:hover {
color: var(--warning-hover-color, #e0a800); color: var(--warning-hover-color, #e0a800);
} }
.file-name-col {
width: auto;
max-width: 300px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.file-name-col a {
display: inline-block;
max-width: calc(100% - 30px);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: middle;
}
.file-size-col {
width: 100px;
min-width: 100px;
white-space: nowrap;
}
.last-modified-col {
width: 180px;
min-width: 180px;
white-space: nowrap;
}
.actions-col {
width: auto;
white-space: nowrap;
text-align: right;
}
.actions-col > * {
display: inline-flex;
align-items: center;
gap: 4px;
margin-left: 4px;
}
}
@media (max-width: 1200px) {
.files-table .action-text {
display: none;
}
.files-table .action-link {
padding: 6px 8px;
}
}
@media (max-width: 992px) {
.last-modified-col {
display: none;
}
.file-name-col {
width: 60%;
}
.file-size-col {
width: 20%;
}
.actions-col {
width: 20%;
}
}
@media (max-width: 768px) {
.file-size-col {
display: none;
}
.file-name-col {
width: 70%;
}
.actions-col {
width: 30%;
}
.files-table .action-text {
display: none;
}
.files-table .action-link {
padding: 6px;
font-size: 1.1em;
}
.files-table td,
.files-table th {
padding: 8px 4px;
}
}

View File

@@ -59,10 +59,10 @@ current_prefix }}"{% endblock %} {% block content %}
<th class="checkbox-col"> <th class="checkbox-col">
<input type="checkbox" id="selectAll" aria-label="全选" /> <input type="checkbox" id="selectAll" aria-label="全选" />
</th> </th>
<th>名称</th> <th class="file-name-col">名称</th>
<th>大小</th> <th class="file-size-col">大小</th>
<th>最后修改时间</th> <th class="last-modified-col">最后修改时间</th>
<th>操作</th> <th class="actions-col">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -77,7 +77,7 @@ current_prefix }}"{% endblock %} {% block content %}
aria-label="选择 {{ entry.name }}" aria-label="选择 {{ entry.name }}"
/> />
</td> </td>
<td> <td class="file-name-col">
{% if entry.is_dir %} {% if entry.is_dir %}
<i class="file-icon folder fas fa-folder"></i> <i class="file-icon folder fas fa-folder"></i>
<a href="/{{ entry.key.rstrip('/') }}">{{ entry.name }}</a> <a href="/{{ entry.key.rstrip('/') }}">{{ entry.name }}</a>
@@ -86,54 +86,54 @@ current_prefix }}"{% endblock %} {% block content %}
<a href="{{ entry.file_url }}" target="_blank">{{ entry.name }}</a> <a href="{{ entry.file_url }}" target="_blank">{{ entry.name }}</a>
{% endif %} {% endif %}
</td> </td>
<td class="file-size"> <td class="file-size-col file-size">
{% if not entry.is_dir %} {{ entry.size|filesizeformat }} {% else %} - {% endif %} {% if not entry.is_dir %} {{ entry.size|filesizeformat }} {% else %} - {% endif %}
</td> </td>
<td class="last-modified"> <td class="last-modified-col last-modified">
{% if not entry.is_dir %} {{ entry.last_modified }} {% else %} - {% endif %} {% if not entry.is_dir %} {{ entry.last_modified }} {% else %} - {% endif %}
</td> </td>
<td> <td class="actions-col">
{% if entry.is_dir %} {% if entry.is_dir %}
<button <button
class="action-link rename-btn" class="action-link rename-btn"
onclick="promptRename('{{ entry.key }}', '{{ entry.name }}', true)" onclick="promptRename('{{ entry.key }}', '{{ entry.name }}', true)"
> >
<i class="fas fa-edit"></i> 重命名 <i class="fas fa-edit"></i><span class="action-text"> 重命名</span>
</button> </button>
<button class="action-link delete-btn" onclick="deleteFolder('{{ entry.key }}')"> <button class="action-link delete-btn" onclick="deleteFolder('{{ entry.key }}')">
<i class="fas fa-trash"></i> 删除 <i class="fas fa-trash"></i><span class="action-text"> 删除</span>
</button> </button>
<button class="action-link copy-btn" onclick="promptCopyOrMove('{{ entry.key }}', true, 'copy')"> <button class="action-link copy-btn" onclick="promptCopyOrMove('{{ entry.key }}', true, 'copy')">
<i class="fas fa-copy"></i> 复制 <i class="fas fa-copy"></i><span class="action-text"> 复制</span>
</button> </button>
<button class="action-link move-btn" onclick="promptCopyOrMove('{{ entry.key }}', true, 'move')"> <button class="action-link move-btn" onclick="promptCopyOrMove('{{ entry.key }}', true, 'move')">
<i class="fas fa-arrows-alt-h"></i> 移动 <i class="fas fa-arrows-alt-h"></i><span class="action-text"> 移动</span>
</button> </button>
{% else %} {% else %}
<button class="action-link" onclick="openPreview('{{ entry.file_url }}', '{{ entry.name }}')"> <button class="action-link" onclick="openPreview('{{ entry.file_url }}', '{{ entry.name }}')">
<i class="fas fa-eye"></i> 预览 <i class="fas fa-eye"></i><span class="action-text"> 预览</span>
</button> </button>
<button <button
class="action-link download-btn" class="action-link download-btn"
data-download-key="{{ entry.key }}" data-download-key="{{ entry.key }}"
data-download-name="{{ entry.name }}" data-download-name="{{ entry.name }}"
> >
<i class="fas fa-download"></i> 下载 <i class="fas fa-download"></i><span class="action-text"> 下载</span>
</button> </button>
<button class="action-link delete-btn" onclick="deleteFile('{{ entry.key }}')"> <button class="action-link delete-btn" onclick="deleteFile('{{ entry.key }}')">
<i class="fas fa-trash"></i> 删除 <i class="fas fa-trash"></i><span class="action-text"> 删除</span>
</button> </button>
<button <button
class="action-link rename-btn" class="action-link rename-btn"
onclick="promptRename('{{ entry.key }}', '{{ entry.name }}')" onclick="promptRename('{{ entry.key }}', '{{ entry.name }}')"
> >
<i class="fas fa-edit"></i> 重命名 <i class="fas fa-edit"></i><span class="action-text"> 重命名</span>
</button> </button>
<button class="action-link copy-btn" onclick="promptCopyOrMove('{{ entry.key }}', false, 'copy')"> <button class="action-link copy-btn" onclick="promptCopyOrMove('{{ entry.key }}', false, 'copy')">
<i class="fas fa-copy"></i> 复制 <i class="fas fa-copy"></i><span class="action-text"> 复制</span>
</button> </button>
<button class="action-link move-btn" onclick="promptCopyOrMove('{{ entry.key }}', false, 'move')"> <button class="action-link move-btn" onclick="promptCopyOrMove('{{ entry.key }}', false, 'move')">
<i class="fas fa-arrows-alt-h"></i> 移动 <i class="fas fa-arrows-alt-h"></i><span class="action-text"> 移动</span>
</button> </button>
{% endif %} {% endif %}
</td> </td>