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 &&