This commit is contained in:
parent
385044da04
commit
e686473d9a
|
@ -79,8 +79,8 @@ function Marking(){
|
||||||
<li key={key}>
|
<li key={key}>
|
||||||
<img src={Test} alt="" width='35px' height='35px'/>
|
<img src={Test} alt="" width='35px' height='35px'/>
|
||||||
<p>
|
<p>
|
||||||
<p className='p-mark'>{eval(MarkData[key][0][11])}</p>
|
<p className='p-mark'><span>实训ID:{MarkData[key][0][10]}</span>{eval(MarkData[key][0][11])}</p>
|
||||||
<span>{}</span><span></span>
|
<span>{MarkData[key][0][6]}</span><span></span>
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
|
@ -1,8 +1,33 @@
|
||||||
import './StudentLink.css'
|
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(){
|
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(
|
return(
|
||||||
<div className='body-right-studentlink'>
|
<div className='body-right-studentlink'>
|
||||||
<table>
|
<table>
|
||||||
|
@ -13,14 +38,17 @@ function StudentLink(){
|
||||||
<th>分数</th>
|
<th>分数</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
{TestLink&&<tbody>
|
||||||
<tr>
|
{Object.keys(TestLink).map((key)=>(
|
||||||
<td>数据1</td>
|
<tr key={key}>
|
||||||
<td>数据2</td>
|
<td>{key}</td>
|
||||||
<td>数据3</td>
|
<td><Link to={TestLink[key][6]}>{TestLink[key][6]}</Link></td>
|
||||||
|
<td><input type="text" name="" id="" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
))}
|
||||||
|
</tbody>}
|
||||||
</table>
|
</table>
|
||||||
|
<button onClick={submit}>提交</button>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,9 @@ function SendTrain(){
|
||||||
StopTime,
|
StopTime,
|
||||||
selectedItems,
|
selectedItems,
|
||||||
Train,
|
Train,
|
||||||
teacher_ID
|
teacher_ID,
|
||||||
|
startDate,
|
||||||
|
endDate
|
||||||
})
|
})
|
||||||
alert('发布成功')
|
alert('发布成功')
|
||||||
window.location.href='http://localhost:3000/teacher/trainmanage'
|
window.location.href='http://localhost:3000/teacher/trainmanage'
|
||||||
|
@ -90,7 +92,7 @@ function SendTrain(){
|
||||||
|
|
||||||
|
|
||||||
const SendTrainBtn=()=>{
|
const SendTrainBtn=()=>{
|
||||||
if(selectedItems.length>0 && (HourValue || MinValue)&&StopTime){
|
if(selectedItems.length>0 && (HourValue || MinValue)){
|
||||||
if(Train.length>0){
|
if(Train.length>0){
|
||||||
SendTrainTest()
|
SendTrainTest()
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -62,14 +62,13 @@ function App() {
|
||||||
<Route path='mark' element={<Marking/>}/> {/* 批改 */}
|
<Route path='mark' element={<Marking/>}/> {/* 批改 */}
|
||||||
<Route path='managetest' element={<ManageTest />}/> {/* 考试管理 */}
|
<Route path='managetest' element={<ManageTest />}/> {/* 考试管理 */}
|
||||||
<Route path="classID/:key" element={<ClassID />} /> {/* 班级管理1 */}
|
<Route path="classID/:key" element={<ClassID />} /> {/* 班级管理1 */}
|
||||||
<Route path='mark/studentlink' element={<StudentLink/>}/> {/* 批改1 */}
|
<Route path='mark/studentlink/Mark/:key' element={<StudentLink/>}/> {/* 批改1 */}
|
||||||
{/* 其他需要HeaderNavTeacher的页面 */}
|
{/* 其他需要HeaderNavTeacher的页面 */}
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
<Route path="/classID/:key" element={<MainLayout headerNav={HeaderNavTeacher} />}>
|
<Route path="/classID/:key" element={<MainLayout headerNav={HeaderNavTeacher} />}>
|
||||||
<Route index element={<ClassID/>} />
|
<Route index element={<ClassID/>} />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="test" element={<Test />}/>
|
|
||||||
|
|
||||||
{/* 页面使用单独的布局,不包含HeaderNav和HeaderNavTeacher */}
|
{/* 页面使用单独的布局,不包含HeaderNav和HeaderNavTeacher */}
|
||||||
<Route path="exam/:examId" element={<Exam />} />{/* 练习-考试页面 */}
|
<Route path="exam/:examId" element={<Exam />} />{/* 练习-考试页面 */}
|
||||||
|
|
|
@ -256,11 +256,12 @@ def SendTrainTest():
|
||||||
TrainJudge=data['TrainJudge']
|
TrainJudge=data['TrainJudge']
|
||||||
Hour=data['HourValue']
|
Hour=data['HourValue']
|
||||||
Min=data['MinValue']
|
Min=data['MinValue']
|
||||||
StopTime=data['StopTime']
|
|
||||||
Class=data['selectedItems']
|
Class=data['selectedItems']
|
||||||
Train=data['Train']
|
Train=data['Train']
|
||||||
teacher_id=data['teacher_ID']
|
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)
|
TeacherMark(Class,teacher_id)
|
||||||
return '发布成功'
|
return '发布成功'
|
||||||
|
|
||||||
|
@ -272,6 +273,12 @@ def Find_details():
|
||||||
result=Find_details_Func(ID)
|
result=Find_details_Func(ID)
|
||||||
return jsonify({'TestScore':result})
|
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('/')
|
||||||
@app.route('/<path:path>')
|
@app.route('/<path:path>')
|
||||||
|
@ -330,5 +337,6 @@ def handle_disconnect():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
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)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -224,7 +224,7 @@ def train_question():
|
||||||
testID=None
|
testID=None
|
||||||
TrainName=""
|
TrainName=""
|
||||||
# train_question()
|
# 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)
|
TrainChoice = json.dumps(TrainChoice)
|
||||||
TrainCompletion = json.dumps(TrainCompletion)
|
TrainCompletion = json.dumps(TrainCompletion)
|
||||||
TrainJudge = json.dumps(TrainJudge)
|
TrainJudge = json.dumps(TrainJudge)
|
||||||
|
@ -232,17 +232,14 @@ def SendTrainTestFunc(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,StopTime,C
|
||||||
Train=json.dumps(Train)
|
Train=json.dumps(Train)
|
||||||
global TrainName
|
global TrainName
|
||||||
TrainName=Train
|
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 = db.cursor()
|
||||||
cursor.execute(f'INSERT INTO TRAINTEST (CHOICE,COMPLE,JUDGE,HOUR,MIN,RELEASETIME,STOPTIME,CLASS,SUBJECT,TEACHER_ID,Train) VALUES'
|
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()
|
db.commit()
|
||||||
print('添加成功')
|
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]
|
test_id = cursor.fetchall()[0][0]
|
||||||
# 查找学生
|
# 查找学生
|
||||||
student_list = []
|
student_list = []
|
||||||
|
@ -326,3 +323,16 @@ def MarkTrainFunc(ClassID,teacher_ID):
|
||||||
return dic
|
return dic
|
||||||
|
|
||||||
# MarkTrainFunc('202401','111111')
|
# 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')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue