修改课程管理弹窗

main
king 1 year ago
parent 85451d9ca5
commit c85cecbf0f
  1. 4
      pnpm-lock.yaml
  2. 2
      src/pages/manage/courseAdmin/components/search.tsx
  3. 10
      src/pages/manage/courseAdmin/courseAdmin.tsx

@ -1,4 +1,4 @@
lockfileVersion: '6.0' lockfileVersion: '6.1'
settings: settings:
autoInstallPeers: true autoInstallPeers: true
@ -12444,7 +12444,7 @@ packages:
dependencies: dependencies:
object-assign: 4.1.1 object-assign: 4.1.1
react: 18.0.0 react: 18.0.0
react-is: 16.13.1 react-is: 18.2.0
dev: false dev: false
/react@18.0.0: /react@18.0.0:

@ -88,7 +88,7 @@ export const Search: FC<Props> = ({param, setParam}) => {
{deps.length ? {deps.length ?
<> <>
{ {
deps.map(dep => <View deps?.map(dep => <View
key={dep.id} key={dep.id}
className={styles.radioBox} className={styles.radioBox}
onClick={() => changeDepId(dep.id)}> onClick={() => changeDepId(dep.id)}>

@ -26,7 +26,7 @@ const CourseAdmin: FC = () => {
courseApi.getCourseAll({...param, page_size: param.page_size * (replace ? param.page : 1)}).then(res => { courseApi.getCourseAll({...param, page_size: param.page_size * (replace ? param.page : 1)}).then(res => {
setTotal(res.total) setTotal(res.total)
if (param.page === 1 || replace) { if (param.page === 1 || replace) {
setData(res.data) setData(res.data || [])
} else { } else {
setData([ setData([
...data, ...data,
@ -53,7 +53,7 @@ const CourseAdmin: FC = () => {
if (curs.length === data.length) { if (curs.length === data.length) {
setCurs([]) setCurs([])
} else { } else {
setCurs(data.map(d => d.id)) setCurs(data?.map(d => d.id))
} }
} }
@ -72,7 +72,7 @@ const CourseAdmin: FC = () => {
Taro.showModal({ Taro.showModal({
title: '删除警告', title: '删除警告',
content: "删除后所有部门不可查看", content: "删除后所有部门不可查看",
confirmText:'删除', confirmText: '删除',
async success({confirm}) { async success({confirm}) {
if (confirm) { if (confirm) {
try { try {
@ -108,7 +108,7 @@ const CourseAdmin: FC = () => {
* @param required [] * @param required []
*/ */
function batchChangDep(ids: number[], depList = [], required = []) { function batchChangDep(ids: number[], depList = [], required = []) {
if (!ids.length) { if (!ids?.length) {
Taro.showToast({title: '请选择课程', icon: 'none'}) Taro.showToast({title: '请选择课程', icon: 'none'})
return return
} }
@ -153,7 +153,7 @@ const CourseAdmin: FC = () => {
<View className={styles.curList}> <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)}> <View className={styles.curTitle} onClick={() => addCurs(d.id)}>
{batch && <Radio {batch && <Radio
checked={curs.includes(d.id)} checked={curs.includes(d.id)}

Loading…
Cancel
Save