feat(frontend): Align admin and user API integration

This commit is contained in:
2026-04-18 18:21:31 +08:00
parent 3adb088eca
commit 2247d235ec
74 changed files with 8626 additions and 647 deletions
@@ -0,0 +1,49 @@
<template>
<div class="settings-subpage">
<van-nav-bar title="隐私设置" fixed placeholder left-arrow @click-left="router.back()" />
<van-cell-group inset>
<van-cell title="主页公开范围">
<template #right-icon>
<van-dropdown-menu>
<van-dropdown-item v-model="form.privacyLevel" :options="privacyOptions" />
</van-dropdown-menu>
</template>
</van-cell>
<van-cell title="个性签名可见" value="公开" />
<van-cell title="关注列表可见" value="仅自己可见" />
</van-cell-group>
<div class="submit">
<van-button type="primary" block @click="save">保存设置</van-button>
</div>
</div>
</template>
<script setup lang="ts">
import { onMounted, reactive } from 'vue'
import { useRouter } from 'vue-router'
import { showSuccessToast } from 'vant'
import { userApi } from '@/api/user.ts'
const router = useRouter()
const form = reactive({ privacyLevel: 1 })
const privacyOptions = [
{ text: '公开', value: 1 },
{ text: '仅关注可见', value: 2 },
{ text: '仅自己可见', value: 3 }
]
const save = async () => {
await userApi.updateSettings({ privacyLevel: form.privacyLevel })
showSuccessToast('已保存')
}
onMounted(async () => {
const settings = await userApi.getSettings()
form.privacyLevel = settings.privacyLevel
})
</script>
<style scoped lang="scss">
.settings-subpage { min-height: 100vh; background: #f6f7fb; }
.submit { padding: 20px 16px; }
</style>