优化设置页面

This commit is contained in:
jingrow 2025-11-02 01:01:37 +08:00
parent f4a548f2a2
commit fe837d2f6d

View File

@ -6,7 +6,7 @@
<h1 class="page-title">{{ t('Settings') }}</h1>
</div>
<n-space v-if="isAdmin">
<n-button type="default" @click="loadEnvironmentConfig" :loading="envConfigLoading">
<n-button type="default" @click="() => loadEnvironmentConfig()" :loading="envConfigLoading">
<template #icon>
<n-icon><Icon icon="tabler:refresh" /></n-icon>
</template>
@ -326,7 +326,7 @@ const saveSystemSettings = () => {
}
//
const loadEnvironmentConfig = async () => {
const loadEnvironmentConfig = async (showMessage = true) => {
if (!isAdmin.value) {
return
}
@ -336,12 +336,18 @@ const loadEnvironmentConfig = async () => {
const result = await getEnvironmentConfig()
if (result.success && result.data) {
Object.assign(envConfig, result.data)
message.success(t('Environment configuration loaded'))
if (showMessage) {
message.success(t('Environment configuration loaded'))
}
} else {
message.error(result.message || t('Failed to load environment configuration'))
if (showMessage) {
message.error(result.message || t('Failed to load environment configuration'))
}
}
} catch (error: any) {
message.error(error.message || t('Failed to load environment configuration'))
if (showMessage) {
message.error(error.message || t('Failed to load environment configuration'))
}
} finally {
envConfigLoading.value = false
}
@ -359,8 +365,8 @@ const saveEnvironmentConfig = async () => {
const result = await updateEnvironmentConfig(envConfig)
if (result.success) {
message.success(result.message || t('Environment configuration saved'))
//
await loadEnvironmentConfig()
//
await loadEnvironmentConfig(false)
} else {
message.error(result.message || t('Failed to save environment configuration'))
}