diff --git a/frontend/app.js b/frontend/app.js index 27da683..5b1e7e1 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -212,6 +212,8 @@ createApp({ // 存储切换状态 storageSwitching: false, storageSwitchTarget: null, + suppressStorageToast: false, + profileInitialized: false, // SFTP配置引导弹窗 showSftpGuideModal: false, @@ -1786,12 +1788,22 @@ handleDragLeave(e) { this.storagePermission = newStoragePermission; this.storageType = newStorageType; + // 首次加载仅同步,不提示 + if (!this.profileInitialized) { + this.profileInitialized = true; + return; + } + // 如果存储类型被管理员更改,通知用户并重新加载文件 if (oldStorageType !== newStorageType || oldStoragePermission !== newStoragePermission) { console.log('[存储配置更新] 旧类型:', oldStorageType, '新类型:', newStorageType); console.log('[存储配置更新] 旧权限:', oldStoragePermission, '新权限:', newStoragePermission); - this.showToast('info', '存储配置已更新', `管理员已将您的存储方式更改为${newStorageType === 'local' ? '本地存储' : 'SFTP存储'}`); + if (!this.suppressStorageToast) { + this.showToast('info', '存储配置已更新', `管理员已将您的存储方式更改为${newStorageType === 'local' ? '本地存储' : 'SFTP存储'}`); + } else { + this.suppressStorageToast = false; + } // 如果当前在文件页面,重新加载文件列表 if (this.currentView === 'files') { @@ -1853,6 +1865,8 @@ handleDragLeave(e) { if (response.data.success) { this.storageType = type; + // 用户主动切换后,下一次配置同步不提示管理员修改 + this.suppressStorageToast = true; this.showToast('success', '成功', `已切换到${type === 'local' ? '本地存储' : 'SFTP存储'}`); // 重新加载文件列表