feat: 支持后台配置备案信息

This commit is contained in:
Nixevol
2026-07-05 00:16:47 +08:00
parent b39db6ec01
commit c56ca91edd
10 changed files with 54 additions and 4 deletions
+3 -1
View File
@@ -48,7 +48,7 @@
<n-layout-footer bordered class="footer">
<span>© 2026 {{ appName }}</span>
<span>备案信息待补充</span>
<span v-if="filingInfo">{{ filingInfo }}</span>
</n-layout-footer>
</n-layout>
</n-layout>
@@ -86,6 +86,7 @@ const auth = useAuthStore();
const collapsed = ref(window.innerWidth < 900);
const appName = ref(t('pages.login.title'));
const filingInfo = ref('');
function renderIcon(icon: unknown) {
return () => h(NIcon, null, { default: () => h(icon as never) });
@@ -146,6 +147,7 @@ onMounted(async () => {
try {
const s = await settingsApi.getAll();
if (s.appName) appName.value = s.appName;
filingInfo.value = s.filingInfo || '';
} catch {
/* ignore */
}
+1
View File
@@ -350,6 +350,7 @@
"logRetentionDays": "Query Log Retention (days)",
"operationLogRetentionDays": "Operation Log Retention (days)",
"watermarkText": "Certificate Watermark",
"filingInfo": "Filing Info",
"carouselInterval": "Client Carousel Interval (s)",
"carouselIntervalHint": "Seconds each media stays; decimals allowed. 0 disables auto-advance (manual loop still works).",
"saved": "Settings saved"
+1
View File
@@ -350,6 +350,7 @@
"logRetentionDays": "查询日志保留天数",
"operationLogRetentionDays": "操作日志保留天数",
"watermarkText": "证书水印文案",
"filingInfo": "备案信息",
"carouselInterval": "客户端轮播间隔(秒)",
"carouselIntervalHint": "每张媒体停留秒数,支持小数;填 0 则不自动切换(仍可手动循环切换)",
"saved": "设置已保存"
+6
View File
@@ -14,6 +14,9 @@
<n-form-item :label="t('pages.settings.watermarkText')">
<n-input v-model:value="form.watermarkText" class="control-wide" />
</n-form-item>
<n-form-item :label="t('pages.settings.filingInfo')">
<n-input v-model:value="form.filingInfo" class="control-wide" />
</n-form-item>
</div>
</section>
@@ -95,6 +98,7 @@ const form = reactive({
logRetentionDays: 365,
operationLogRetentionDays: 180,
watermarkText: '',
filingInfo: '',
carouselInterval: 3,
backupEnabled: false,
backupSchedule: 'daily',
@@ -108,6 +112,7 @@ async function load() {
form.logRetentionDays = Number(s.logRetentionDays || 365);
form.operationLogRetentionDays = Number(s.operationLogRetentionDays || 180);
form.watermarkText = s.watermarkText || '';
form.filingInfo = s.filingInfo || '';
form.carouselInterval = Number(s.carouselInterval ?? 3);
form.backupEnabled = s.backupEnabled === 'true';
form.backupSchedule = s.backupSchedule || 'daily';
@@ -123,6 +128,7 @@ async function save() {
logRetentionDays: String(form.logRetentionDays),
operationLogRetentionDays: String(form.operationLogRetentionDays),
watermarkText: form.watermarkText,
filingInfo: form.filingInfo,
carouselInterval: String(form.carouselInterval),
backupEnabled: String(form.backupEnabled),
backupSchedule: form.backupSchedule,
+1
View File
@@ -62,6 +62,7 @@ async function ensureSettings(): Promise<void> {
appName: process.env.APP_NAME || '艺术品溯源平台',
logRetentionDays: process.env.LOG_RETENTION_DAYS || '365',
watermarkText,
filingInfo: '备案信息待补充',
};
for (const [key, value] of Object.entries(defaults)) {
await prisma.systemSetting.upsert({ where: { key }, update: {}, create: { key, value } });
+1 -1
View File
@@ -22,7 +22,7 @@ export class SettingsController {
@ApiOperation({ summary: '获取公开设置(应用名等)' })
async getPublic() {
const all = await this.settingsService.getAll();
return { appName: all.appName, carouselInterval: all.carouselInterval };
return { appName: all.appName, carouselInterval: all.carouselInterval, filingInfo: all.filingInfo };
}
@ApiBearerAuth()
@@ -7,6 +7,7 @@ const EDITABLE_KEYS = [
'logRetentionDays',
'operationLogRetentionDays',
'watermarkText',
'filingInfo',
'carouselInterval',
'backupEnabled',
'backupSchedule',
@@ -28,6 +29,7 @@ export class SettingsService {
logRetentionDays: String(this.config.get<number>('logRetentionDays') || 365),
operationLogRetentionDays: '365',
watermarkText: this.config.get<string>('watermarkText') || '仅供溯源核验使用',
filingInfo: '备案信息待补充',
carouselInterval: '3',
backupEnabled: 'false',
backupSchedule: 'daily',
+28 -1
View File
@@ -4,19 +4,36 @@
<h1>{{ t('home.title') }}</h1>
<p class="muted">{{ t('home.hint') }}</p>
<button class="lang" @click="toggleLang">{{ otherLangLabel }}</button>
<footer class="footer muted">
<span>{{ appName }}</span>
<span v-if="filingInfo">{{ filingInfo }}</span>
</footer>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue';
import { computed, onMounted, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { fetchAppInfo } from '@/api';
import { setLocale } from '@/locales';
const { t, locale } = useI18n();
const appName = ref('');
const filingInfo = ref('');
const otherLangLabel = computed(() => (locale.value === 'zh-CN' ? 'EN' : '中文'));
function toggleLang() {
setLocale(locale.value === 'zh-CN' ? 'en-US' : 'zh-CN');
}
onMounted(async () => {
try {
const info = await fetchAppInfo();
appName.value = info?.appName || t('app.name');
filingInfo.value = info?.filingInfo || '';
} catch {
appName.value = t('app.name');
filingInfo.value = '';
}
});
</script>
<style scoped>
@@ -53,4 +70,14 @@ h1 {
padding: 6px 18px;
color: var(--brand);
}
.footer {
position: absolute;
bottom: 28px;
left: 24px;
right: 24px;
display: flex;
flex-direction: column;
gap: 6px;
font-size: 12px;
}
</style>
+10 -1
View File
@@ -268,7 +268,10 @@
<div v-else class="chain-empty muted">{{ t('chain.notOnchain') }}</div>
</section>
<footer class="footer muted">{{ appName }}</footer>
<footer class="footer muted">
<span>{{ appName }}</span>
<span v-if="filingInfo">{{ filingInfo }}</span>
</footer>
</template>
<!-- 轻提示 -->
@@ -293,6 +296,7 @@ const { t, locale } = useI18n();
const loading = ref(true);
const data = ref<any>(null);
const appName = ref('');
const filingInfo = ref('');
const toast = ref('');
// 节点图片默认收缩,避免页面过长;点击展开
@@ -574,10 +578,12 @@ onMounted(async () => {
try {
const info = await fetchAppInfo();
appName.value = info?.appName || t('app.name');
filingInfo.value = info?.filingInfo || '';
const iv = Number(info?.carouselInterval);
if (Number.isFinite(iv) && iv >= 0) carouselInterval.value = iv;
} catch {
appName.value = t('app.name');
filingInfo.value = '';
}
document.addEventListener('click', closeLangMenu);
});
@@ -1126,6 +1132,9 @@ watch(
padding: 8px 0;
}
.footer {
display: flex;
flex-direction: column;
gap: 6px;
text-align: center;
font-size: 12px;
padding: 24px 0 32px;