mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
@@ -1,12 +1,19 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import type { Plugin, Subscribe } from '@/api/types'
|
import type { Plugin, Subscribe } from '@/api/types'
|
||||||
import { SystemNavMenus, UserfulMenus, PluginTabs, SettingTabs } from '@/router/menu'
|
import { SystemNavMenus, UserfulMenus, SettingTabs } from '@/router/menu'
|
||||||
import { NavMenu } from '@/@layouts/types'
|
import { NavMenu } from '@/@layouts/types'
|
||||||
|
import store from '@/store'
|
||||||
|
|
||||||
// 路由
|
// 路由
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
|
// 超级用户
|
||||||
|
const superUser = store.state.auth.superUser
|
||||||
|
|
||||||
|
// 当前用户名
|
||||||
|
const userName = store.state.auth.userName
|
||||||
|
|
||||||
// 定义事件
|
// 定义事件
|
||||||
const emit = defineEmits(['close'])
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
@@ -74,6 +81,7 @@ function getMenus(): NavMenu[] {
|
|||||||
// 匹配的菜单列表
|
// 匹配的菜单列表
|
||||||
const matchedMenuItems = computed(() => {
|
const matchedMenuItems = computed(() => {
|
||||||
if (!searchWord.value) return []
|
if (!searchWord.value) return []
|
||||||
|
if (!superUser) return []
|
||||||
const lowerWord = (searchWord.value as string).toLowerCase()
|
const lowerWord = (searchWord.value as string).toLowerCase()
|
||||||
const menuItems = getMenus()
|
const menuItems = getMenus()
|
||||||
if (menuItems)
|
if (menuItems)
|
||||||
@@ -104,6 +112,7 @@ async function fetchInstalledPlugins() {
|
|||||||
// 区配的插件列表
|
// 区配的插件列表
|
||||||
const matchedPluginItems = computed(() => {
|
const matchedPluginItems = computed(() => {
|
||||||
if (!searchWord.value) return []
|
if (!searchWord.value) return []
|
||||||
|
if (!superUser) return []
|
||||||
const lowerWord = (searchWord.value as string).toLowerCase()
|
const lowerWord = (searchWord.value as string).toLowerCase()
|
||||||
return pluginItems.value.filter((item: Plugin) => {
|
return pluginItems.value.filter((item: Plugin) => {
|
||||||
if (!item.plugin_name && !item.plugin_desc) return false
|
if (!item.plugin_name && !item.plugin_desc) return false
|
||||||
@@ -114,7 +123,7 @@ const matchedPluginItems = computed(() => {
|
|||||||
// 所有订阅数据
|
// 所有订阅数据
|
||||||
const SubscribeItems = ref<Subscribe[]>([])
|
const SubscribeItems = ref<Subscribe[]>([])
|
||||||
|
|
||||||
// 获取电影订阅列表数据
|
// 获取订阅列表数据
|
||||||
async function fetchSubscribes() {
|
async function fetchSubscribes() {
|
||||||
try {
|
try {
|
||||||
SubscribeItems.value = await api.get('subscribe/')
|
SubscribeItems.value = await api.get('subscribe/')
|
||||||
@@ -128,7 +137,7 @@ const matchedSubscribeItems = computed(() => {
|
|||||||
if (!searchWord.value) return []
|
if (!searchWord.value) return []
|
||||||
const lowerWord = (searchWord.value as string).toLowerCase()
|
const lowerWord = (searchWord.value as string).toLowerCase()
|
||||||
return SubscribeItems.value.filter((item: Subscribe) => {
|
return SubscribeItems.value.filter((item: Subscribe) => {
|
||||||
return item.name.toLowerCase().includes(lowerWord)
|
return (item.name.toLowerCase().includes(lowerWord) && (superUser || userName === item.username)) || false
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -287,7 +296,7 @@ onMounted(() => {
|
|||||||
</VListItem>
|
</VListItem>
|
||||||
</template>
|
</template>
|
||||||
</VHover>
|
</VHover>
|
||||||
<VHover>
|
<VHover v-if="superUser">
|
||||||
<template #default="hover">
|
<template #default="hover">
|
||||||
<VListItem prepend-icon="mdi-history" link v-bind="hover.props" @click="searchHistory">
|
<VListItem prepend-icon="mdi-history" link v-bind="hover.props" @click="searchHistory">
|
||||||
<VListItemTitle class="break-words whitespace-break-spaces">
|
<VListItemTitle class="break-words whitespace-break-spaces">
|
||||||
@@ -382,7 +391,7 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
</VCol>
|
</VCol>
|
||||||
</VRow>
|
</VRow>
|
||||||
<VRow>
|
<VRow v-if="superUser">
|
||||||
<VCol cols="12" md="6">
|
<VCol cols="12" md="6">
|
||||||
<p class="custom-letter-spacing text-sm text-disabled text-uppercase py-2 px-4 mb-0">常用功能</p>
|
<p class="custom-letter-spacing text-sm text-disabled text-uppercase py-2 px-4 mb-0">常用功能</p>
|
||||||
<VList lines="one">
|
<VList lines="one">
|
||||||
|
|||||||
Reference in New Issue
Block a user