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