-
-
我的分享
-
+
+
+
+ + 我的分享 +
+
+
+
+
+
+
+
+
还没有创建任何分享
+
+ 没有符合筛选条件的分享,试试清空搜索/筛选。
+
-
-
-
-
+
+
+
+
+ {{ share.share_path }}
- {{ share.share_path }}
-
- 访问: {{ share.view_count }} | 下载: {{ share.download_count }}
+
+
{{ share.share_path }}
{{ share.share_url }}
diff --git a/frontend/app.js b/frontend/app.js
index d27399f..990acf4 100644
--- a/frontend/app.js
+++ b/frontend/app.js
@@ -89,6 +89,12 @@ createApp({
customDays: 7
},
shareResult: null,
+ shareFilters: {
+ keyword: '',
+ type: 'all', // all/file/directory/all_files
+ status: 'all', // all/active/expiring/expired/protected/public
+ sort: 'created_desc' // created_desc/created_asc/views_desc/downloads_desc/expire_asc
+ },
// 文件重命名
showRenameModal: false,
@@ -304,6 +310,56 @@ createApp({
// 存储类型显示文本
storageTypeText() {
return this.storageType === 'local' ? '本地存储' : 'SFTP存储';
+ },
+
+ // 分享筛选+排序后的列表
+ filteredShares() {
+ let list = [...this.shares];
+ const keyword = this.shareFilters.keyword.trim().toLowerCase();
+
+ if (keyword) {
+ list = list.filter(s =>
+ (s.share_path || '').toLowerCase().includes(keyword) ||
+ (s.share_code || '').toLowerCase().includes(keyword) ||
+ (s.share_url || '').toLowerCase().includes(keyword)
+ );
+ }
+
+ if (this.shareFilters.type !== 'all') {
+ const targetType = this.shareFilters.type === 'all_files' ? 'all' : this.shareFilters.type;
+ list = list.filter(s => (s.share_type || 'file') === targetType);
+ }
+
+ if (this.shareFilters.status !== 'all') {
+ list = list.filter(s => {
+ if (this.shareFilters.status === 'expired') return this.isExpired(s.expires_at);
+ if (this.shareFilters.status === 'expiring') return this.isExpiringSoon(s.expires_at) && !this.isExpired(s.expires_at);
+ if (this.shareFilters.status === 'active') return !this.isExpired(s.expires_at);
+ if (this.shareFilters.status === 'protected') return !!s.share_password;
+ if (this.shareFilters.status === 'public') return !s.share_password;
+ return true;
+ });
+ }
+
+ list.sort((a, b) => {
+ const getTime = s => s.created_at ? new Date(s.created_at).getTime() : 0;
+ const getExpire = s => s.expires_at ? new Date(s.expires_at).getTime() : Number.MAX_SAFE_INTEGER;
+
+ switch (this.shareFilters.sort) {
+ case 'created_asc':
+ return getTime(a) - getTime(b);
+ case 'views_desc':
+ return (b.view_count || 0) - (a.view_count || 0);
+ case 'downloads_desc':
+ return (b.download_count || 0) - (a.download_count || 0);
+ case 'expire_asc':
+ return getExpire(a) - getExpire(b);
+ default:
+ return getTime(b) - getTime(a); // created_desc
+ }
+ });
+
+ return list;
}
},
@@ -1916,6 +1972,49 @@ handleDragLeave(e) {
return expireDate <= now;
},
+ // 分享类型标签
+ getShareTypeLabel(type) {
+ switch (type) {
+ case 'directory': return '文件夹';
+ case 'all': return '全部文件';
+ case 'file':
+ default: return '文件';
+ }
+ },
+
+ // 分享状态标签
+ getShareStatus(share) {
+ if (this.isExpired(share.expires_at)) {
+ return { text: '已过期', class: 'danger', icon: 'fa-clock' };
+ }
+ if (this.isExpiringSoon(share.expires_at)) {
+ return { text: '即将到期', class: 'warn', icon: 'fa-hourglass-half' };
+ }
+ return { text: '有效', class: 'success', icon: 'fa-check-circle' };
+ },
+
+ // 分享保护标签
+ getShareProtection(share) {
+ if (share.share_password) {
+ return { text: '已加密', class: 'info', icon: 'fa-lock' };
+ }
+ return { text: '公开', class: 'info', icon: 'fa-unlock' };
+ },
+
+ // 存储来源
+ getStorageLabel(storageType) {
+ if (!storageType) return '默认';
+ return storageType === 'local' ? '本地存储' : storageType.toUpperCase();
+ },
+
+ // 格式化时间
+ formatDateTime(value) {
+ if (!value) return '--';
+ const d = new Date(value);
+ if (Number.isNaN(d.getTime())) return value;
+ return d.toLocaleString();
+ },
+
copyShareLink(url) {
// 复制分享链接到剪贴板
if (navigator.clipboard && navigator.clipboard.writeText) {
+
+ {{ getShareStatus(share).text }}
+
+
+ {{ getShareTypeLabel(share.share_type) }}
+
+
+ {{ getShareProtection(share).text }}
+
+
+ {{ getStorageLabel(share.storage_type) }}
+
+
+ {{ share.share_code }}
+
-
-
@@ -1977,7 +2142,7 @@
-