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 axios from 'axios';
import './Marking.css'; import './Marking.css';
import Test from '../../pages/Home/img/test.jpg' import Test from '../../pages/Home/img/test.jpg'
import React, { useEffect, useState } from 'react';
import axios from 'axios';
// //
function Marking(){ function Marking(){
@ -12,33 +14,80 @@ function Marking(){
window.location.href='http://36.138.114.105:30294/' 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( return(
<div className='body-right-mark'> <div className='body-right-mark'>
<select className='mark-list'> {selectClass&&<select className='mark-list' onChange={ClassChange}>
<option value="2024级一班">2024级一班</option> {Object.keys(selectClass).map((key)=>(
<option value="2024级二班">2024级二班</option> <option value={key} key={key} >{key}</option>
<option value="2024级三班">2024级三班</option> ))}
</select> </select>}
<div className='test-mark'> {MarkData&&<div className='test-mark'>
{/* 内容 */} {/* 内容 */}
<ul> <ul>
{[{class:'课程1:达梦数据库的安装',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test}, {Object.keys(MarkData).map((key)=>(
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test}, <Link style={{color:'#000',textDecoration:'none'}} to={`studentlink/Mark/${key}`}>
{class:'课程2:web前端开发与数据库的结合',time:"关闭时间:2024-4-16 11.46",ImgSrc:Test}, <li key={key}>
].map((item) => <img src={Test} alt="" width='35px' height='35px'/>
<Link style={{color:'#000',textDecoration:'none'}} to={'studentlink'}> <p>
<li key={item.class}> <p className='p-mark'>{eval(MarkData[key][0][11])}</p>
<img src={item.ImgSrc} alt="" width='35px' height='35px'/> <span>{}</span><span></span>
<p> </p>
<p className='p-mark'>{item.class}</p> </li>
<span>{item.time}</span> </Link>
</p> ))}
</li>
</Link>
)}
</ul> </ul>
<button onClick={click}>asda</button>
</div> </div>}
</div> </div>
) )

View File

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

View File

@ -134,9 +134,6 @@ function SendTrain(){
} }
// //
const [StopTime,SetStopTime]=useState('') const [StopTime,SetStopTime]=useState('')
const getstoptime=(event)=>{
SetStopTime(event.target.value)
}
// //
const [startDate, setStartDate] = useState(new Date()); const [startDate, setStartDate] = useState(new Date());
@ -323,10 +320,10 @@ function SendTrain(){
<option value={num} key={num}>{num}</option> <option value={num} key={num}>{num}</option>
))} ))}
</select>小时 </select>小时
{/* <button onClick={()=>{ <button onClick={()=>{
console.log(selectedItems); console.log(startDate);
console.log(Train); console.log(endDate);
}}>asd</button> */} }}>asd</button>
<select name="" id="" value={MinValue} onChange={getminvalue}> <select name="" id="" value={MinValue} onChange={getminvalue}>
{min_list.map((num)=>( {min_list.map((num)=>(
<option value={num} key={num}>{num}</option> <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; return null;
}; };
const list4=[
{'train':'实训3待定',id:'3'},
{'train':'实训4待定',id:'4'}
]
// //
function SubjectPage(){ function SubjectPage(){
@ -94,6 +90,7 @@ function SubjectPage(){
{Object.keys(title).map((key)=>( {Object.keys(title).map((key)=>(
<div className='test-box-training' key={key}> <div className='test-box-training' key={key}>
<p>实训:{eval(title[key][0][11])}</p> <p>实训:{eval(title[key][0][11])}</p>
<span>实训ID:{(title[key][0][10])}</span>
<span>发布者:陈老师</span> <span>发布者:陈老师</span>
<div>发布时间:{title[key][0][5]}</div> <div>发布时间:{title[key][0][5]}</div>
<div>截至时间:{title[key][0][6]}</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 StudentLink from '../TeacherPages/MarkingPages/StudentLink';
import SendTrain from '../TeacherPages/TrainManage/SendTrain'; import SendTrain from '../TeacherPages/Trainmanage/SendTrain';
import TrainManage from '../TeacherPages/TrainManage/Trainmanage'; import TrainManage from '../TeacherPages/Trainmanage/Trainmanage';
import Test from "../TeacherPages/teacherManagetest/Test.tsx"
// (exam)使 // (exam)使
const MainLayout = ({ headerNav:HeaderNav }) => { const MainLayout = ({ headerNav:HeaderNav }) => {
return ( return (