You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
3.2 KiB
129 lines
3.2 KiB
<script setup lang="ts">
|
|
import { request, unwrapApiBody, type ApiResponse } from '../../utils/http/factory'
|
|
import { useAuthSession } from '../../composables/useAuthSession'
|
|
|
|
definePageMeta({
|
|
title: '我的',
|
|
})
|
|
|
|
const { user } = useAuthSession()
|
|
|
|
type ProfilePayload = {
|
|
profile: { publicSlug: string | null }
|
|
}
|
|
|
|
const publicSlug = ref<string | null>(null)
|
|
|
|
onMounted(async () => {
|
|
try {
|
|
const res = await request<ApiResponse<ProfilePayload>>('/api/me/profile')
|
|
publicSlug.value = unwrapApiBody(res).profile.publicSlug
|
|
} catch {
|
|
publicSlug.value = null
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<UContainer class="py-8 space-y-6">
|
|
<div>
|
|
<h1 class="text-2xl font-semibold">
|
|
控制台
|
|
</h1>
|
|
<p class="text-sm text-muted mt-1">
|
|
你好,{{ user?.username }}({{ user?.role }})
|
|
</p>
|
|
<UButton
|
|
v-if="publicSlug"
|
|
:to="`/@${publicSlug}`"
|
|
class="mt-3"
|
|
variant="outline"
|
|
target="_blank"
|
|
>
|
|
查看我的公开主页
|
|
</UButton>
|
|
</div>
|
|
|
|
<div class="grid gap-3 sm:grid-cols-2">
|
|
<UCard>
|
|
<div class="font-medium">
|
|
个人资料
|
|
</div>
|
|
<p class="text-sm text-muted mt-1">
|
|
公开链接、简介、社交链接
|
|
</p>
|
|
<UButton to="/me/profile" class="mt-3" size="sm">
|
|
编辑
|
|
</UButton>
|
|
</UCard>
|
|
<UCard>
|
|
<div class="font-medium">
|
|
文章
|
|
</div>
|
|
<p class="text-sm text-muted mt-1">
|
|
Markdown 写作与可见性
|
|
</p>
|
|
<UButton to="/me/posts" class="mt-3" size="sm">
|
|
管理
|
|
</UButton>
|
|
</UCard>
|
|
<UCard>
|
|
<div class="font-medium">
|
|
时光机
|
|
</div>
|
|
<UButton to="/me/timeline" class="mt-3" size="sm">
|
|
管理
|
|
</UButton>
|
|
</UCard>
|
|
<UCard>
|
|
<div class="font-medium">
|
|
RSS
|
|
</div>
|
|
<UButton to="/me/rss" class="mt-3" size="sm">
|
|
收件箱
|
|
</UButton>
|
|
</UCard>
|
|
<UCard v-if="user?.role === 'admin'">
|
|
<div class="font-medium">
|
|
应用配置
|
|
</div>
|
|
<p class="text-sm text-muted mt-1">
|
|
站点名称、注册开关
|
|
</p>
|
|
<UButton to="/me/admin/config" class="mt-3" size="sm">
|
|
打开
|
|
</UButton>
|
|
</UCard>
|
|
<UCard v-if="user?.role === 'admin'">
|
|
<div class="font-medium">
|
|
用户管理
|
|
</div>
|
|
<UButton to="/me/admin/users" class="mt-3" size="sm">
|
|
打开
|
|
</UButton>
|
|
</UCard>
|
|
<UCard>
|
|
<div class="font-medium">
|
|
文章媒体清理
|
|
</div>
|
|
<p class="text-sm text-muted mt-1">
|
|
孤儿图片审查与清理
|
|
</p>
|
|
<UButton to="/me/media/orphans" class="mt-3" size="sm">
|
|
打开
|
|
</UButton>
|
|
</UCard>
|
|
<UCard v-if="user?.role === 'admin'">
|
|
<div class="font-medium">
|
|
文章媒体存储校验
|
|
</div>
|
|
<p class="text-sm text-muted mt-1">
|
|
磁盘与 media_assets 一致性
|
|
</p>
|
|
<UButton to="/me/admin/media-storage" class="mt-3" size="sm">
|
|
打开
|
|
</UButton>
|
|
</UCard>
|
|
</div>
|
|
</UContainer>
|
|
</template>
|
|
|