|
|
|
@ -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)) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -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 = () => { |
|
|
|
|
|
|
|
|
|
<View className={styles.curList}> |
|
|
|
|
{ |
|
|
|
|
data.map((d, index) => <View key={d.id} className={styles.curBox}> |
|
|
|
|
data?.map((d, index) => <View key={d.id} className={styles.curBox}> |
|
|
|
|
<View className={styles.curTitle} onClick={() => addCurs(d.id)}> |
|
|
|
|
{batch && <Radio |
|
|
|
|
checked={curs.includes(d.id)} |
|
|
|
|