From abc0bbf18249b4805044b2e0b8a62c4f1f964fef Mon Sep 17 00:00:00 2001 From: dark Date: Sat, 1 Jun 2024 17:34:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84CMS=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E9=AB=98=E7=BA=A7=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cms/video_cloud/index.tsx | 2 +- src/store/cms/video_cloud.ts | 11 ++++++++++- src/store/cms/video_magnet.ts | 11 ++++++++++- src/utils/index.ts | 7 ++++++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/pages/cms/video_cloud/index.tsx b/src/pages/cms/video_cloud/index.tsx index 604fd25..e0a1658 100644 --- a/src/pages/cms/video_cloud/index.tsx +++ b/src/pages/cms/video_cloud/index.tsx @@ -647,7 +647,7 @@ const VideoCloud = () => { onSearch: (value: string) => { setSearch(prev => ({ ...prev, - key: value + title: value })) }, onChange: (e) => { diff --git a/src/store/cms/video_cloud.ts b/src/store/cms/video_cloud.ts index b1210c9..84f583e 100644 --- a/src/store/cms/video_cloud.ts +++ b/src/store/cms/video_cloud.ts @@ -30,7 +30,16 @@ export const videoCloudsAtom = atomWithQuery((get) => { return { queryKey: [ 'videoClouds', get(videoCloudSearchAtom) ], queryFn: async ({ queryKey: [ , params ] }) => { - return await cmsServ.videoCloud.list(params as SearchParams) + const p = {} as SearchParams + Object.keys(params as any).forEach(key=>{ + const value =(params as any)[key] + if (Array.isArray(value)) { + p[key] = value.join(',') + } else { + p[key] = value + } + }) + return await cmsServ.videoCloud.list(p) }, select: res => { const data = res.data diff --git a/src/store/cms/video_magnet.ts b/src/store/cms/video_magnet.ts index e55e623..71baa93 100644 --- a/src/store/cms/video_magnet.ts +++ b/src/store/cms/video_magnet.ts @@ -30,7 +30,16 @@ export const videoMagnetsAtom = atomWithQuery((get) => { return { queryKey: [ 'videoMagnets', get(videoMagnetSearchAtom) ], queryFn: async ({ queryKey: [ , params ] }) => { - return await cmsServ.videoMagnet.list(params as SearchParams) + const p = {} as SearchParams + Object.keys(params as any).forEach(key=>{ + const value =(params as any)[key] + if (Array.isArray(value)) { + p[key] = value.join(',') + } else { + p[key] = value + } + }) + return await cmsServ.videoMagnet.list(p) }, select: res => { const data = res.data diff --git a/src/utils/index.ts b/src/utils/index.ts index 12f2251..4053ee5 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -135,8 +135,13 @@ export const getValueCount = (obj: any, filterObj: any = {}) => { let count = 0 for (const key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key) && obj[key]) { - if (!filterObj?.[key]) + //如果是数组,则必须长度大于0 + if (!filterObj?.[key]) { + if (Array.isArray(obj[key]) && obj[key].length === 0) { + continue + } count++ + } } } return count