From 533c564db5b2dc881e7eb9443b69588b4d4e8d87 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 16 Oct 2023 08:32:02 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E6=99=AE=E9=80=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E4=B8=AD=E5=8F=AA=E6=98=BE=E7=A4=BA=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E6=B7=BB=E5=8A=A0=E7=9A=84=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/types.ts | 3 +++ src/views/reorganize/DownloadingListView.vue | 19 ++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/api/types.ts b/src/api/types.ts index f9dbfca0..93288d74 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -478,6 +478,9 @@ export interface DownloadingInfo { // 媒体信息 media: { [key: string]: any } + + // 下载用户 + userid?: string } // 缺失剧集信息 diff --git a/src/views/reorganize/DownloadingListView.vue b/src/views/reorganize/DownloadingListView.vue index 9627d009..71b9d0da 100644 --- a/src/views/reorganize/DownloadingListView.vue +++ b/src/views/reorganize/DownloadingListView.vue @@ -4,6 +4,11 @@ import api from '@/api' import type { DownloadingInfo } from '@/api/types' import NoDataFound from '@/components/NoDataFound.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 @@ -35,6 +40,14 @@ function onRefresh() { loading.value = false } +// 过滤数据,管理员用户显示全部,非管理员只显示自己的订阅 +const filteredDataList = computed(() => { + if (superUser) + return dataList.value + else + return dataList.value.filter(data => data.userid === userName) +}) + // 加载时获取数据 onBeforeMount(() => { fetchData() @@ -71,17 +84,17 @@ onUnmounted(() => { @refresh="onRefresh" >