mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
feat 普通用户下载中只显示自己添加的下载
This commit is contained in:
@@ -478,6 +478,9 @@ export interface DownloadingInfo {
|
|||||||
|
|
||||||
// 媒体信息
|
// 媒体信息
|
||||||
media: { [key: string]: any }
|
media: { [key: string]: any }
|
||||||
|
|
||||||
|
// 下载用户
|
||||||
|
userid?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// 缺失剧集信息
|
// 缺失剧集信息
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ import api from '@/api'
|
|||||||
import type { DownloadingInfo } from '@/api/types'
|
import type { DownloadingInfo } from '@/api/types'
|
||||||
import NoDataFound from '@/components/NoDataFound.vue'
|
import NoDataFound from '@/components/NoDataFound.vue'
|
||||||
import DownloadingCard from '@/components/cards/DownloadingCard.vue'
|
import DownloadingCard from '@/components/cards/DownloadingCard.vue'
|
||||||
|
import store from '@/store'
|
||||||
|
|
||||||
|
// 从Vuex Store中获取用户信息
|
||||||
|
const superUser = store.state.auth.superUser
|
||||||
|
const userName = store.state.auth.userName
|
||||||
|
|
||||||
// 定时器
|
// 定时器
|
||||||
let refreshTimer: NodeJS.Timer | null = null
|
let refreshTimer: NodeJS.Timer | null = null
|
||||||
@@ -35,6 +40,14 @@ function onRefresh() {
|
|||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 过滤数据,管理员用户显示全部,非管理员只显示自己的订阅
|
||||||
|
const filteredDataList = computed(() => {
|
||||||
|
if (superUser)
|
||||||
|
return dataList.value
|
||||||
|
else
|
||||||
|
return dataList.value.filter(data => data.userid === userName)
|
||||||
|
})
|
||||||
|
|
||||||
// 加载时获取数据
|
// 加载时获取数据
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
fetchData()
|
fetchData()
|
||||||
@@ -71,17 +84,17 @@ onUnmounted(() => {
|
|||||||
@refresh="onRefresh"
|
@refresh="onRefresh"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
v-if="dataList.length > 0"
|
v-if="filteredDataList.length > 0"
|
||||||
class="grid gap-3 grid-downloading-card"
|
class="grid gap-3 grid-downloading-card"
|
||||||
>
|
>
|
||||||
<DownloadingCard
|
<DownloadingCard
|
||||||
v-for="data in dataList"
|
v-for="data in filteredDataList"
|
||||||
:key="data.hash"
|
:key="data.hash"
|
||||||
:info="data"
|
:info="data"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<NoDataFound
|
<NoDataFound
|
||||||
v-if="dataList.length === 0 && isRefreshed"
|
v-if="filteredDataList.length === 0 && isRefreshed"
|
||||||
error-code="404"
|
error-code="404"
|
||||||
error-title="没有任务"
|
error-title="没有任务"
|
||||||
error-description="正在下载的任务将会显示在这里。"
|
error-description="正在下载的任务将会显示在这里。"
|
||||||
|
|||||||
Reference in New Issue
Block a user