fix 普通用户订阅权限

This commit is contained in:
jxxghp
2023-10-16 08:23:38 +08:00
parent c52ad73101
commit 4a65056909
3 changed files with 12 additions and 4 deletions

View File

@@ -91,7 +91,6 @@ const superUser = store.state.auth.superUser
}"
/>
<VerticalNavLink
v-if="superUser"
:item="{
title: '电影',
icon: 'mdi-movie-check-outline',
@@ -99,7 +98,6 @@ const superUser = store.state.auth.superUser
}"
/>
<VerticalNavLink
v-if="superUser"
:item="{
title: '电视剧',
icon: 'mdi-television-classic',

View File

@@ -129,12 +129,14 @@ onMounted(() => {
<span v-if="dataList.length > 0" class="fixed right-5 bottom-5">
<VBtn
v-if="viewType === 'list'"
size="x-large"
icon="mdi-view-grid"
color="primary"
@click="setViewType('card')"
/>
<VBtn
v-else
size="x-large"
icon="mdi-view-list"
color="primary"
@click="setViewType('list')"

View File

@@ -4,12 +4,17 @@ import api from '@/api'
import type { Subscribe } from '@/api/types'
import NoDataFound from '@/components/NoDataFound.vue'
import SubscribeCard from '@/components/cards/SubscribeCard.vue'
import store from '@/store'
// 输入参数
const props = defineProps({
type: String,
})
// 从Vuex Store中获取用户信息
const superUser = store.state.auth.superUser
const userName = store.state.auth.userName
// 是否刷新过
const isRefreshed = ref(false)
@@ -40,9 +45,12 @@ function onRefresh() {
loading.value = false
}
// 过滤数据
// 过滤数据,管理员用户显示全部,非管理员只显示自己的订阅
const filteredDataList = computed(() => {
return dataList.value.filter(data => data.type === props.type)
if (superUser)
return dataList.value.filter(data => data.type === props.type)
else
return dataList.value.filter(data => data.type === props.type && data.username === userName)
})
</script>