|
|
@@ -1,18 +1,22 @@
|
|
|
import {
|
|
|
PageContainer,
|
|
|
} from '@ant-design/pro-components';
|
|
|
-import React, { useEffect, useState } from 'react';
|
|
|
+import React, { useEffect, useRef, useState } from 'react';
|
|
|
import ProList from '@ant-design/pro-list';
|
|
|
import { Image, Tabs } from 'antd';
|
|
|
import './style/index.less';
|
|
|
import CourseImage from '@/assets/img/course_image.png';
|
|
|
import { history } from "@umijs/max";
|
|
|
import { useLocation, useRouteProps } from '@@/exports';
|
|
|
+import { getTeacherCourses } from '@/services/record/RecordController';
|
|
|
+import { ActionType } from '@ant-design/pro-table/lib';
|
|
|
|
|
|
const TableList: React.FC<unknown> = () => {
|
|
|
const routeProps = useRouteProps();
|
|
|
const location = useLocation();
|
|
|
const [selectedKeys, setSelectedKeys] = useState(location.pathname);
|
|
|
+ const [teacherId, setTeacherId] = useState<string>('');
|
|
|
+ const actionRef = useRef<ActionType>();
|
|
|
|
|
|
useEffect(() => {
|
|
|
if(location.pathname) {
|
|
|
@@ -20,6 +24,17 @@ const TableList: React.FC<unknown> = () => {
|
|
|
}
|
|
|
}, [location.pathname]);
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ if(location.search) {
|
|
|
+ const searchParams = new URLSearchParams(location.search);
|
|
|
+ setTeacherId(searchParams.get('teacherId') as string);
|
|
|
+ if (actionRef.current) {
|
|
|
+ actionRef.current?.reload()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, [location.search]);
|
|
|
+
|
|
|
+
|
|
|
const data = [
|
|
|
{
|
|
|
courseId: '1',
|
|
|
@@ -142,6 +157,7 @@ const TableList: React.FC<unknown> = () => {
|
|
|
/>
|
|
|
<ProList<any>
|
|
|
search={{}}
|
|
|
+ actionRef={actionRef}
|
|
|
className="table-box"
|
|
|
pagination={{
|
|
|
defaultPageSize: 20,
|
|
|
@@ -178,8 +194,8 @@ const TableList: React.FC<unknown> = () => {
|
|
|
<div>授课老师:{item.teacherName}</div>
|
|
|
</div>
|
|
|
<div className="info-flex">
|
|
|
- <div>授课时间:{item.teacherTime}</div>
|
|
|
- <div>授课班级:{item.classRoom}</div>
|
|
|
+ <div>授课时间:{item.courseDate}</div>
|
|
|
+ <div>授课班级:{item.classroomName}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -208,7 +224,17 @@ const TableList: React.FC<unknown> = () => {
|
|
|
},
|
|
|
actions: {},
|
|
|
}}
|
|
|
- dataSource={data}
|
|
|
+ request={async (params) => {
|
|
|
+ const { pageSize } = params
|
|
|
+ const data = await getTeacherCourses({
|
|
|
+ teacherId: teacherId,
|
|
|
+ size: pageSize,
|
|
|
+ })
|
|
|
+ return {
|
|
|
+ data: data.data.records,
|
|
|
+ total: data.data.total,
|
|
|
+ };
|
|
|
+ }}
|
|
|
/>
|
|
|
</PageContainer>
|
|
|
);
|