ui: show file names instead of full paths in shares
This commit is contained in:
@@ -2985,7 +2985,7 @@
|
|||||||
<div v-for="share in filteredShares" :key="share.id" class="share-card">
|
<div v-for="share in filteredShares" :key="share.id" class="share-card">
|
||||||
<div class="share-card__title">
|
<div class="share-card__title">
|
||||||
<i class="fas" :class="getShareTypeIcon(share)" style="color: var(--accent-1);"></i>
|
<i class="fas" :class="getShareTypeIcon(share)" style="color: var(--accent-1);"></i>
|
||||||
<span :title="share.share_path">{{ share.share_path }}</span>
|
<span :title="share.share_path">{{ getPathBaseName(share.share_path) }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="share-card__chips">
|
<div class="share-card__chips">
|
||||||
<span :class="['share-chip', getShareStatus(share).class]">
|
<span :class="['share-chip', getShareStatus(share).class]">
|
||||||
@@ -3032,7 +3032,7 @@
|
|||||||
<table v-else class="share-list-table">
|
<table v-else class="share-list-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr style="border-bottom: 2px solid #ddd;">
|
<tr style="border-bottom: 2px solid #ddd;">
|
||||||
<th style="padding: 10px; text-align: left; width: 18%;">文件路径</th>
|
<th style="padding: 10px; text-align: left; width: 18%;">文件名</th>
|
||||||
<th style="padding: 10px; text-align: left; width: 30%;">链接地址</th>
|
<th style="padding: 10px; text-align: left; width: 30%;">链接地址</th>
|
||||||
<th style="padding: 10px; text-align: center; width: 8%;">访问次数</th>
|
<th style="padding: 10px; text-align: center; width: 8%;">访问次数</th>
|
||||||
<th style="padding: 10px; text-align: center; width: 8%;">下载次数</th>
|
<th style="padding: 10px; text-align: center; width: 8%;">下载次数</th>
|
||||||
@@ -3042,7 +3042,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="share in filteredShares" :key="share.id" style="border-bottom: 1px solid #eee;">
|
<tr v-for="share in filteredShares" :key="share.id" style="border-bottom: 1px solid #eee;">
|
||||||
<td style="padding: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" :title="share.share_path">{{ share.share_path }}</td>
|
<td style="padding: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" :title="share.share_path">{{ getPathBaseName(share.share_path) }}</td>
|
||||||
<td style="padding: 10px; overflow: hidden;">
|
<td style="padding: 10px; overflow: hidden;">
|
||||||
<span class="share-list-link-text" :title="share.share_url">{{ share.share_url }}</span>
|
<span class="share-list-link-text" :title="share.share_url">{{ share.share_url }}</span>
|
||||||
</td>
|
</td>
|
||||||
@@ -3090,7 +3090,7 @@
|
|||||||
<table v-else class="share-list-table">
|
<table v-else class="share-list-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr style="border-bottom: 2px solid #ddd;">
|
<tr style="border-bottom: 2px solid #ddd;">
|
||||||
<th style="padding: 10px; text-align: left; width: 18%;">文件路径</th>
|
<th style="padding: 10px; text-align: left; width: 18%;">文件名</th>
|
||||||
<th style="padding: 10px; text-align: left; width: 30%;">链接地址</th>
|
<th style="padding: 10px; text-align: left; width: 30%;">链接地址</th>
|
||||||
<th style="padding: 10px; text-align: center; width: 8%;">访问次数</th>
|
<th style="padding: 10px; text-align: center; width: 8%;">访问次数</th>
|
||||||
<th style="padding: 10px; text-align: center; width: 8%;">下载次数</th>
|
<th style="padding: 10px; text-align: center; width: 8%;">下载次数</th>
|
||||||
@@ -3100,7 +3100,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="link in filteredDirectLinks" :key="`direct-${link.id}`" style="border-bottom: 1px solid #eee;">
|
<tr v-for="link in filteredDirectLinks" :key="`direct-${link.id}`" style="border-bottom: 1px solid #eee;">
|
||||||
<td style="padding: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" :title="link.file_path">{{ link.file_path }}</td>
|
<td style="padding: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" :title="link.file_path">{{ getPathBaseName(link.file_path, link.file_name) }}</td>
|
||||||
<td style="padding: 10px; overflow: hidden;">
|
<td style="padding: 10px; overflow: hidden;">
|
||||||
<span class="share-list-link-text" :title="link.direct_url">{{ link.direct_url }}</span>
|
<span class="share-list-link-text" :title="link.direct_url">{{ link.direct_url }}</span>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -2702,6 +2702,20 @@ handleDragLeave(e) {
|
|||||||
return normalized.startsWith('/') ? normalized : `/${normalized}`;
|
return normalized.startsWith('/') ? normalized : `/${normalized}`;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getPathBaseName(pathValue, preferredName = '') {
|
||||||
|
if (typeof preferredName === 'string' && preferredName.trim()) {
|
||||||
|
return preferredName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
const normalized = this.normalizeSharePath(pathValue || '/');
|
||||||
|
if (normalized === '/') {
|
||||||
|
return '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
const segments = normalized.split('/').filter(Boolean);
|
||||||
|
return segments.length > 0 ? segments[segments.length - 1] : '/';
|
||||||
|
},
|
||||||
|
|
||||||
isShareAllFiles(share) {
|
isShareAllFiles(share) {
|
||||||
if (!share) return false;
|
if (!share) return false;
|
||||||
const shareType = share.share_type || 'file';
|
const shareType = share.share_type || 'file';
|
||||||
|
|||||||
Reference in New Issue
Block a user