diff --git a/src/components/lineChart/lineChart.module.scss b/src/components/lineChart/lineChart.module.scss index cf32a2d..a537589 100644 --- a/src/components/lineChart/lineChart.module.scss +++ b/src/components/lineChart/lineChart.module.scss @@ -39,7 +39,7 @@ .line { width: 1rpx; - background: #ddd; + background: #F2F8F6; height: 100%; margin-bottom: 10px; } diff --git a/src/components/lineChart/lineChart.tsx b/src/components/lineChart/lineChart.tsx index ac54ac7..cc9b56f 100644 --- a/src/components/lineChart/lineChart.tsx +++ b/src/components/lineChart/lineChart.tsx @@ -30,15 +30,14 @@ const LineChart: FC = ({data}) => { return ( <> - {maxHeight.time}日最努力,学习了{formatMinute(maxHeight.value)} + {maxHeight.time}日最努力,学习了{formatMinute(maxHeight.value)}分钟 {!maxHeight.value && 暂无数据} { !!maxHeight.value && lineChartList.map(d => - - {formatMinute(d.value)} + + {d.value > 0 && {formatMinute(d.value)}} {d.time} diff --git a/src/components/topic/topic.scss b/src/components/topic/topic.scss index 166e801..2cd631e 100644 --- a/src/components/topic/topic.scss +++ b/src/components/topic/topic.scss @@ -9,7 +9,7 @@ background: #45D4A8; border-radius: 10rpx; color: #fff; - padding: 0 10rpx; + padding: 3rpx 10rpx; font-size: 26rpx; margin-right: 20rpx; } diff --git a/src/pages/business/curHistory/curHistory.config.ts b/src/pages/business/curHistory/curHistory.config.ts index 9cd142f..908ba03 100644 --- a/src/pages/business/curHistory/curHistory.config.ts +++ b/src/pages/business/curHistory/curHistory.config.ts @@ -1,3 +1,4 @@ export default definePageConfig({ - navigationBarTitleText: '课程学习记录' + navigationBarTitleText: '课程学习记录', + onReachBottomDistance: 30 }) diff --git a/src/pages/business/curHistory/curHistory.tsx b/src/pages/business/curHistory/curHistory.tsx index 7efc654..0015159 100644 --- a/src/pages/business/curHistory/curHistory.tsx +++ b/src/pages/business/curHistory/curHistory.tsx @@ -11,19 +11,33 @@ const CurHistory = () => { const [show, setShow] = useState(false) const {course_id} = Taro.getCurrentInstance().router?.params as unknown as { course_id: string } const [data, setData] = useState([]) + const [DataAll, setDataAll] = useState([]) const [course, setCourse] = useState(null) const [hours, setHours] = useState(null) const [durations, setDuration] = useState | null>(null) const [time, setTime] = useState | null>(null) + const [page, setPage] = useState(1) Taro.useLoad(() => { userApi.courseRecord(course_id).then(res => { Taro.setNavigationBarTitle({title: res.course.title}) - setData(Object.values(res.data)) + setDataAll(Object.values(res.data)) + setData(Object.values(res.data).slice(0, 10)) setCourse(res.course) }) }) + Taro.useReachBottom(() => { + if (data.length < DataAll.length) { + const page_size = page * 10 + setData([ + ...data, + ...DataAll.slice(page_size, page_size + 10) + ]) + setPage(page + 1) + } + }) + async function setHour(unique_ident: number) { try { const res = await userApi.hourCourse(course_id, unique_ident) diff --git a/src/pages/business/videoInfo/components/catalogue.tsx b/src/pages/business/videoInfo/components/catalogue.tsx index 6aa71a6..1bd3315 100644 --- a/src/pages/business/videoInfo/components/catalogue.tsx +++ b/src/pages/business/videoInfo/components/catalogue.tsx @@ -1,7 +1,7 @@ import {FC, useState} from "react"; import Tabs, {OnChangOpt} from "@/components/tabs/tabs"; import {Image, View} from "@tarojs/components"; -import {CourseDepData} from "@/api"; +import {CourseDepData, curriculum} from "@/api"; import Collapse from "@/components/collapse/collapse"; import Hours from "@/pages/business/videoInfo/components/hours"; import Taro from "@tarojs/taro"; @@ -95,6 +95,7 @@ const Catalogue: FC = ({data, setHors, id, playId}) => { function learning() { const flats: Hour[] = Object.values(data?.hours || {}).flat(Infinity) as Hour[] + if ((data?.learn_hour_records?.length || undefined) == data?.learn_record?.hour_count && flats.length) { if (flats[0].id === playId) { videoEvents.setVideoState('play') @@ -106,9 +107,28 @@ const Catalogue: FC = ({data, setHors, id, playId}) => { if (data?.learn_hour_records.length) { - const lastTimeId = data.learn_hour_records[data.learn_hour_records.length - 1].id + const lastHours = data.learn_hour_records[data.learn_hour_records.length - 1] + + if (lastHours.courseHourRecordsFinish < 1) { + Taro.showModal({ + title: '考卷未完成,是否前往', + content: '考卷未完成不能播放下一个视频', + confirmText: '前往考试', + cancelText: '观看视频', + async success({confirm}) { + if (confirm) { + const {hour_test} = await curriculum.hourPlay(lastHours.course_id, lastHours.id) + Taro.navigateTo({url: `/pages/business/test/test?testId=${hour_test?.id}`}) + } else { + setHors(true, lastHours.id) + } + } + }) + return; + } + for (const [index, flat] of flats.entries()) { - if (flat.id === lastTimeId) { + if (flat.id === lastHours.id) { const next = flats[index + 1] if (next) { if (next.id === playId) { @@ -119,8 +139,6 @@ const Catalogue: FC = ({data, setHors, id, playId}) => { } } } - } else { - Taro.showToast({title: "无播放视频", icon: 'error'}) } } diff --git a/src/pages/business/videoInfo/components/hours.tsx b/src/pages/business/videoInfo/components/hours.tsx index eb731cd..03bf0d3 100644 --- a/src/pages/business/videoInfo/components/hours.tsx +++ b/src/pages/business/videoInfo/components/hours.tsx @@ -77,7 +77,7 @@ const Hours: FC = ({data, click, learn_hour_records, playId}) => { {complete(d.id) === 0 && 考卷未完成} { - complete(data?.[index - 1]?.id) == null + complete(data?.[index - 1]?.id) !== 1 && index !== 0 && } diff --git a/src/pages/business/videoInfo/videoInfo.scss b/src/pages/business/videoInfo/videoInfo.scss index cc75946..5c0a7ad 100644 --- a/src/pages/business/videoInfo/videoInfo.scss +++ b/src/pages/business/videoInfo/videoInfo.scss @@ -54,7 +54,7 @@ display: flex; justify-content: space-between; box-sizing: border-box; - border-bottom: 1px solid #ddd; + border-bottom: 1px solid #F5F8F7; .text { width: 600rpx; @@ -63,6 +63,7 @@ .lock { width: 30rpx; + height: 30rpx; margin-left: 10rpx; margin-top: 10rpx; } diff --git a/src/pages/manage/addCur/addCur.module.scss b/src/pages/manage/addCur/addCur.module.scss index 949cc06..b02de2c 100644 --- a/src/pages/manage/addCur/addCur.module.scss +++ b/src/pages/manage/addCur/addCur.module.scss @@ -1,7 +1,7 @@ .curBox { display: flex; align-items: center; - padding: 30rpx 0; + padding: 30rpx 20rpx; width: 100%; border-bottom: 1px solid #F5F8F7; } @@ -15,7 +15,7 @@ .fixed { position: fixed; - bottom: 0; + bottom: env(safe-area-inset-bottom); left: 0; background: #f1f8f6; width: 100%; diff --git a/src/pages/manage/addCur/addCur.tsx b/src/pages/manage/addCur/addCur.tsx index 6964163..c3c5966 100644 --- a/src/pages/manage/addCur/addCur.tsx +++ b/src/pages/manage/addCur/addCur.tsx @@ -87,9 +87,9 @@ const AddCur: FC = () => { {data?.map((d) => addCur(d.id)}> - addCur(d.id)}/> + addCur(d.id)} color='#45d4a8'/> - + {d.title} diff --git a/src/pages/manage/addStudent/addStudent.scss b/src/pages/manage/addStudent/addStudent.scss index 5c624c8..880b002 100644 --- a/src/pages/manage/addStudent/addStudent.scss +++ b/src/pages/manage/addStudent/addStudent.scss @@ -12,6 +12,5 @@ .add { position: fixed; width: 710rpx; - bottom: env(safe-area-inset-bottom); - margin-bottom: 30px; + margin-top: 10px; } diff --git a/src/pages/manage/addStudent/addStudent.tsx b/src/pages/manage/addStudent/addStudent.tsx index 4f017e2..95ddb62 100644 --- a/src/pages/manage/addStudent/addStudent.tsx +++ b/src/pages/manage/addStudent/addStudent.tsx @@ -90,7 +90,7 @@ const AddStudent = () => { }) return ( - +
姓名 @@ -113,13 +113,13 @@ const AddStudent = () => { 所属部门 - {depIds.length ? formatDep() : '请选择'} + {depIds.length ? formatDep() : '选择部门'} - +
) diff --git a/src/pages/manage/courseAdmin/components/search.tsx b/src/pages/manage/courseAdmin/components/search.tsx index 9c45ba8..367a088 100644 --- a/src/pages/manage/courseAdmin/components/search.tsx +++ b/src/pages/manage/courseAdmin/components/search.tsx @@ -70,10 +70,19 @@ export const Search: FC = ({param, setParam}) => { setShow(true)}> 筛选 + mode='aspectFit' + style={{ + display: 'inline-block', + width: '15px', + height: '15px', + verticalAlign: 'middle', + marginLeft: '5px' + }}/>
+ {param.dep_id > 0 && {deps.find(d => d.id === param.dep_id)?.name}:} + setShow(false)}> {deps.length ? diff --git a/src/pages/manage/courseAdmin/courseAdmin.module.scss b/src/pages/manage/courseAdmin/courseAdmin.module.scss index 277d30b..2267ffa 100644 --- a/src/pages/manage/courseAdmin/courseAdmin.module.scss +++ b/src/pages/manage/courseAdmin/courseAdmin.module.scss @@ -3,7 +3,6 @@ padding: 24rpx 30rpx; display: flex; justify-content: space-between; - align-items: top; } .searchInput { @@ -44,7 +43,7 @@ width: 280rpx; height: 164rpx; border-radius: 10rpx; - margin: 0 20px; + margin: 0 20px 0 0; background: #eee; } @@ -52,13 +51,14 @@ display: flex; justify-content: space-around; - taro-view-core { + taro-view-core, + View { padding: 20rpx 0; flex: 1; width: 100%; text-align: center; - &:last-child{ + &:last-child { border: 1px solid #F5F8F7; } } diff --git a/src/pages/manage/courseAdmin/courseAdmin.tsx b/src/pages/manage/courseAdmin/courseAdmin.tsx index 7d1f4bf..6eb09f5 100644 --- a/src/pages/manage/courseAdmin/courseAdmin.tsx +++ b/src/pages/manage/courseAdmin/courseAdmin.tsx @@ -72,6 +72,7 @@ const CourseAdmin: FC = () => { Taro.showModal({ title: '删除警告', content: "删除后所有部门不可查看", + confirmText:'删除', async success({confirm}) { if (confirm) { try { @@ -173,13 +174,13 @@ const CourseAdmin: FC = () => { { !batch && data.length > 0 - && setBatch(true)}>添加部门 + && setBatch(true)}>分配部门 } { batch && 全选 setBatch(false)}>取消 - batchChangDep(curs)}>确定{curs.length} + batchChangDep(curs)}>分配部门{curs.length} } diff --git a/src/pages/manage/selectDep/selectDep.tsx b/src/pages/manage/selectDep/selectDep.tsx index 4838a77..7bd9d0a 100644 --- a/src/pages/manage/selectDep/selectDep.tsx +++ b/src/pages/manage/selectDep/selectDep.tsx @@ -50,10 +50,6 @@ const SelectDep: FC = () => { }, [ids]) function ok() { - if (!ids.length) { - Taro.showToast({title: '请选择部门', icon: "error"}) - return - } storageDep.set(ids) storageDep.setRequired(required) Taro.navigateBack({delta: 1}) @@ -84,7 +80,7 @@ const SelectDep: FC = () => { return ( {deps.map((d) => onChange(d.id)}> - + { params?.required ? 必修: event?.stopImmediatePropagation()} checked={isRequired(d.id)} onChange={(e) => requiredChange(d.id, e.detail.value)}/> diff --git a/src/static/css/module.scss b/src/static/css/module.scss index f77d02a..b440b00 100644 --- a/src/static/css/module.scss +++ b/src/static/css/module.scss @@ -32,7 +32,7 @@ taro-button-core::after { display: flex; align-items: center; justify-content: space-between; - border-bottom: 1px solid #ddd; + border-bottom: 1px solid #F5F8F7; height: 80px; }