This commit is contained in:
30404 2024-07-02 13:00:21 +08:00
parent 385044da04
commit e686473d9a
6 changed files with 70 additions and 23 deletions

View File

@ -79,8 +79,8 @@ function Marking(){
<li key={key}>
<img src={Test} alt="" width='35px' height='35px'/>
<p>
<p className='p-mark'>{eval(MarkData[key][0][11])}</p>
<span>{}</span><span></span>
<p className='p-mark'><span>实训ID:{MarkData[key][0][10]}</span>{eval(MarkData[key][0][11])}</p>
<span>{MarkData[key][0][6]}</span><span></span>
</p>
</li>
</Link>

View File

@ -1,8 +1,33 @@
import './StudentLink.css'
import { useParams } from 'react-router-dom';
import React, { useEffect, useState } from 'react';
import { Link } from 'react-router-dom';
import axios from 'axios';
function StudentLink(){
const testID=useParams()['key']
const submit=()=>{
console.log(TestLink);
}
const [TestLink,setTestLink]=useState()
const NotMarkTestFunc=async ()=>{
try{
const NotMarkTestSrc=await axios.post('/api/teacher/NotMarkTest',{
testID
})
setTestLink(NotMarkTestSrc.data['result'])
}catch{
alert('出错')
}
}
useEffect(()=>{
NotMarkTestFunc()
},[])
return(
<div className='body-right-studentlink'>
<table>
@ -13,14 +38,17 @@ function StudentLink(){
<th>分数</th>
</tr>
</thead>
<tbody>
<tr>
<td>数据1</td>
<td>数据2</td>
<td>数据3</td>
{TestLink&&<tbody>
{Object.keys(TestLink).map((key)=>(
<tr key={key}>
<td>{key}</td>
<td><Link to={TestLink[key][6]}>{TestLink[key][6]}</Link></td>
<td><input type="text" name="" id="" /></td>
</tr>
</tbody>
))}
</tbody>}
</table>
<button onClick={submit}>提交</button>
</div>
)
}

View File

@ -78,7 +78,9 @@ function SendTrain(){
StopTime,
selectedItems,
Train,
teacher_ID
teacher_ID,
startDate,
endDate
})
alert('发布成功')
window.location.href='http://localhost:3000/teacher/trainmanage'
@ -90,7 +92,7 @@ function SendTrain(){
const SendTrainBtn=()=>{
if(selectedItems.length>0 && (HourValue || MinValue)&&StopTime){
if(selectedItems.length>0 && (HourValue || MinValue)){
if(Train.length>0){
SendTrainTest()
}else{

View File

@ -62,14 +62,13 @@ function App() {
<Route path='mark' element={<Marking/>}/> {/* 批改 */}
<Route path='managetest' element={<ManageTest />}/> {/* 考试管理 */}
<Route path="classID/:key" element={<ClassID />} /> {/* 班级管理1 */}
<Route path='mark/studentlink' element={<StudentLink/>}/> {/* 批改1 */}
<Route path='mark/studentlink/Mark/:key' element={<StudentLink/>}/> {/* 批改1 */}
{/* 其他需要HeaderNavTeacher的页面 */}
</Route>
<Route path="/classID/:key" element={<MainLayout headerNav={HeaderNavTeacher} />}>
<Route index element={<ClassID/>} />
</Route>
<Route path="test" element={<Test />}/>
{/* 页面使用单独的布局不包含HeaderNav和HeaderNavTeacher */}
<Route path="exam/:examId" element={<Exam />} />{/* 练习-考试页面 */}

View File

@ -256,11 +256,12 @@ def SendTrainTest():
TrainJudge=data['TrainJudge']
Hour=data['HourValue']
Min=data['MinValue']
StopTime=data['StopTime']
Class=data['selectedItems']
Train=data['Train']
teacher_id=data['teacher_ID']
SendTrainTestFunc(TrainChoice, TrainCompletion, TrainJudge, Hour, Min, StopTime,Class,Train,teacher_id)
startTime=data['startDate']
endTime=data['endDate']
SendTrainTestFunc(TrainChoice, TrainCompletion, TrainJudge, Hour, Min,Class,Train,teacher_id,startTime,endTime)
TeacherMark(Class,teacher_id)
return '发布成功'
@ -272,6 +273,12 @@ def Find_details():
result=Find_details_Func(ID)
return jsonify({'TestScore':result})
@app.route('/api/teacher/NotMarkTest',methods=["POST"])
def NotMark():
testID=request.json['testID']
result=NotMarkTest(testID)
return jsonify({'result':result})
@app.route('/')
@app.route('/<path:path>')
@ -330,5 +337,6 @@ def handle_disconnect():
if __name__ == '__main__':
socketio.run(app, host='0.0.0.0', port=5000 ,allow_unsafe_werkzeug=True)
socketio.run(app, host='0.0.0.0', port=5000 ,allow_unsafe_werkzeug=True, debug=True)

View File

@ -224,7 +224,7 @@ def train_question():
testID=None
TrainName=""
# train_question()
def SendTrainTestFunc(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,StopTime,Class,Train,teacher_id):
def SendTrainTestFunc(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,Class,Train,teacher_id,startTime,endTime):
TrainChoice = json.dumps(TrainChoice)
TrainCompletion = json.dumps(TrainCompletion)
TrainJudge = json.dumps(TrainJudge)
@ -232,17 +232,14 @@ def SendTrainTestFunc(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,StopTime,C
Train=json.dumps(Train)
global TrainName
TrainName=Train
# 获取当前时间
now_time = datetime.datetime.now().replace(microsecond=0)
end_time = now_time + datetime.timedelta(days=int(StopTime))
end_time = end_time.replace(microsecond=0)
cursor = db.cursor()
cursor.execute(f'INSERT INTO TRAINTEST (CHOICE,COMPLE,JUDGE,HOUR,MIN,RELEASETIME,STOPTIME,CLASS,SUBJECT,TEACHER_ID,Train) VALUES'
f'(?,?,?,?,?,?,?,?,?,?,?)',(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,now_time,end_time,Class,'Train',teacher_id,Train))
f'(?,?,?,?,?,?,?,?,?,?,?)',(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,startTime,endTime,Class,'Train',teacher_id,Train))
db.commit()
print('添加成功')
cursor.execute(f'SELECT ID FROM TRAINTEST WHERE RELEASETIME=?', (now_time,))
cursor.execute(f'SELECT ID FROM TRAINTEST WHERE RELEASETIME=?', (startTime,))
test_id = cursor.fetchall()[0][0]
# 查找学生
student_list = []
@ -326,3 +323,16 @@ def MarkTrainFunc(ClassID,teacher_ID):
return dic
# MarkTrainFunc('202401','111111')
def NotMarkTest(testID):
cursor = db.cursor()
dic={}
cursor.execute(f'SELECT * FROM TRAINSCORE WHERE TEST_ID=?',(testID))
for i in cursor.fetchall():
cursor.execute(f'SELECT NAME FROM STUDENT WHERE ID=?',(i[0]))
dic[cursor.fetchall()[0][0]]=i
return dic
NotMarkTest('9')