更新设置相关组件:优化错误提示信息,增强用户反馈

This commit is contained in:
jxxghp
2025-01-09 12:29:45 +08:00
parent bfb4ea4123
commit e8ede6e606
3 changed files with 10 additions and 6 deletions
@@ -34,7 +34,7 @@ async function saveHandle() {
if (result.success) { if (result.success) {
$toast.success('插件仓库保存成功') $toast.success('插件仓库保存成功')
emit('save') emit('save')
} else $toast.error('插件仓库保存失败') } else $toast.error(`插件仓库保存失败${result?.message}`)
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
+6 -1
View File
@@ -133,6 +133,11 @@ async function saveSearchSetting() {
selectedMediaSource.value.join(','), selectedMediaSource.value.join(','),
) )
if (!result1 || !result1.success) {
$toast.error(`媒体搜索数据源保存失败:${result1?.message}`)
return
}
const result2: { [key: string]: any } = await api.post( const result2: { [key: string]: any } = await api.post(
'system/setting/SearchFilterRuleGroups', 'system/setting/SearchFilterRuleGroups',
selectedFilterGroup.value, selectedFilterGroup.value,
@@ -140,7 +145,7 @@ async function saveSearchSetting() {
const result3 = await saveSystemSetting(SystemSettings.value.Basic) const result3 = await saveSystemSetting(SystemSettings.value.Basic)
if (result1.success && result2.success && result3) { if (result2.success && result3) {
$toast.success('搜索基础设置保存成功') $toast.success('搜索基础设置保存成功')
} else { } else {
$toast.error('搜索基础设置保存失败!') $toast.error('搜索基础设置保存失败!')
+3 -4
View File
@@ -177,6 +177,9 @@ async function saveSystemSetting(value: { [key: string]: any }) {
const result: { [key: string]: any } = await api.post('system/env', value) const result: { [key: string]: any } = await api.post('system/env', value)
if (result.success) { if (result.success) {
return true return true
} else {
$toast.error(`设置保存失败:${result?.message}`)
return false
} }
} catch (error) { } catch (error) {
console.log(error) console.log(error)
@@ -189,8 +192,6 @@ async function saveBasicSettings() {
if (await saveSystemSetting(SystemSettings.value.Basic)) { if (await saveSystemSetting(SystemSettings.value.Basic)) {
$toast.success('基础设置保存成功') $toast.success('基础设置保存成功')
await reloadSystem() await reloadSystem()
} else {
$toast.error('基础设置保存失败!')
} }
} }
@@ -202,8 +203,6 @@ async function saveAdvancedSettings() {
advancedDialog.value = false advancedDialog.value = false
$toast.success('高级设置保存成功') $toast.success('高级设置保存成功')
await reloadSystem() await reloadSystem()
} else {
$toast.error('高级设置保存失败!')
} }
} }