From c2b9a4812f2aa781b9bd57af34ebf85089a51669 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Mon, 18 Sep 2023 10:46:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=BE=E7=A8=8B=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../manage/courseAdmin/components/search.tsx | 52 ++++++++++++++++-- .../courseAdmin/courseAdmin.module.scss | 41 ++++++++------ src/pages/manage/courseAdmin/courseAdmin.tsx | 47 +++++++++++----- src/static/img/downArrow.png | Bin 0 -> 306 bytes src/static/img/downArrowKey.png | Bin 0 -> 305 bytes 5 files changed, 104 insertions(+), 36 deletions(-) create mode 100644 src/static/img/downArrow.png create mode 100644 src/static/img/downArrowKey.png 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 0000000000000000000000000000000000000000..6808c45f2dbe579d92eccb91eef7b08bf98d1347 GIT binary patch literal 306 zcmV-20nPr2P)Px#>`6pHR5(v#WS}x&q_TMoqXtqQq8MS=H*1Rar)O_&HZ(N+A!L02^nQiH%)$rA z>M#tPFn!A7{|t;LKE8Y%iO7(B2U2GWZ&9ikfwQVcfiKZDKx z{|ugm+1VGcg)!cQ4KtL1@&Aqg42*9;hW+{b&#@#o_Xe&ABbZa*hB7cP5Hbv}myuo2 zHFc`Q|G$4(%JcG`5K2k}T}a3Pboo&ONewYf^;8c-0A}oH6+CQtKL7v#07*qoM6N<$ Ef?kn(4*&oF literal 0 HcmV?d00001 diff --git a/src/static/img/downArrowKey.png b/src/static/img/downArrowKey.png new file mode 100644 index 0000000000000000000000000000000000000000..4870e5bbf69491c9f96cff56e75bda0f939869a8 GIT binary patch literal 305 zcmV-10nYx3P)Px#>q$gGR5(v#WS}x&q_TMoqXtqQq8MT5cy*cf|5vwe9&l{y_n?85kH&{C<5i5}%#s3)?d>9!2dG67UI)c|gkR&ccA%>|h|Ifhafz2?GUYzL=-B6HXs9`pL82@@6 z(2l-AM=DzQX=R=LI$AAj~Ym7h+(RydKdx#dEa9d)WZMB00000NkvXXu0mjf DpTT`j literal 0 HcmV?d00001