diff --git a/frontend/app.html b/frontend/app.html index e324bfd..eeea275 100644 --- a/frontend/app.html +++ b/frontend/app.html @@ -1104,17 +1104,85 @@ + + + + @@ -1235,6 +1303,11 @@ {{ user?.has_ftp_config ? '切到 SFTP 存储' : '去配置 SFTP' }} +
+ + 配置 / 修改 SFTP + +
@@ -1307,62 +1380,31 @@ - -
-

SFTP配置

-
- 请配置SFTP服务器 -
- - -
-
- -

- 快速导入配置文件 -

-

- 点击选择或拖拽 .inf 文件到此处 -

-

- 导入后请检查配置信息并点击保存按钮 -

- + +
+

+ SFTP存储 +

+
+
+
+
+ + 仅 SFTP 模式 +
+
+ {{ user.has_ftp_config ? '已配置服务器,可正常使用 SFTP 存储。' : '还未配置 SFTP,请先填写连接信息。' }} +
+
+ +
+
+ + 数据存储在你的 SFTP 服务器上,如需切换回本地请联系管理员调整权限。
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - - - 配置后可直接通过HTTP下载文件。URL格式: 基础URL/文件路径,例如: http://example.com/files/test.exe - -
- -
diff --git a/frontend/app.js b/frontend/app.js index 08dd875..11b4aad 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -209,15 +209,13 @@ createApp({ checkingUploadTool: false, // 是否正在检测上传工具 uploadingTool: false, // 是否正在上传工具 - // 强制显示SFTP配置(用于本地存储模式下临时显示SFTP配置) - forceSftpConfigVisible: false, - // 存储切换状态 storageSwitching: false, storageSwitchTarget: null, // SFTP配置引导弹窗 - showSftpGuideModal: false + showSftpGuideModal: false, + showSftpConfigModal: false }; }, @@ -399,6 +397,7 @@ handleDragLeave(e) { } else { this.currentView = 'settings'; alert('欢迎!请先配置您的SFTP服务器'); + this.openSftpConfigModal(); } } else { // 默认行为:跳转到文件页面 @@ -530,8 +529,8 @@ handleDragLeave(e) { } } - // 重置强制显示标志 - this.forceSftpConfigVisible = false; + // 关闭配置弹窗 + this.showSftpConfigModal = false; // 刷新到文件页面 this.currentView = 'files'; @@ -1819,29 +1818,6 @@ handleDragLeave(e) { // 用户切换存储方式 async switchStorage(type) { - // 检查是否尝试切换到SFTP但未配置 - if (type === 'sftp' && !this.user.has_ftp_config) { - const goToSettings = confirm('您还未配置SFTP服务器。\n\n是否现在前往设置页面进行配置?配置完成后将自动切换到SFTP存储。'); - if (goToSettings) { - // 直接设置视图并加载配置,避免switchView的重复检查 - this.currentView = 'settings'; - // 强制显示SFTP配置区域 - this.forceSftpConfigVisible = true; - // 如果是普通用户,手动加载SFTP配置 - if (this.user && !this.user.is_admin) { - this.loadFtpConfig(); - } - // 等待DOM更新后滚动到SFTP配置区域 - this.$nextTick(() => { - const sftpSection = document.getElementById('sftp-config-section'); - if (sftpSection) { - sftpSection.scrollIntoView({ behavior: 'smooth', block: 'start' }); - } - }); - } - return; - } - if (this.storageSwitching || type === this.storageType) { return; } @@ -1881,17 +1857,7 @@ handleDragLeave(e) { }, ensureSftpConfigSection() { - this.currentView = 'settings'; - this.forceSftpConfigVisible = true; - if (this.user && !this.user.is_admin) { - this.loadFtpConfig(); - } - this.$nextTick(() => { - const sftpSection = document.getElementById('sftp-config-section'); - if (sftpSection) { - sftpSection.scrollIntoView({ behavior: 'smooth', block: 'start' }); - } - }); + this.openSftpConfigModal(); }, openSftpGuideModal() { @@ -1907,6 +1873,18 @@ handleDragLeave(e) { this.ensureSftpConfigSection(); }, + openSftpConfigModal() { + this.showSftpGuideModal = false; + this.showSftpConfigModal = true; + if (this.user && !this.user.is_admin) { + this.loadFtpConfig(); + } + }, + + closeSftpConfigModal() { + this.showSftpConfigModal = false; + }, + // 切换视图并自动刷新数据 switchView(view) { // 如果已经在当前视图,不重复刷新 @@ -1916,11 +1894,6 @@ handleDragLeave(e) { this.currentView = view; - // 离开settings页面时,重置强制显示SFTP配置的标志 - if (this.currentView !== 'settings') { - this.forceSftpConfigVisible = false; - } - // 根据视图类型自动加载对应数据 switch (view) { case 'files':