fix: 修复前端所有页面的文字溢出问题
修复内容: 1. 文件列表 - 列表视图文件名溢出控制 2. 用户列表 - 用户名和邮箱溢出控制 3. 分享列表 - 文件路径和分享链接溢出控制 所有长文本现在都会正确显示省略号,不会导致UI布局异常 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
19
backend/check_expire.sql
Normal file
19
backend/check_expire.sql
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
SELECT
|
||||||
|
share_code,
|
||||||
|
substr(share_path, 1, 30) as path,
|
||||||
|
created_at,
|
||||||
|
expires_at,
|
||||||
|
datetime('now') as current_time,
|
||||||
|
CASE
|
||||||
|
WHEN expires_at IS NULL THEN '永久有效'
|
||||||
|
WHEN expires_at > datetime('now') THEN '未过期'
|
||||||
|
ELSE '已过期'
|
||||||
|
END as status,
|
||||||
|
CASE
|
||||||
|
WHEN expires_at IS NOT NULL AND expires_at > datetime('now') THEN '通过'
|
||||||
|
WHEN expires_at IS NULL THEN '通过'
|
||||||
|
ELSE '拦截'
|
||||||
|
END as findByCode_result
|
||||||
|
FROM shares
|
||||||
|
ORDER BY created_at DESC
|
||||||
|
LIMIT 10;
|
||||||
27
backend/test_expire.js
Normal file
27
backend/test_expire.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
const { ShareDB } = require('./database');
|
||||||
|
|
||||||
|
// 测试过期验证
|
||||||
|
console.log('=== 测试分享过期验证 ===\n');
|
||||||
|
|
||||||
|
// 获取所有分享
|
||||||
|
const { db } = require('./database');
|
||||||
|
const allShares = db.prepare('SELECT share_code, created_at, expires_at, datetime("now") as current_time FROM shares LIMIT 5').all();
|
||||||
|
|
||||||
|
console.log('数据库中的分享:');
|
||||||
|
allShares.forEach(share => {
|
||||||
|
console.log(`\n分享码: ${share.share_code}`);
|
||||||
|
console.log(`创建时间: ${share.created_at}`);
|
||||||
|
console.log(`到期时间: ${share.expires_at || '永久'}`);
|
||||||
|
console.log(`当前时间: ${share.current_time}`);
|
||||||
|
|
||||||
|
if (share.expires_at) {
|
||||||
|
const isExpired = share.expires_at <= share.current_time;
|
||||||
|
console.log(`是否过期: ${isExpired ? '是' : '否'}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 测试findByCode
|
||||||
|
const found = ShareDB.findByCode(share.share_code);
|
||||||
|
console.log(`findByCode结果: ${found ? '找到' : '未找到(已过滤)'}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('\n=== 测试完成 ===');
|
||||||
@@ -785,7 +785,7 @@
|
|||||||
<i v-else-if="file.name.match(/\.(xls|xlsx)$/i)" class="fas fa-file-excel" style="font-size: 20px; color: #4CAF50;"></i>
|
<i v-else-if="file.name.match(/\.(xls|xlsx)$/i)" class="fas fa-file-excel" style="font-size: 20px; color: #4CAF50;"></i>
|
||||||
<i v-else-if="file.name.match(/\.(zip|rar|7z|tar|gz)$/i)" class="fas fa-file-archive" style="font-size: 20px; color: #795548;"></i>
|
<i v-else-if="file.name.match(/\.(zip|rar|7z|tar|gz)$/i)" class="fas fa-file-archive" style="font-size: 20px; color: #795548;"></i>
|
||||||
<i v-else class="fas fa-file" style="font-size: 20px; color: #9E9E9E;"></i>
|
<i v-else class="fas fa-file" style="font-size: 20px; color: #9E9E9E;"></i>
|
||||||
<span>{{ file.name }}</span>
|
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; display: inline-block;" :title="file.name">{{ file.name }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td style="padding: 10px; color: #666;">{{ file.isDirectory ? '-' : file.sizeFormatted }}</td>
|
<td style="padding: 10px; color: #666;">{{ file.isDirectory ? '-' : file.sizeFormatted }}</td>
|
||||||
<td style="padding: 10px; color: #666;">{{ formatDate(file.modifiedTime) }}</td>
|
<td style="padding: 10px; color: #666;">{{ formatDate(file.modifiedTime) }}</td>
|
||||||
@@ -1330,13 +1330,15 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="u in adminUsers" :key="u.id" style="border-bottom: 1px solid #eee;">
|
<tr v-for="u in adminUsers" :key="u.id" style="border-bottom: 1px solid #eee;">
|
||||||
<td style="padding: 10px;">{{ u.id }}</td>
|
<td style="padding: 10px;">{{ u.id }}</td>
|
||||||
<td style="padding: 10px;">
|
<td style="padding: 10px; max-width: 150px;">
|
||||||
{{ u.username }}
|
<div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" :title="u.username">
|
||||||
<span v-if="u.is_admin" style="color: #28a745; margin-left: 5px;" title="管理员">
|
<span>{{ u.username }}</span>
|
||||||
|
<span v-if="u.is_admin" style="color: #28a745; margin-left: 5px; white-space: nowrap;" title="管理员">
|
||||||
<i class="fas fa-crown"></i>
|
<i class="fas fa-crown"></i>
|
||||||
</span>
|
</span>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td style="padding: 10px; font-size: 12px; color: #666;">{{ u.email }}</td>
|
<td style="padding: 10px; font-size: 12px; color: #666; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" :title="u.email">{{ u.email }}</td>
|
||||||
<td style="padding: 10px; text-align: center; font-size: 12px;">
|
<td style="padding: 10px; text-align: center; font-size: 12px;">
|
||||||
<span v-if="u.storage_permission === 'local_only'" style="background: #667eea; color: white; padding: 3px 8px; border-radius: 4px;">仅本地</span>
|
<span v-if="u.storage_permission === 'local_only'" style="background: #667eea; color: white; padding: 3px 8px; border-radius: 4px;">仅本地</span>
|
||||||
<span v-else-if="u.storage_permission === 'sftp_only'" style="background: #6c757d; color: white; padding: 3px 8px; border-radius: 4px;">仅SFTP</span>
|
<span v-else-if="u.storage_permission === 'sftp_only'" style="background: #6c757d; color: white; padding: 3px 8px; border-radius: 4px;">仅SFTP</span>
|
||||||
@@ -1604,7 +1606,7 @@
|
|||||||
<i v-else-if="file.name.match(/\.(xls|xlsx)$/i)" class="fas fa-file-excel" style="font-size: 20px; color: #4CAF50;"></i>
|
<i v-else-if="file.name.match(/\.(xls|xlsx)$/i)" class="fas fa-file-excel" style="font-size: 20px; color: #4CAF50;"></i>
|
||||||
<i v-else-if="file.name.match(/\.(zip|rar|7z|tar|gz)$/i)" class="fas fa-file-archive" style="font-size: 20px; color: #795548;"></i>
|
<i v-else-if="file.name.match(/\.(zip|rar|7z|tar|gz)$/i)" class="fas fa-file-archive" style="font-size: 20px; color: #795548;"></i>
|
||||||
<i v-else class="fas fa-file" style="font-size: 20px; color: #9E9E9E;"></i>
|
<i v-else class="fas fa-file" style="font-size: 20px; color: #9E9E9E;"></i>
|
||||||
<span>{{ file.name }}</span>
|
<span style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; display: inline-block;" :title="file.name">{{ file.name }}</span>
|
||||||
</td>
|
</td>
|
||||||
<td style="padding: 10px; color: #666;">{{ file.isDirectory ? '-' : file.sizeFormatted }}</td>
|
<td style="padding: 10px; color: #666;">{{ file.isDirectory ? '-' : file.sizeFormatted }}</td>
|
||||||
<td style="padding: 10px; color: #666;">{{ formatDate(file.modifiedAt) }}</td>
|
<td style="padding: 10px; color: #666;">{{ formatDate(file.modifiedAt) }}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user