This commit is contained in:
nopy 2024-07-01 21:51:55 +08:00
commit 217197318a
5 changed files with 80 additions and 43 deletions

View File

@ -3,6 +3,8 @@ import { Link } from 'react-router-dom';
// import axios from 'axios';
import './Marking.css';
import Test from '../../pages/Home/img/test.jpg'
import React, { useEffect, useState } from 'react';
import axios from 'axios';
//
function Marking(){
@ -12,33 +14,80 @@ function Marking(){
window.location.href='http://36.138.114.105:30294/'
}
const [istrue,setistrue]=useState(false)
//
const [ClassID,setClassID]=useState()
const [selectClass,SetClassData]=useState()
const SeleactClass= async()=>{
try {
const select_class_src = await axios.post('/api/teacher/select_class', {
teacher_ID
});
SetClassData(select_class_src.data['Class']);
setClassID(Object.keys(select_class_src.data['Class'])[0])
setistrue(true)
} catch (error) {
console.log(error);
}
}
useEffect(()=>{
SeleactClass()
},[])
//
const [MarkData,setMarkData]=useState()
const MarkTrainFunc=async()=>{
try{
const MarkTrainSrc=await axios.post('/api/teacher/marktrain',{
ClassID,
teacher_ID
})
setMarkData(MarkTrainSrc.data['MarkClass'])
}catch{
alert('MarkTrain出错')
}
}
useEffect(()=>{
if(istrue){
MarkTrainFunc()
}
},[ClassID])
const ClassChange=(event)=>{
setClassID(event.target.value)
}
const click=()=>{
console.log(ClassID);
console.log(MarkData);
}
return(
<div className='body-right-mark'>
<select className='mark-list'>
<option value="2024级一班">2024级一班</option>
<option value="2024级二班">2024级二班</option>
<option value="2024级三班">2024级三班</option>
</select>
<div className='test-mark'>
{selectClass&&<select className='mark-list' onChange={ClassChange}>
{Object.keys(selectClass).map((key)=>(
<option value={key} key={key} >{key}</option>
))}
</select>}
{MarkData&&<div className='test-mark'>
{/* 内容 */}
<ul>
{[{class:'课程1:达梦数据库的安装',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test},
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test},
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test},
].map((item) =>
<Link style={{color:'#000',textDecoration:'none'}} to={'studentlink'}>
<li key={item.class}>
<img src={item.ImgSrc} alt="" width='35px' height='35px'/>
{Object.keys(MarkData).map((key)=>(
<Link style={{color:'#000',textDecoration:'none'}} to={`studentlink/Mark/${key}`}>
<li key={key}>
<img src={Test} alt="" width='35px' height='35px'/>
<p>
<p className='p-mark'>{item.class}</p>
<span>{item.time}</span>
<p className='p-mark'>{eval(MarkData[key][0][11])}</p>
<span>{}</span><span></span>
</p>
</li>
</Link>
)}
))}
</ul>
</div>
<button onClick={click}>asda</button>
</div>}
</div>
)

View File

@ -130,7 +130,7 @@ function SendTest(){
</div>
<div className='SendTest_body_right'>
<p>题目选择</p>
{<table>
{question&&<table>
<span className='title'>选择题</span>
{Object.keys(question['choice']).map((key)=>(
<tr key={key}>
@ -207,11 +207,6 @@ function SendTest(){
</table>}
<button onClick={SendTrainBtn} id='SendTrainBtn'>发布按钮</button>
</div>
{/* 右边的内容 */}

View File

@ -134,9 +134,6 @@ function SendTrain(){
}
//
const [StopTime,SetStopTime]=useState('')
const getstoptime=(event)=>{
SetStopTime(event.target.value)
}
//
const [startDate, setStartDate] = useState(new Date());
@ -323,10 +320,10 @@ function SendTrain(){
<option value={num} key={num}>{num}</option>
))}
</select>小时
{/* <button onClick={()=>{
console.log(selectedItems);
console.log(Train);
}}>asd</button> */}
<button onClick={()=>{
console.log(startDate);
console.log(endDate);
}}>asd</button>
<select name="" id="" value={MinValue} onChange={getminvalue}>
{min_list.map((num)=>(
<option value={num} key={num}>{num}</option>

5
app-dm/src/pages/ListPages/Training/TrainingPage.jsx Executable file → Normal file
View File

@ -43,10 +43,6 @@ const WarningModal = ({ isOpen, onClose }) => {
return null;
};
const list4=[
{'train':'实训3待定',id:'3'},
{'train':'实训4待定',id:'4'}
]
//
function SubjectPage(){
@ -94,6 +90,7 @@ function SubjectPage(){
{Object.keys(title).map((key)=>(
<div className='test-box-training' key={key}>
<p>实训:{eval(title[key][0][11])}</p>
<span>实训ID:{(title[key][0][10])}</span>
<span>发布者:陈老师</span>
<div>发布时间:{title[key][0][5]}</div>
<div>截至时间:{title[key][0][6]}</div>

View File

@ -26,9 +26,8 @@ import Marking from '../TeacherPages/MarkingPages/Marking';
import StudentLink from '../TeacherPages/MarkingPages/StudentLink';
import SendTrain from '../TeacherPages/TrainManage/SendTrain';
import TrainManage from '../TeacherPages/TrainManage/Trainmanage';
import Test from "../TeacherPages/teacherManagetest/Test.tsx"
import SendTrain from '../TeacherPages/Trainmanage/SendTrain';
import TrainManage from '../TeacherPages/Trainmanage/Trainmanage';
// (exam)使
const MainLayout = ({ headerNav:HeaderNav }) => {
return (