优化设置页面
This commit is contained in:
parent
f4a548f2a2
commit
fe837d2f6d
@ -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'))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user