feat: 添加多项功能和修复
功能新增: - OSS 存储使用情况显示(文件页面) - OSS 当日流量统计(阿里云云监控API) - 分享页面路由修复(/s/xxx 格式支持) Bug修复: - 修复分享页面资源路径(相对路径改绝对路径) - 修复分享码获取逻辑(支持路径格式) - 修复OSS配额undefined显示问题 - 修复登录流程OSS配置检查 - 修复文件数为null时的显示问题 依赖更新: - 添加 @alicloud/cms20190101 云监控SDK - 添加 @alicloud/openapi-client Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -300,6 +300,8 @@ createApp({
|
||||
ossUsage: null, // { totalSize, totalSizeFormatted, fileCount, dirCount }
|
||||
ossUsageLoading: false,
|
||||
ossUsageError: null,
|
||||
ossTraffic: null, // 当日流量统计
|
||||
ossTrafficLoading: false,
|
||||
|
||||
// 主题设置
|
||||
currentTheme: 'dark', // 当前生效的主题: 'dark' 或 'light'
|
||||
@@ -683,13 +685,17 @@ handleDragLeave(e) {
|
||||
else {
|
||||
// 如果用户可以使用本地存储,直接进入文件页面
|
||||
if (this.storagePermission === 'local_only' || this.storagePermission === 'user_choice') {
|
||||
this.currentView = 'files';
|
||||
this.currentView = "files";
|
||||
this.loadOssUsage();
|
||||
this.loadOssTraffic(); // 加载当日流量 // 加载OSS使用情况
|
||||
this.loadFiles('/');
|
||||
}
|
||||
// 如果仅OSS模式,需要检查是否配置了OSS(包括系统级统一配置)
|
||||
else if (this.storagePermission === 'oss_only') {
|
||||
if (this.user?.oss_config_source !== 'none') {
|
||||
this.currentView = 'files';
|
||||
this.currentView = "files";
|
||||
this.loadOssUsage();
|
||||
this.loadOssTraffic(); // 加载当日流量 // 加载OSS使用情况
|
||||
this.loadFiles('/');
|
||||
} else {
|
||||
this.currentView = 'settings';
|
||||
@@ -698,7 +704,9 @@ handleDragLeave(e) {
|
||||
}
|
||||
} else {
|
||||
// 默认行为:跳转到文件页面
|
||||
this.currentView = 'files';
|
||||
this.currentView = "files";
|
||||
this.loadOssUsage();
|
||||
this.loadOssTraffic(); // 加载当日流量 // 加载OSS使用情况
|
||||
this.loadFiles('/');
|
||||
}
|
||||
}
|
||||
@@ -2487,11 +2495,30 @@ handleDragLeave(e) {
|
||||
}
|
||||
},
|
||||
|
||||
// 加载 OSS 当日流量统计
|
||||
async loadOssTraffic() {
|
||||
if (this.ossTrafficLoading) return;
|
||||
if (!this.user || this.user?.oss_config_source === "none") return;
|
||||
this.ossTrafficLoading = true;
|
||||
try {
|
||||
const response = await axios.get(`${this.apiBase}/api/oss/traffic`);
|
||||
if (response.data.success) {
|
||||
this.ossTraffic = response.data.traffic;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("[OSS流量] 加载失败:", error);
|
||||
this.ossTraffic = null;
|
||||
} finally {
|
||||
this.ossTrafficLoading = false;
|
||||
}
|
||||
},
|
||||
|
||||
// 刷新存储空间使用统计(根据当前存储类型)
|
||||
async refreshStorageUsage() {
|
||||
if (this.storageType === 'oss' && this.user?.oss_config_source !== 'none') {
|
||||
// 刷新 OSS 空间统计
|
||||
await this.loadOssUsage();
|
||||
this.loadOssTraffic(); // 加载当日流量
|
||||
} else if (this.storageType === 'local') {
|
||||
// 刷新本地存储统计(通过重新获取用户信息)
|
||||
await this.loadUserProfile();
|
||||
@@ -2622,6 +2649,11 @@ handleDragLeave(e) {
|
||||
// 根据视图类型自动加载对应数据
|
||||
switch (view) {
|
||||
case 'files':
|
||||
// 如果是 OSS 存储,加载使用情况
|
||||
if (this.storageType === 'oss') {
|
||||
this.loadOssUsage();
|
||||
this.loadOssTraffic(); // 加载当日流量
|
||||
}
|
||||
// 切换到文件视图时,重新加载文件列表
|
||||
this.loadFiles(this.currentPath);
|
||||
break;
|
||||
@@ -3222,3 +3254,4 @@ handleDragLeave(e) {
|
||||
}
|
||||
}
|
||||
}).mount('#app');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user