修改部门课程 & 添加课程样式

main
king 1 year ago
parent 467dbccdd9
commit c39dbc6847
  1. 6
      src/pages/manage/addCur/addCur.tsx
  2. 19
      src/pages/manage/depCur/depCur.module.scss
  3. 3
      src/pages/manage/depCur/depCur.tsx

@ -43,7 +43,7 @@ const AddCur = () => {
try { try {
const is_required = confirm ? 1 : 0 const is_required = confirm ? 1 : 0
Taro.showLoading() Taro.showLoading()
await ManageApi.addCur({course_id: [cur_id], dep_id: [Number(id)], is_required}) await ManageApi.addCur({course_id: [cur_id], dep_id: [Number(id)], is_required:[is_required]})
const oldData: Curriculum[] = JSON.parse(JSON.stringify(data)) const oldData: Curriculum[] = JSON.parse(JSON.stringify(data))
oldData.splice(index, 1) oldData.splice(index, 1)
setData(oldData) setData(oldData)
@ -53,6 +53,8 @@ const AddCur = () => {
Taro.hideLoading() Taro.hideLoading()
} }
}) })
event?.stopImmediatePropagation()
} }
return ( return (
@ -64,7 +66,7 @@ const AddCur = () => {
<> <>
{ {
data.length ? data.length ?
<View className='bg-white mt-2 py-2 flex flex-wrap'> <View className='flex flex-wrap'>
{data?.map((d, index) => ( {data?.map((d, index) => (
<VideoCover <VideoCover
key={d.id} key={d.id}

@ -3,17 +3,30 @@
} }
.curBox { .curBox {
background: #fff;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
border-bottom: 1px solid #F5F8F7;
padding: 20rpx 0 20rpx 20rpx; padding: 20rpx 0 20rpx 20rpx;
font-size: 28rpx; font-size: 28rpx;
box-sizing: border-box;
} }
.imageBox { .imageBox {
position: relative; position: relative;
background: #fff;
display: flex; display: flex;
flex: 1;
border-radius: 10px;
margin-right: 10px;
}
.required{
position: absolute;
left: 0;
top: 0;
background: rgba(#000,.7);
color: #fff;
padding: 0 10rpx;
border-radius: 0 0 10rpx 0;
} }
.image { .image {
@ -22,6 +35,7 @@
margin-right: 10rpx; margin-right: 10rpx;
width: 280rpx; width: 280rpx;
height: 180rpx; height: 180rpx;
background: #eee;
} }
.del { .del {
@ -31,6 +45,7 @@
background: red; background: red;
color: #fff; color: #fff;
width: 100rpx; width: 100rpx;
border-radius: 10rpx 0 0 10rpx;
} }
.flexdButton { .flexdButton {

@ -81,11 +81,12 @@ const DepCur: FC = () => {
return ( return (
<View className={styles.page}> <View className={styles.page}>
{ {
data.length ? data.length > 0 ?
data.map(d => <View key={d.id} className={styles.curBox}> data.map(d => <View key={d.id} className={styles.curBox}>
<View className={styles.imageBox}> <View className={styles.imageBox}>
<Image src={d.thumb} className={styles.image} mode='aspectFill'/> <Image src={d.thumb} className={styles.image} mode='aspectFill'/>
<View>{d.title}</View> <View>{d.title}</View>
<View className={styles.required}>{d.is_required ? '必修' : '选修'}</View>
</View> </View>
<View <View
className={styles.del} className={styles.del}

Loading…
Cancel
Save