From c85cecbf0f1e6729e4e06d75af7b804e91aea82b Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Mon, 28 Aug 2023 15:47:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=BC=B9=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pnpm-lock.yaml | 4 ++-- src/pages/manage/courseAdmin/components/search.tsx | 2 +- src/pages/manage/courseAdmin/courseAdmin.tsx | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8afdb16..2b130cf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: '6.0' +lockfileVersion: '6.1' settings: autoInstallPeers: true @@ -12444,7 +12444,7 @@ packages: dependencies: object-assign: 4.1.1 react: 18.0.0 - react-is: 16.13.1 + react-is: 18.2.0 dev: false /react@18.0.0: diff --git a/src/pages/manage/courseAdmin/components/search.tsx b/src/pages/manage/courseAdmin/components/search.tsx index 367a088..43f9fd7 100644 --- a/src/pages/manage/courseAdmin/components/search.tsx +++ b/src/pages/manage/courseAdmin/components/search.tsx @@ -88,7 +88,7 @@ export const Search: FC = ({param, setParam}) => { {deps.length ? <> { - deps.map(dep => changeDepId(dep.id)}> diff --git a/src/pages/manage/courseAdmin/courseAdmin.tsx b/src/pages/manage/courseAdmin/courseAdmin.tsx index 6eb09f5..6f9b245 100644 --- a/src/pages/manage/courseAdmin/courseAdmin.tsx +++ b/src/pages/manage/courseAdmin/courseAdmin.tsx @@ -26,7 +26,7 @@ const CourseAdmin: FC = () => { courseApi.getCourseAll({...param, page_size: param.page_size * (replace ? param.page : 1)}).then(res => { setTotal(res.total) if (param.page === 1 || replace) { - setData(res.data) + setData(res.data || []) } else { setData([ ...data, @@ -53,7 +53,7 @@ const CourseAdmin: FC = () => { if (curs.length === data.length) { setCurs([]) } else { - setCurs(data.map(d => d.id)) + setCurs(data?.map(d => d.id)) } } @@ -72,7 +72,7 @@ const CourseAdmin: FC = () => { Taro.showModal({ title: '删除警告', content: "删除后所有部门不可查看", - confirmText:'删除', + confirmText: '删除', async success({confirm}) { if (confirm) { try { @@ -108,7 +108,7 @@ const CourseAdmin: FC = () => { * @param required 批量添加为[] */ function batchChangDep(ids: number[], depList = [], required = []) { - if (!ids.length) { + if (!ids?.length) { Taro.showToast({title: '请选择课程', icon: 'none'}) return } @@ -153,7 +153,7 @@ const CourseAdmin: FC = () => { { - data.map((d, index) => + data?.map((d, index) => addCurs(d.id)}> {batch &&