💄 优化存储配置提示逻辑

前端优化:
- 新增 profileInitialized 标志,避免首次加载时显示误导性提示
- 新增 suppressStorageToast 标志,用户主动切换后不显示配置同步提示
- 首次加载时只同步存储配置,不弹出提示
- 用户主动切换存储方式后,下一次配置同步不提示"管理员已修改"

用户体验改进:
- 避免用户刚登录就看到"管理员已更改存储方式"的误导提示
- 区分用户主动操作和管理员修改操作
- 减少不必要的提示干扰

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-24 20:59:20 +08:00
parent 382aee8e61
commit 1c8eded07e

View File

@@ -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);
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存储'}`);
// 重新加载文件列表