|
|
@@ -7,7 +7,7 @@ import './styles/side-menu.less';
|
|
|
import { SearchOutlined } from '@ant-design/icons';
|
|
|
import ProList from '@ant-design/pro-list';
|
|
|
import { history } from '@@/core/history';
|
|
|
-import { useLocation } from '@@/exports';
|
|
|
+import { useLocation, useModel } from '@@/exports';
|
|
|
import { getTeachers } from '@/services/side/SideController';
|
|
|
import { getTeacherCourses } from '@/services/record/RecordController';
|
|
|
import CourseImage from '@/assets/img/course_image.png';
|
|
|
@@ -33,7 +33,15 @@ function SideMenu ({
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
const [hasMore, setHasMore] = useState(true);
|
|
|
const [page, setPage] = useState(1);
|
|
|
-
|
|
|
+ const {setCourseInfo,courseInfo} = useModel('global')
|
|
|
+ useEffect(() => {
|
|
|
+ const unlisten = history.listen((newLocation) => {
|
|
|
+ if (newLocation.location.pathname !== '/play') {
|
|
|
+ setCourseInfo(null)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return () => unlisten(); // 清理监听
|
|
|
+ }, []);
|
|
|
async function getTeacherCourseList(current: number) {
|
|
|
const searchParams = new URLSearchParams(location.search);
|
|
|
setActiveCourseKey(searchParams.get('courseId') as string)
|
|
|
@@ -89,6 +97,11 @@ function SideMenu ({
|
|
|
setActiveKey(searchParams.get('teacherId') as string);
|
|
|
} else {
|
|
|
setActiveKey(data.data[0].teacherId as string)
|
|
|
+ setCourseInfo({
|
|
|
+ ...courseInfo,
|
|
|
+ teacherName: data.data[0].teacherName as string,
|
|
|
+ schoolName: data.data[0].schoolName as string
|
|
|
+ })
|
|
|
localStorage.setItem('teacherName', data.data[0].teacherName as string)
|
|
|
localStorage.setItem('schoolName', data.data[0].schoolName as string)
|
|
|
history.push('/record?teacherId=' + data.data[0].teacherId);
|
|
|
@@ -194,7 +207,7 @@ function SideMenu ({
|
|
|
tableExtraRender={(_: any, list: any) => (
|
|
|
<div
|
|
|
ref={containerRef}
|
|
|
- style={{ height: 'calc(100vh - 170px)', overflow: 'auto', paddingRight: 30 }}
|
|
|
+ style={{ height: 'calc(100vh - 170px)', overflow: 'auto' }}
|
|
|
>
|
|
|
{list.map((item: any) => (
|
|
|
<div
|
|
|
@@ -207,16 +220,23 @@ function SideMenu ({
|
|
|
onClick={() => {
|
|
|
history.push(`/play?teacherId=${item.teacherId}&courseId=${item.id}`);
|
|
|
setActiveCourseKey(item.id);
|
|
|
+ setCourseInfo({
|
|
|
+ ...courseInfo,
|
|
|
+ periodName: item.periodName,
|
|
|
+ courseTitle: item.courseTitle,
|
|
|
+ subjectName: item.subjectName,
|
|
|
+ courseDate: `${item.courseDate.split(' ')[0]}(${item.lessonStartTime} ~ ${item.lessonEndTime})`
|
|
|
+ })
|
|
|
localStorage.setItem('periodName', item.periodName);
|
|
|
localStorage.setItem('courseTitle', item.courseTitle);
|
|
|
localStorage.setItem('subjectName', item.subjectName);
|
|
|
- localStorage.setItem('courseDate', item.courseDate);
|
|
|
+ localStorage.setItem('courseDate', `${item.courseDate.split(' ')[0]}(${item.lessonStartTime} ~ ${item.lessonEndTime})`);
|
|
|
}}
|
|
|
className={item.id === activeCourseKey ? 'course-active' : ''}
|
|
|
>
|
|
|
<Image
|
|
|
width={'100%'}
|
|
|
- style={{ aspectRatio: '16/9', borderRadius: '15px 15px 0 0' }}
|
|
|
+ style={{ aspectRatio: '16/9', borderRadius: '10px 10px 0 0' }}
|
|
|
preview={false}
|
|
|
src={CourseImage}
|
|
|
// src={item.fullScreenOssUrl + '?x-oss-process=video/snapshot,t_0,f_jpg,w_800,h_450'}
|
|
|
@@ -224,10 +244,13 @@ function SideMenu ({
|
|
|
<div className="course-info">
|
|
|
<div style={{ fontWeight: 'bold', fontSize: '18px' }}>{item.courseTitle}</div>
|
|
|
<div className="info-flex">
|
|
|
- <div>{item.subjectName}</div>
|
|
|
- <div>所属年级:{item.periodName}</div>
|
|
|
+ <div>学科:{item.subjectName}</div>
|
|
|
+ <div>班级:{`${item.periodName}${item.className}`}</div>
|
|
|
+ </div>
|
|
|
+ <div style={{ display: 'flex', justifyContent:'space-between', color: '#999999', fontSize: '12px' }}>
|
|
|
+ <div>{`${item.courseDate.split(' ')[0]}`}</div>
|
|
|
+ <div>{`${item.lessonStartTime} ~ ${item.lessonEndTime}`}</div>
|
|
|
</div>
|
|
|
- <div style={{ fontSize: '11px' }}>授课时间:{item.courseDate}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
))}
|