feat: 实现后台管理前端全部页面与登录布局
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<n-card :title="t('menu.settings')" :bordered="false" style="max-width: 640px">
|
||||
<n-form label-placement="top">
|
||||
<n-form-item :label="t('pages.settings.appName')">
|
||||
<n-input v-model:value="form.appName" />
|
||||
</n-form-item>
|
||||
<n-form-item :label="t('pages.settings.logRetentionDays')">
|
||||
<n-input-number v-model:value="form.logRetentionDays" :min="1" style="width: 220px" />
|
||||
</n-form-item>
|
||||
<n-form-item :label="t('pages.settings.watermarkText')">
|
||||
<n-input v-model:value="form.watermarkText" />
|
||||
</n-form-item>
|
||||
<n-button type="primary" :loading="saving" @click="save">{{ t('common.action.save') }}</n-button>
|
||||
</n-form>
|
||||
</n-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { settingsApi } from '@/api';
|
||||
import { message } from '@/utils/feedback';
|
||||
|
||||
const { t } = useI18n();
|
||||
const saving = ref(false);
|
||||
const form = reactive<{ appName: string; logRetentionDays: number; watermarkText: string }>({
|
||||
appName: '',
|
||||
logRetentionDays: 365,
|
||||
watermarkText: '',
|
||||
});
|
||||
|
||||
async function load() {
|
||||
const s = await settingsApi.getAll();
|
||||
form.appName = s.appName || '';
|
||||
form.logRetentionDays = Number(s.logRetentionDays || 365);
|
||||
form.watermarkText = s.watermarkText || '';
|
||||
}
|
||||
async function save() {
|
||||
saving.value = true;
|
||||
try {
|
||||
await settingsApi.update({
|
||||
appName: form.appName,
|
||||
logRetentionDays: String(form.logRetentionDays),
|
||||
watermarkText: form.watermarkText,
|
||||
});
|
||||
message.success(t('pages.settings.saved'));
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
}
|
||||
onMounted(load);
|
||||
</script>
|
||||
Reference in New Issue
Block a user