feat: 目录选择后自动保存配置到数据库

This commit is contained in:
2025-09-10 21:17:10 +08:00
parent dd2bb8fd50
commit 5b95f778c9
3 changed files with 45 additions and 2 deletions
+13 -2
View File
@@ -466,8 +466,8 @@ export default {
this.dirLoading = false
}
},
// 点"选中此目录":把选中的目录填到对应的输入框里
confirmDir() {
// 点"选中此目录":把选中的目录填到对应的输入框里,并保存配置
async confirmDir() {
if (!this.fsData.current) return
if (this.pickerTarget === 'dest') {
this.destDir = this.fsData.current
@@ -475,6 +475,17 @@ export default {
this.scanDir = this.fsData.current
}
this.dirPickerVisible = false
// 保存目录配置到数据库
try {
await request.put('/api/config/scan-dir', {
scanDir: this.scanDir.trim(),
destDir: this.destDir.trim()
})
} catch (e) {
// 保存失败不影响使用,只是下次进来不会自动回填
console.warn('保存目录配置失败', e)
}
},
// ==================== 小工具 ====================