feat: 目录选择后自动保存配置到数据库
This commit is contained in:
@@ -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)
|
||||
}
|
||||
},
|
||||
|
||||
// ==================== 小工具 ====================
|
||||
|
||||
Reference in New Issue
Block a user