mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-10 17:42:50 +08:00
fix user menu
This commit is contained in:
@@ -64,6 +64,7 @@ async function loadAccountInfo() {
|
||||
// 页面加载时,加载当前用户数据
|
||||
onBeforeMount(async () => {
|
||||
await loadAccountInfo()
|
||||
console.log('accountInfo', accountInfo.value)
|
||||
startSSEMessager()
|
||||
})
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts" setup>
|
||||
import type { User } from '@/api/types'
|
||||
import VerticalNavSectionTitle from '@/@layouts/components/VerticalNavSectionTitle.vue'
|
||||
import VerticalNavLayout from '@layouts/components/VerticalNavLayout.vue'
|
||||
import VerticalNavLink from '@layouts/components/VerticalNavLink.vue'
|
||||
@@ -9,6 +10,9 @@ import NavbarThemeSwitcher from '@/layouts/components/NavbarThemeSwitcher.vue'
|
||||
import SearchBar from '@/layouts/components/SearchBar.vue'
|
||||
import ShortcutBar from '@/layouts/components/ShortcutBar.vue'
|
||||
import UserProfile from '@/layouts/components/UserProfile.vue'
|
||||
|
||||
// 获取当前用户信息
|
||||
const accountInfo: User = inject('accountInfo') as User
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -87,6 +91,7 @@ import UserProfile from '@/layouts/components/UserProfile.vue'
|
||||
}"
|
||||
/>
|
||||
<VerticalNavLink
|
||||
v-if="accountInfo.is_superuser"
|
||||
:item="{
|
||||
title: '电影',
|
||||
icon: 'mdi-movie-check-outline',
|
||||
@@ -94,6 +99,7 @@ import UserProfile from '@/layouts/components/UserProfile.vue'
|
||||
}"
|
||||
/>
|
||||
<VerticalNavLink
|
||||
v-if="accountInfo.is_superuser"
|
||||
:item="{
|
||||
title: '电视剧',
|
||||
icon: 'mdi-television-classic',
|
||||
@@ -101,6 +107,7 @@ import UserProfile from '@/layouts/components/UserProfile.vue'
|
||||
}"
|
||||
/>
|
||||
<VerticalNavLink
|
||||
v-if="accountInfo.is_superuser"
|
||||
:item="{
|
||||
title: '自定义',
|
||||
icon: 'mdi-rss',
|
||||
@@ -128,6 +135,7 @@ import UserProfile from '@/layouts/components/UserProfile.vue'
|
||||
}"
|
||||
/>
|
||||
<VerticalNavLink
|
||||
v-if="accountInfo.is_superuser"
|
||||
:item="{
|
||||
title: '历史记录',
|
||||
icon: 'mdi-history',
|
||||
@@ -135,6 +143,7 @@ import UserProfile from '@/layouts/components/UserProfile.vue'
|
||||
}"
|
||||
/>
|
||||
<VerticalNavLink
|
||||
v-if="accountInfo.is_superuser"
|
||||
:item="{
|
||||
title: '文件管理',
|
||||
icon: 'mdi-folder-multiple-outline',
|
||||
@@ -144,11 +153,13 @@ import UserProfile from '@/layouts/components/UserProfile.vue'
|
||||
|
||||
<!-- 👉 系统 -->
|
||||
<VerticalNavSectionTitle
|
||||
v-if="accountInfo.is_superuser"
|
||||
:item="{
|
||||
heading: '系统',
|
||||
}"
|
||||
/>
|
||||
<VerticalNavLink
|
||||
v-if="accountInfo.is_superuser"
|
||||
:item="{
|
||||
title: '插件',
|
||||
icon: 'mdi-apps',
|
||||
@@ -156,6 +167,7 @@ import UserProfile from '@/layouts/components/UserProfile.vue'
|
||||
}"
|
||||
/>
|
||||
<VerticalNavLink
|
||||
v-if="accountInfo.is_superuser"
|
||||
:item="{
|
||||
title: '站点管理',
|
||||
icon: 'mdi-web',
|
||||
@@ -163,6 +175,7 @@ import UserProfile from '@/layouts/components/UserProfile.vue'
|
||||
}"
|
||||
/>
|
||||
<VerticalNavLink
|
||||
v-if="accountInfo.is_superuser"
|
||||
:item="{
|
||||
title: '设定',
|
||||
icon: 'mdi-cog',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { useStore } from 'vuex'
|
||||
import router from '@/router'
|
||||
import type { User } from '@/api/types'
|
||||
|
||||
// Vuex Store
|
||||
const store = useStore()
|
||||
@@ -15,7 +16,7 @@ function logout() {
|
||||
}
|
||||
|
||||
// 获取当前用户信息
|
||||
const accountInfo: any = inject('accountInfo')
|
||||
const accountInfo: User = inject('accountInfo') as User
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -56,6 +57,7 @@ const accountInfo: any = inject('accountInfo')
|
||||
|
||||
<!-- 👉 Profile -->
|
||||
<VListItem
|
||||
v-if="accountInfo.is_superuser"
|
||||
link
|
||||
to="setting"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user