From 2e5734176ea8aec6258e41cf7107c59e9ce64687 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Wed, 9 Aug 2023 16:14:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 4 +- src/api/course.ts | 13 ++- src/api/request.ts | 4 +- src/app.config.ts | 1 + .../manage/courseAdmin/components/search.tsx | 93 ++++++++++++++++++ .../manage/courseAdmin/courseAdmin.config.ts | 3 + .../courseAdmin/courseAdmin.module.scss | 30 ++++++ src/pages/manage/courseAdmin/courseAdmin.tsx | 25 +++++ src/pages/my/components/header/service.tsx | 6 +- src/static/img/spotMeeting.png | Bin 0 -> 1116 bytes 10 files changed, 173 insertions(+), 6 deletions(-) create mode 100644 src/pages/manage/courseAdmin/components/search.tsx create mode 100644 src/pages/manage/courseAdmin/courseAdmin.config.ts create mode 100644 src/pages/manage/courseAdmin/courseAdmin.module.scss create mode 100644 src/pages/manage/courseAdmin/courseAdmin.tsx create mode 100644 src/static/img/spotMeeting.png diff --git a/.env b/.env index 0cde6d6..1eee7ad 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ -#TARO_APP_API=https://yjx.dev.yaojiankang.top -TARO_APP_API=https://playedu.yaojiankang.top +TARO_APP_API=https://yjx.dev.yaojiankang.top +#TARO_APP_API=https://playedu.yaojiankang.top TARO_APP_LGOIN=true diff --git a/src/api/course.ts b/src/api/course.ts index de72b94..131f8c3 100644 --- a/src/api/course.ts +++ b/src/api/course.ts @@ -6,9 +6,20 @@ interface HourHistorys { hour: Hour } +export interface CourseAllParam { + page: number + page_size: number + title?: string + dep_id: null | number +} + export const courseApi = { /** 课时学习记录 */ hourHistory(courseId: string, hourId: string) { - return request(`/api/v1/course/${courseId}/hour/${hourId}/info`, "GET") + return request(`/api/v1/course/${courseId}/hour/${hourId}/info`, "GET", {}) + }, + /** 获取部门课程 */ + getCourseAll(data: CourseAllParam) { + return request('/api/v1/course/all/company', "GET", data) } } diff --git a/src/api/request.ts b/src/api/request.ts index 1851952..4620604 100644 --- a/src/api/request.ts +++ b/src/api/request.ts @@ -67,7 +67,9 @@ export function request( if (method === 'GET' && data) { let parameter = '' Object.entries(data).forEach(([key, value], index) => { - parameter += (index === 0 ? '?' : '&') + key + '=' + JSON.stringify(value) + if (parameter.indexOf(key) !== -1) { + parameter += (index === 0 ? '?' : '&') + key + '=' + JSON.stringify(value) + } }) option.url += parameter } diff --git a/src/app.config.ts b/src/app.config.ts index 0f9b58d..7b642d7 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -65,6 +65,7 @@ export default defineAppConfig({ 'selectDep/selectDep', 'meetings/meetings', 'userInfo/userInfo', + 'courseAdmin/courseAdmin', ] } ], diff --git a/src/pages/manage/courseAdmin/components/search.tsx b/src/pages/manage/courseAdmin/components/search.tsx new file mode 100644 index 0000000..49457ad --- /dev/null +++ b/src/pages/manage/courseAdmin/components/search.tsx @@ -0,0 +1,93 @@ +import {FC, useCallback, useEffect, useState} from "react"; +import {Input, Radio, Text, 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"; + +interface Props { + param: CourseAllParam + setParam: (data: CourseAllParam) => void +} + +export const Search: FC = ({param, setParam}) => { + const [show, setShow] = useState(false) + const [deps, setDeps] = useState([]) + const [depId, setDepId] = useState(param.dep_id) + + async function getDepList() { + try { + const res = await curriculum.department() + setDeps(res.data) + } catch (e) { + } + } + + const changeDepId = useCallback((id: number) => { + if (id === depId) { + setDepId(null) + } else { + setDepId(id) + } + }, [depId]) + + const putParam = useCallback(() => { + setShow(false) + if (param.dep_id !== depId) { + setParam({...param, dep_id: depId}) + } + }, [depId]) + + useEffect(() => { + getDepList() + }, []) + + return ( + <> + + + + setParam({...param, title: e.detail.value})}/> + + setShow(true)}> + 筛选 + + + + setShow(false)}> + + {deps.length ? + <> + { + deps.map(dep => changeDepId(dep.id)}> + + {dep.name} + ) + } + + + setShow(false)}> + 取消 + + + 确定 + + + + : } + + + + + ) +} diff --git a/src/pages/manage/courseAdmin/courseAdmin.config.ts b/src/pages/manage/courseAdmin/courseAdmin.config.ts new file mode 100644 index 0000000..01dfde5 --- /dev/null +++ b/src/pages/manage/courseAdmin/courseAdmin.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '课程管理', +}) diff --git a/src/pages/manage/courseAdmin/courseAdmin.module.scss b/src/pages/manage/courseAdmin/courseAdmin.module.scss new file mode 100644 index 0000000..c7a21d9 --- /dev/null +++ b/src/pages/manage/courseAdmin/courseAdmin.module.scss @@ -0,0 +1,30 @@ +.searchBox { + background: #fff; + padding: 24rpx 30rpx; + display: flex; + justify-content: space-between; + align-items: top; +} + +.searchInput{ + width: 570rpx; + height: 68rpx; + display: flex; + align-items: center; + padding-left: 24rpx; + background: #F5F8F7; + border-radius: 32rpx; + color: #909795; + overflow: hidden; +} + +.radioBox{ + border-bottom: 1px solid #F5F8F7; + padding: 20px 0; +} + +.custom{ + max-height: 60vh; + overflow: auto; + padding: 20px 0; +} diff --git a/src/pages/manage/courseAdmin/courseAdmin.tsx b/src/pages/manage/courseAdmin/courseAdmin.tsx new file mode 100644 index 0000000..0c8f816 --- /dev/null +++ b/src/pages/manage/courseAdmin/courseAdmin.tsx @@ -0,0 +1,25 @@ +import {FC, useEffect, useState} from "react"; +import {View} from "@tarojs/components"; +import {Search} from "./components/search"; +import {CourseAllParam, courseApi} from "@/api"; + +const CourseAdmin: FC = () => { + const [param, setParam] = useState({ + page: 1, + page_size: 10, + title: '', + dep_id: null + }) + + useEffect(() => { + courseApi.getCourseAll(param) + }, [param]) + + return ( + + + + ) +} + +export default CourseAdmin diff --git a/src/pages/my/components/header/service.tsx b/src/pages/my/components/header/service.tsx index cfd0097..f84a643 100644 --- a/src/pages/my/components/header/service.tsx +++ b/src/pages/my/components/header/service.tsx @@ -4,9 +4,10 @@ import Taro from "@tarojs/taro"; import {Profile} from '@/store/profile' import styles from '../../my.module.scss' import dep from '@/static/img/dep.png' -import buy from '@/static/img/buy.png' import cur from '@/static/img/cur.png' import userInfo from '@/static/img/userInfo.png' +import spotMeeting from '@/static/img/spotMeeting.png' +import course from '@/static/img/course.png' interface List { title: string; @@ -28,7 +29,8 @@ const Service = () => { oldList.unshift(...[ {title: '部门管理', src: dep, router: '/pages/manage/depAdmin/depAdmin'}, // {title: '课程市场', src: buy, router: '/pages/manage/curriculum/curriculum'}, - {title: '现场会', src: buy, router: '/pages/manage/spotMeeting/spotMeeting'}, + {title: '现场会', src: spotMeeting, router: '/pages/manage/spotMeeting/spotMeeting'}, + {title: '课程管理', src: course, router: '/pages/manage/courseAdmin/courseAdmin'}, ]) setList(oldList) } diff --git a/src/static/img/spotMeeting.png b/src/static/img/spotMeeting.png new file mode 100644 index 0000000000000000000000000000000000000000..4faa7f2b5c49aa0862542dd9e1f91d9f30c0f939 GIT binary patch literal 1116 zcmV-i1f%Px(7D+@wRA@u(T3u)yRTTctq#G8ZkdT53g{ELrq?@>V$A=dBP-zPKWL|_VDowFa zA1qQR7!aWaE$xF)X!~R#{uLMWK_B{*sDTy~bne`2(%^&O`qn~-LL*t2+&OaN%sQsK z>+bAKHpt$WWp~cG_xsLw?#?}DhR|e;kB=Y7WHRRgyZ~TNGus5OZ2-6n;48;*ZU8Xf z8xCr8rBEomZdulK0NDh=wKWwp|G>;e*L8nu+FlSs+##YP2DH}td8O2R>I9CuGlQAzz_W3b@Tz|< z%ok48Hmhyh-vKzftptuQmKH(C#UTL3((G7qEcERPfr+KkLjoR)Lx6#`xm@w_t`azQ zuk;ErifEt28WT$294y}IDuFnWZ{*XJ6zUO(M4+cYy&KuYQt2ANrwNqkDV4!hfNsv^ zif2>Z#1o4pj|jVx%=K_C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