84 lines
1.9 KiB
Vue
84 lines
1.9 KiB
Vue
<template>
|
|
<div class="app-shell home">
|
|
<img class="logo" :src="appIconUrl" alt="" />
|
|
<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, onMounted, ref } from 'vue';
|
|
import { useI18n } from 'vue-i18n';
|
|
import { fetchAppInfo } from '@/api';
|
|
import { setLocale } from '@/locales';
|
|
import { resolveAppIcon, setFavicon } from '@/utils/appIcon';
|
|
|
|
const { t, locale } = useI18n();
|
|
const appName = ref('');
|
|
const appIconUrl = ref(resolveAppIcon());
|
|
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');
|
|
appIconUrl.value = resolveAppIcon(info?.appIconUrl);
|
|
setFavicon(appIconUrl.value);
|
|
filingInfo.value = info?.filingInfo || '';
|
|
} catch {
|
|
appName.value = t('app.name');
|
|
setFavicon(appIconUrl.value);
|
|
filingInfo.value = '';
|
|
}
|
|
});
|
|
</script>
|
|
|
|
<style scoped>
|
|
.home {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
text-align: center;
|
|
padding: 40px 28px;
|
|
gap: 14px;
|
|
}
|
|
.logo {
|
|
width: 72px;
|
|
height: 72px;
|
|
border-radius: 18px;
|
|
object-fit: cover;
|
|
background: #f6f8fb;
|
|
}
|
|
h1 {
|
|
font-size: 22px;
|
|
margin: 8px 0 0;
|
|
}
|
|
.lang {
|
|
margin-top: 16px;
|
|
border: 1px solid #d0d7e2;
|
|
background: #fff;
|
|
border-radius: 999px;
|
|
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>
|