diff --git a/src/pages/manage/courseAdmin/components/search.tsx b/src/pages/manage/courseAdmin/components/search.tsx index caf0819..eaed0c0 100644 --- a/src/pages/manage/courseAdmin/components/search.tsx +++ b/src/pages/manage/courseAdmin/components/search.tsx @@ -1,23 +1,45 @@ import {FC, useCallback, useEffect, useState} from "react"; -import {Input, Radio, View} from "@tarojs/components"; +import {Image, Input, Radio, View} from "@tarojs/components"; import styles from "../courseAdmin.module.scss"; import Icon from "@/components/icon"; import {CourseAllParam, curriculum} from "@/api"; import CustomPageContainer from "@/components/custom-page-container/custom-page-container"; import Empty from "@/components/empty/empty"; import MyButton from "@/components/button/MyButton"; +import downArrow from '@/static/img/downArrow.png' +import downArrowKey from '@/static/img/downArrowKey.png' +import omit from '@/static/img/omit.png' +import Taro from "@tarojs/taro"; interface Props { param: CourseAllParam setParam: (data: CourseAllParam) => void + total: number + setBatch: (data: boolean) => void } -export const Search: FC = ({param, setParam}) => { +export const Search: FC = ({param, setParam, total, setBatch}) => { const [show, setShow] = useState(false) const [deps, setDeps] = useState([]) const [depId, setDepId] = useState(param.dep_id) const [title, setTitle] = useState(param.title) + + function onBatch() { + Taro.showActionSheet({ + itemList: ['批量添加部门'], + success({tapIndex}) { + switch (tapIndex) { + case 0: + setBatch(true) + break + } + }, + fail() { + } + }) + } + async function getDepList() { try { const res = await curriculum.department() @@ -69,14 +91,32 @@ export const Search: FC = ({param, setParam}) => { })} /> - - setShow(true)} className={styles.select}> - 选择部门 + + + setShow(true)} className={styles.select}> + 选择部门 + + + + { + param.dep_id > 0 + && + {deps.find(d => d.id === param.dep_id)?.name} + + + } + + + + + + {total}个课程 + - {param.dep_id > 0 && {deps.find(d => d.id === param.dep_id)?.name}:} setShow(false)}> diff --git a/src/pages/manage/courseAdmin/courseAdmin.module.scss b/src/pages/manage/courseAdmin/courseAdmin.module.scss index 747ed4f..2caca7c 100644 --- a/src/pages/manage/courseAdmin/courseAdmin.module.scss +++ b/src/pages/manage/courseAdmin/courseAdmin.module.scss @@ -21,8 +21,8 @@ page { overflow: hidden; } -.select{ - width: 172rpx; +.select { + padding: 0 30rpx; height: 56rpx; background: #F6F6F6; border-radius: 28rpx; @@ -35,6 +35,12 @@ page { color: #323635; } +.icon { + width: 20rpx; + height: 20rpx; + margin-left: 10rpx; +} + .radioBox { border-bottom: 1px solid #F5F8F7; padding: 20px 0; @@ -49,6 +55,9 @@ page { .curBox { background: #fff; margin-top: 20px; + display: flex; + justify-content: space-between; + align-items: center; } .curTitle { @@ -61,22 +70,20 @@ page { border-radius: 10rpx; margin: 0 20px 0 0; background: #eee; -} - -.Operation { - display: flex; - justify-content: space-around; - - taro-view-core, - View { - padding: 20rpx 0; - flex: 1; - width: 100%; - text-align: center; + overflow: hidden; + position: relative; - &:last-child { - border: 1px solid #F5F8F7; - } + .classHour { + position: absolute; + font-size: 24rpx; + font-family: PingFang SC-Medium, PingFang SC; + font-weight: 50; + background: rgba(#000, .6); + top: 0; + left: 0; + padding: 5rpx 20rpx; + color: #FFFFFF; + border-radius: 0 0 10rpx 0; } } diff --git a/src/pages/manage/courseAdmin/courseAdmin.tsx b/src/pages/manage/courseAdmin/courseAdmin.tsx index 2cbaf09..44e308a 100644 --- a/src/pages/manage/courseAdmin/courseAdmin.tsx +++ b/src/pages/manage/courseAdmin/courseAdmin.tsx @@ -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 ( <> - + { data?.map((d, index) => @@ -164,24 +186,23 @@ const CourseAdmin: FC = () => { checked={curs.includes(d.id)} style={{marginTop: '30px'}} onClick={() => addCurs(d.id)}/>} - - {d.title} - - - del(d.id, index)}>删除 - changeDep(d.id, d.data)}>添加部门 + + + 共{d.class_hour}节 + + + {d.title} + {d.short_desc} + + changeCourse(d, index)}/> ) } - { - !batch - && data.length > 0 - && setBatch(true)}>分配部门 - } { batch && 全选 diff --git a/src/static/img/downArrow.png b/src/static/img/downArrow.png new file mode 100644 index 0000000..6808c45 Binary files /dev/null and b/src/static/img/downArrow.png differ diff --git a/src/static/img/downArrowKey.png b/src/static/img/downArrowKey.png new file mode 100644 index 0000000..4870e5b Binary files /dev/null and b/src/static/img/downArrowKey.png differ