diff --git a/front/components/About/AboutBaseInfo.vue b/front/components/About/AboutBaseInfo.vue new file mode 100644 index 0000000..546818c --- /dev/null +++ b/front/components/About/AboutBaseInfo.vue @@ -0,0 +1,108 @@ + + + diff --git a/front/components/About/AboutChartView.vue b/front/components/About/AboutChartView.vue new file mode 100644 index 0000000..09ad79f --- /dev/null +++ b/front/components/About/AboutChartView.vue @@ -0,0 +1,143 @@ + + + diff --git a/front/i18n/locales/en.json b/front/i18n/locales/en.json index c46a299..69a8f6b 100644 --- a/front/i18n/locales/en.json +++ b/front/i18n/locales/en.json @@ -108,7 +108,7 @@ "powerBy": "Power by {0} as a open source temporary file sharing platform", "file": "File", "task": "Task", - "admin": "Admin", + "admin": "Site Admin", "author": "Author", "title": "About", "systemInfo": "System Info", diff --git a/front/i18n/locales/zh-CN.json b/front/i18n/locales/zh-CN.json index 2c50cbb..5e1d4a3 100644 --- a/front/i18n/locales/zh-CN.json +++ b/front/i18n/locales/zh-CN.json @@ -108,12 +108,12 @@ "powerBy": "由 {0} 驱动的开源自托管临时文件分享平台", "file": "文件", "task": "任务", - "admin": "站长", + "admin": "本站管理员", "author": "作者", "title": "关于", "systemInfo": "系统信息", "systemVersion": "系统版本", - "storage": "存储空间", + "storage": "已托管的文件", "analysis": "分析", "fileSize": "文件大小", "fileNum": "文件数量", diff --git a/front/pages/about.vue b/front/pages/about.vue index 78cafe0..07fecfa 100644 --- a/front/pages/about.vue +++ b/front/pages/about.vue @@ -11,203 +11,16 @@ import useMyAppConfig from '@/composables/useMyAppConfig' import dayjs from 'dayjs' import relativeTime from 'dayjs/plugin/relativeTime' import Progress from '~/components/ui/progress/Progress.vue' +import AboutBaseInfo from '@/components/About/AboutBaseInfo.vue' dayjs.extend(relativeTime) - -const appConfig = useMyAppConfig() -const { site_title, site_desc } = appConfig.value || {} - -const { data, isLoading } = useQuery({ - queryKey: ['stat'], - queryFn: async () => { - const data = await $fetch<{ data: any }>('/api/stat') - return data.data - }, -}) - const { t } = useI18n() - -const chartTabs = computed(() => { - return [ - { - label: t('about.file'), - value: 'storage', - total: data.value?.chart?.storage?.reduce((acc: number, curr: { file_size: number; file_num: number }) => acc + curr.file_num, 0) ?? 0, - }, - { - label: t('about.task'), - value: 'queue', - total: - data.value?.chart?.queue?.reduce( - (acc: number, curr: { processed: number; failed: number }) => acc + curr.processed + curr.failed, - 0 - ) ?? 0, - }, - ] -}) - -const currentFileSize = computed(() => { - return data.value?.chart?.storage?.reduce((acc: number, curr: { file_size: number; file_num: number }) => acc + curr.file_size, 0) ?? 0 -}) - -const currentChartTab = ref<'storage' | 'queue'>('storage') -const currentChartData = computed(() => { - const { storage, queue } = data.value?.chart || {} - if (currentChartTab.value === 'storage') { - return { - data: storage, - index: 'date', - categories: ['file_size', 'file_num'], - colors: ['#22d3ee', '#c084fc'], - } - } - return { - data: queue, - index: 'date', - categories: ['processed', 'failed'], - colors: ['#4ade80', '#f87171'], - } -}) - -const genUserAvatar = ({ email }: { email: string }) => { - if (!email) { - return '/logo.png' - } - return `https://www.gravatar.com/avatar/${SparkMD5.hash(email)}?d=retro` -} - -const handleUserClick = ({ url, email }: { url: string; email: string }) => { - if (url) { - return navigateTo(url, { external: true }) - } - if (email) { - return navigateTo(`mailto:${email}`, { external: true }) - } - return null -} - -const users = computed(() => { - const { email, name, url } = data.value?.admin || {} - return [ - ...(!!name - ? [ - { - title: t('about.admin'), - email, - name, - url: url ?? (email ? `mailto:${email}` : null), - }, - ] - : []), - { - title: t('about.author'), - name: 'keven1024', - email: 'keven@fudaoyuan.icu', - url: 'https://github.com/keven1024', - }, - ] -})