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
+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>