|
|
|
@ -1,5 +1,5 @@ |
|
|
|
|
import {FC, useCallback, useEffect, useState} from "react"; |
|
|
|
|
import {Radio, Text, View} from "@tarojs/components"; |
|
|
|
|
import {Image, Radio, Text, View} from "@tarojs/components"; |
|
|
|
|
import {Search} from "./components/search"; |
|
|
|
|
import {CourseAllParam, courseApi, ManageApi} from "@/api"; |
|
|
|
|
import styles from './courseAdmin.module.scss' |
|
|
|
@ -9,6 +9,7 @@ import storageDep from "@/hooks/storageDep"; |
|
|
|
|
import Spin from "@/components/spinner"; |
|
|
|
|
import Img from "@/components/image/image"; |
|
|
|
|
import PageScript from "@/components/pageScript/pageScript"; |
|
|
|
|
import omit from '@/static/img/omit.png' |
|
|
|
|
|
|
|
|
|
const CourseAdmin: FC = () => { |
|
|
|
|
const [total, setTotal] = useState(0) |
|
|
|
@ -106,6 +107,27 @@ const CourseAdmin: FC = () => { |
|
|
|
|
batchChangDep([id], depList, required) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function changeCourse(data: Curriculum, index: number) { |
|
|
|
|
Taro.showActionSheet({ |
|
|
|
|
itemList: [ |
|
|
|
|
'修改部门', |
|
|
|
|
"删除" |
|
|
|
|
], |
|
|
|
|
success({tapIndex}) { |
|
|
|
|
switch (tapIndex) { |
|
|
|
|
case 0: |
|
|
|
|
changeDep(data.id, data.data) |
|
|
|
|
break |
|
|
|
|
case 1: |
|
|
|
|
del(data.id, index) |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
fail() { |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 批量添加部门 |
|
|
|
|
* @param ids 课程id |
|
|
|
@ -153,8 +175,8 @@ const CourseAdmin: FC = () => { |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
|
<Search param={param} setParam={setParam}/> |
|
|
|
|
<Spin enable={enable} overlay/> |
|
|
|
|
<Search param={param} setParam={setParam} total={total} setBatch={setBatch}/> |
|
|
|
|
<View className={styles.curList}> |
|
|
|
|
{ |
|
|
|
|
data?.map((d, index) => <View key={d.id} className={styles.curBox}> |
|
|
|
@ -164,24 +186,23 @@ const CourseAdmin: FC = () => { |
|
|
|
|
checked={curs.includes(d.id)} |
|
|
|
|
style={{marginTop: '30px'}} |
|
|
|
|
onClick={() => addCurs(d.id)}/>} |
|
|
|
|
<Img src={d.thumb} className={styles.curImage} width={280} height={164} errorType='course'/> |
|
|
|
|
<View>{d.title}</View> |
|
|
|
|
</View> |
|
|
|
|
<View className={styles.Operation}> |
|
|
|
|
<View onClick={() => del(d.id, index)}>删除</View> |
|
|
|
|
<View onClick={() => changeDep(d.id, d.data)}>添加部门</View> |
|
|
|
|
<View className={styles.curImage}> |
|
|
|
|
<Img src={d.thumb} width={280} height={164} errorType='course'/> |
|
|
|
|
<View className={styles.classHour}>共{d.class_hour}节</View> |
|
|
|
|
</View> |
|
|
|
|
<View> |
|
|
|
|
<View>{d.title}</View> |
|
|
|
|
<View className='mt-1 text-dark font-26'>{d.short_desc}</View> |
|
|
|
|
</View> |
|
|
|
|
</View> |
|
|
|
|
<Image src={omit} mode='widthFix' style={{width: '30rpx', height: '30rpx', padding: '30rpx'}} |
|
|
|
|
onClick={() => changeCourse(d, index)}/> |
|
|
|
|
</View>) |
|
|
|
|
} |
|
|
|
|
<PageScript/> |
|
|
|
|
</View> |
|
|
|
|
|
|
|
|
|
<View className={styles.add}> |
|
|
|
|
{ |
|
|
|
|
!batch |
|
|
|
|
&& data.length > 0 |
|
|
|
|
&& <View style={{margin: 'auto', padding: '15px'}} onClick={() => setBatch(true)}>分配部门</View> |
|
|
|
|
} |
|
|
|
|
{ |
|
|
|
|
batch && <View className={styles.addBatch}> |
|
|
|
|
<Radio onClick={all} checked={data.length === curs.length} color='#45D4A8'> 全选</Radio> |
|
|
|
|