123
This commit is contained in:
parent
0dc1bba456
commit
69ebafcceb
|
@ -113,3 +113,17 @@
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-left: 52px;
|
margin-left: 52px;
|
||||||
}
|
}
|
||||||
|
.TrainBox{
|
||||||
|
width: 1000px;
|
||||||
|
height: 500px;
|
||||||
|
background-color: aqua;
|
||||||
|
}
|
||||||
|
.TrainBox table{
|
||||||
|
margin-top: 200px;
|
||||||
|
margin-left: 400px;
|
||||||
|
width: 500px;
|
||||||
|
text-align: center;
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
||||||
|
.TrainBox th{
|
||||||
|
}
|
|
@ -6,8 +6,9 @@ import React, { useEffect, useState } from 'react';
|
||||||
|
|
||||||
function TrainManage(){
|
function TrainManage(){
|
||||||
const teacher_ID=localStorage.getItem('islogin')
|
const teacher_ID=localStorage.getItem('islogin')
|
||||||
|
const [isTrue,setisTrue]=useState(false)
|
||||||
const [Data,setData]=useState([])
|
const [Data,setData]=useState([])
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(true);
|
||||||
const [selectedTrain, setSelectedTrain] = useState(null);
|
const [selectedTrain, setSelectedTrain] = useState(null);
|
||||||
const [testID,settestID]=useState()
|
const [testID,settestID]=useState()
|
||||||
const [TrainData,setTrainData]=useState()
|
const [TrainData,setTrainData]=useState()
|
||||||
|
@ -39,16 +40,19 @@ function TrainManage(){
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
|
if(isTrue){
|
||||||
getTrainData()
|
getTrainData()
|
||||||
|
}else{
|
||||||
|
setisTrue(true)
|
||||||
|
}
|
||||||
},[testID])
|
},[testID])
|
||||||
|
|
||||||
|
const Click=(testID,train)=>{
|
||||||
|
settestID(testID)
|
||||||
|
setSelectedTrain(train)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const handleTrainClick = (train) => {
|
|
||||||
setSelectedTrain(train);
|
|
||||||
setShowModal(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className='body-trainmanage'>
|
<div className='body-trainmanage'>
|
||||||
<p className='title'>已结束的实训</p>
|
<p className='title'>已结束的实训</p>
|
||||||
|
@ -56,7 +60,7 @@ function TrainManage(){
|
||||||
{Data&&<div className='train-list-trainmanage'>
|
{Data&&<div className='train-list-trainmanage'>
|
||||||
<ul className="ul-trainmanage">
|
<ul className="ul-trainmanage">
|
||||||
{Object.keys(Data).map((key)=>(
|
{Object.keys(Data).map((key)=>(
|
||||||
<li key={key} onClick={() => handleTrainClick(key)}>
|
<li key={key} onClick={()=>Click(Data[key][10],eval(Data[key][11]))}>
|
||||||
<span>实训ID:{Data[key][10]}</span>
|
<span>实训ID:{Data[key][10]}</span>
|
||||||
<h6 className='TrainTitle'>实训名称:{eval(Data[key][11])}</h6>
|
<h6 className='TrainTitle'>实训名称:{eval(Data[key][11])}</h6>
|
||||||
<p>关闭时间:{Data[key][6]}</p>
|
<p>关闭时间:{Data[key][6]}</p>
|
||||||
|
@ -66,42 +70,33 @@ function TrainManage(){
|
||||||
<Link to='/teacher/trainmanage/TrainPods' className='ManagePods' >管理实训</Link>
|
<Link to='/teacher/trainmanage/TrainPods' className='ManagePods' >管理实训</Link>
|
||||||
<Link to='/teacher/SendTrain' className='sendtestpage'>发布实训</Link>
|
<Link to='/teacher/SendTrain' className='sendtestpage'>发布实训</Link>
|
||||||
</div>}
|
</div>}
|
||||||
|
<div className='TrainBox'>
|
||||||
|
|
||||||
{/* 弹窗组件 */}
|
|
||||||
{showModal && (
|
|
||||||
<div className='modal'>
|
|
||||||
<div className='modal-content'>
|
|
||||||
<span className='close' onClick={() => setShowModal(false)}>×</span>
|
|
||||||
<h2>实训信息</h2>
|
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>实训ID</th>
|
<th>姓名</th>
|
||||||
<th>实训名称</th>
|
<th>ID</th>
|
||||||
<th>学号</th>
|
|
||||||
<th>基础成绩</th>
|
<th>基础成绩</th>
|
||||||
<th>实训成绩</th>
|
<th>实训成绩</th>
|
||||||
<th>总成绩</th>
|
<th>总成绩</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{selectedTrain && selectedTrain.students.map((student, index) => (
|
{Object.keys(TrainData).map((key)=>(
|
||||||
<tr key={index}>
|
<tr key={key}>
|
||||||
<td>{selectedTrain[10]}</td>
|
<td>{key}</td>
|
||||||
<td>{eval(selectedTrain[11])}</td>
|
<td>{TrainData[key][0]}</td>
|
||||||
<td>{student.studentID}</td>
|
<td>{TrainData[key][4]}</td>
|
||||||
<td>{student.baseScore}</td>
|
<td>{TrainData[key][5]}</td>
|
||||||
<td>{student.trainScore}</td>
|
<td>{parseInt(TrainData[key][4])+parseInt(TrainData[key][5])}</td>
|
||||||
<td>{student.totalScore}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<button onClick={()=>{
|
||||||
)}
|
console.log(TrainData);
|
||||||
|
}}></button>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -342,11 +342,9 @@ def appendQuestion():
|
||||||
def getTrainData():
|
def getTrainData():
|
||||||
testID=request.json['testID']
|
testID=request.json['testID']
|
||||||
print(testID)
|
print(testID)
|
||||||
if testID:
|
|
||||||
data = getTrainDataFunc(testID)
|
data = getTrainDataFunc(testID)
|
||||||
return jsonify({'data': data})
|
return jsonify({'data': data})
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -456,10 +456,20 @@ def appendQuestionFunc(subject,chapter,inputValue,A,B,C,D,correct,judgeValue):
|
||||||
return 'INSERT'
|
return 'INSERT'
|
||||||
|
|
||||||
def getTrainDataFunc(testID):
|
def getTrainDataFunc(testID):
|
||||||
|
dic={}
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute(f'SELECT * FROM TRAINSCORE WHERE TEST_ID=? ',(testID,))
|
cursor.execute(f'SELECT * FROM TRAINSCORE WHERE TEST_ID=? ',(testID,))
|
||||||
data = cursor.fetchall()
|
data = cursor.fetchall()
|
||||||
|
for i in data:
|
||||||
|
cursor.execute(f'SELECT NAME FROM STUDENT WHERE ID=? ', (i[0],))
|
||||||
|
name=cursor.fetchall()[0][0]
|
||||||
|
dic[name]=i
|
||||||
|
|
||||||
|
|
||||||
|
print(dic)
|
||||||
cursor.close()
|
cursor.close()
|
||||||
return data
|
return dic
|
||||||
|
|
||||||
|
# getTrainDataFunc('71')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue