|
|
@@ -1,11 +1,14 @@
|
|
|
-import React, { useState } from 'react';
|
|
|
-import { Button, Input, Space } from 'antd';
|
|
|
+import React, { useEffect, useState } from 'react';
|
|
|
+import { Button, Image, Input, Space } from 'antd';
|
|
|
import { ReactComponent as SvgLogo } from '@/icons/logo.svg';
|
|
|
|
|
|
|
|
|
import './styles/side-menu.less';
|
|
|
import { SearchOutlined } from '@ant-design/icons';
|
|
|
import ProList from '@ant-design/pro-list';
|
|
|
+import { history } from '@@/core/history';
|
|
|
+import CourseImage from '@/assets/img/course_image.png';
|
|
|
+import { useLocation } from '@@/exports';
|
|
|
|
|
|
|
|
|
interface SideMenuProps {
|
|
|
@@ -16,8 +19,10 @@ interface SideMenuProps {
|
|
|
function SideMenu ({
|
|
|
initWidth = 200,
|
|
|
}: SideMenuProps) {
|
|
|
+ const location = useLocation();
|
|
|
+ const [isLessionPage, setIsLessionPage] = useState<boolean>(false);
|
|
|
const [activeKey, setActiveKey] = useState<string | number>('');
|
|
|
- const data = [
|
|
|
+ const teacherData = [
|
|
|
{
|
|
|
teacherName: '张三',
|
|
|
schoolName: '清华大学',
|
|
|
@@ -41,6 +46,47 @@ function SideMenu ({
|
|
|
avatar: false,
|
|
|
}));
|
|
|
|
|
|
+ const lessonData = [
|
|
|
+ {
|
|
|
+ lessonId: '1',
|
|
|
+ lessonName: '第一课第一节',
|
|
|
+ subjectName: '数学',
|
|
|
+ grade: '初一',
|
|
|
+ teachTime: '2025-05-01 10:00:00',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lessonId: '2',
|
|
|
+ lessonName: '第一课第一节',
|
|
|
+ subjectName: '数学',
|
|
|
+ grade: '初一',
|
|
|
+ teachTime: '2025-05-01 10:00:00',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lessonId: '3',
|
|
|
+ lessonName: '第一课第一节',
|
|
|
+ subjectName: '数学',
|
|
|
+ grade: '初一',
|
|
|
+ teachTime: '2025-05-01 10:00:00',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ lessonId: '4',
|
|
|
+ lessonName: '第一课第一节',
|
|
|
+ subjectName: '数学',
|
|
|
+ grade: '初一',
|
|
|
+ teachTime: '2025-05-01 10:00:00',
|
|
|
+ },
|
|
|
+ ];
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if(location.pathname) {
|
|
|
+ if(location.pathname.includes('play')) {
|
|
|
+ setIsLessionPage(true);
|
|
|
+ } else {
|
|
|
+ setIsLessionPage(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, [location.pathname]);
|
|
|
+
|
|
|
return (
|
|
|
<div style={{ width: initWidth, height: '100vh' }}>
|
|
|
<div className="side-header">
|
|
|
@@ -48,45 +94,116 @@ function SideMenu ({
|
|
|
<h3 className="header-title-text">评审管理系统</h3>
|
|
|
</div>
|
|
|
<div className="side-search">
|
|
|
- <div
|
|
|
- style={{
|
|
|
- color: 'black',
|
|
|
- fontSize: 16,
|
|
|
- fontWeight: 'bold',
|
|
|
- margin: '20px 0 20px 10px',
|
|
|
- textAlign: 'left',
|
|
|
- }}
|
|
|
- >
|
|
|
- 参评教师
|
|
|
- </div>
|
|
|
- <Space direction="horizontal" style={{ padding: '0 10px' }}>
|
|
|
- <Input placeholder="输入教师姓名搜索" />
|
|
|
- <Button icon={<SearchOutlined />} type="primary" />
|
|
|
- </Space>
|
|
|
+ {
|
|
|
+ isLessionPage ?
|
|
|
+ (
|
|
|
+ <div>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ color: 'black',
|
|
|
+ fontSize: 16,
|
|
|
+ fontWeight: 'bold',
|
|
|
+ margin: '20px 0 20px 10px',
|
|
|
+ textAlign: 'left',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 张三
|
|
|
+ </div>
|
|
|
+ <Space direction="horizontal" style={{ padding: '0 10px' }}>
|
|
|
+ <Input placeholder="输入课时名称搜索" />
|
|
|
+ <Button icon={<SearchOutlined />} type="primary" />
|
|
|
+ </Space>
|
|
|
+ </div>) :
|
|
|
+ (
|
|
|
+ <div>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ color: 'black',
|
|
|
+ fontSize: 16,
|
|
|
+ fontWeight: 'bold',
|
|
|
+ margin: '20px 0 20px 10px',
|
|
|
+ textAlign: 'left',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 参评教师
|
|
|
+ </div>
|
|
|
+ <Space direction="horizontal" style={{ padding: '0 10px' }}>
|
|
|
+ <Input placeholder="输入教师姓名搜索" />
|
|
|
+ <Button icon={<SearchOutlined />} type="primary" />
|
|
|
+ </Space>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
</div>
|
|
|
<div className="menu-area">
|
|
|
- <ProList<any>
|
|
|
- pagination={false}
|
|
|
- showActions="hover"
|
|
|
- onItem={(record) => {
|
|
|
- return {
|
|
|
- onClick: () => {
|
|
|
- setActiveKey(record.title);
|
|
|
- },
|
|
|
- };
|
|
|
- }}
|
|
|
- rowClassName={(record: { title: string }) =>
|
|
|
- record.title === activeKey ? 'active' : ''
|
|
|
- }
|
|
|
- metas={{
|
|
|
- title: {},
|
|
|
- description: {
|
|
|
- render: (text) => <div style={{ textAlign: 'left' }}>{text}</div>,
|
|
|
- },
|
|
|
- avatar: {},
|
|
|
- }}
|
|
|
- dataSource={data}
|
|
|
- />
|
|
|
+ {
|
|
|
+ isLessionPage ? (
|
|
|
+ <ProList<any>
|
|
|
+ pagination={false}
|
|
|
+ showActions="hover"
|
|
|
+ onItem={(record) => {
|
|
|
+ return {
|
|
|
+ onClick: () => {
|
|
|
+ setActiveKey(record.lessonId);
|
|
|
+ },
|
|
|
+ };
|
|
|
+ }}
|
|
|
+ rowClassName={(record: { lessonId: string }) =>
|
|
|
+ record.lessonId === activeKey ? 'active' : ''
|
|
|
+ }
|
|
|
+ renderItem={(item) => (
|
|
|
+ <div
|
|
|
+ style={{ backgroundColor: '#F8FAFC', cursor: 'pointer', margin: '0 10px' }}
|
|
|
+ onClick={() => {
|
|
|
+ history.push('/play?id=' + item.lessonId);
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Image
|
|
|
+ width={'100%'}
|
|
|
+ style={{ aspectRatio: '16/9', borderRadius: '15px 15px 0 0' }}
|
|
|
+ preview={false}
|
|
|
+ src={CourseImage}
|
|
|
+ />
|
|
|
+ <div className="course-info">
|
|
|
+ <div style={{ fontWeight: 'bold', fontSize: '18px' }}>{item.lessonName}</div>
|
|
|
+ <div className="info-flex">
|
|
|
+ <div>{item.subjectName}</div>
|
|
|
+ <div>所属年级:{item.grade}</div>
|
|
|
+ </div>
|
|
|
+ <div style={{ fontSize: '11px' }}>授课时间:{item.teachTime}</div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ metas={{
|
|
|
+ actions: {},
|
|
|
+ }}
|
|
|
+ dataSource={lessonData}
|
|
|
+ />
|
|
|
+ ) : (
|
|
|
+ <ProList<any>
|
|
|
+ pagination={false}
|
|
|
+ showActions="hover"
|
|
|
+ onItem={(record) => {
|
|
|
+ return {
|
|
|
+ onClick: () => {
|
|
|
+ setActiveKey(record.title);
|
|
|
+ },
|
|
|
+ };
|
|
|
+ }}
|
|
|
+ rowClassName={(record: { title: string }) =>
|
|
|
+ record.title === activeKey ? 'active' : ''
|
|
|
+ }
|
|
|
+ metas={{
|
|
|
+ title: {},
|
|
|
+ description: {
|
|
|
+ render: (text) => <div style={{ textAlign: 'left' }}>{text}</div>,
|
|
|
+ },
|
|
|
+ avatar: {},
|
|
|
+ }}
|
|
|
+ dataSource={teacherData}
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }
|
|
|
</div>
|
|
|
</div>
|
|
|
);
|