diff --git a/app-dm/src/TeacherPages/MarkingPages/Marking.jsx b/app-dm/src/TeacherPages/MarkingPages/Marking.jsx index 4a07a49..4a2870f 100644 --- a/app-dm/src/TeacherPages/MarkingPages/Marking.jsx +++ b/app-dm/src/TeacherPages/MarkingPages/Marking.jsx @@ -77,7 +77,7 @@ function Marking(){

实训ID:{MarkData[key][0][10]}{eval(MarkData[key][0][11])}

-
{MarkData[key][0][6]>currentTime?'未开始':''}
+
{MarkData[key][0][6]>currentTime? ' ':'未开始'}
{MarkData[key][0][6]}

diff --git a/app-dm/src/TeacherPages/MarkingPages/StudentLink.css b/app-dm/src/TeacherPages/MarkingPages/StudentLink.css index d7b2527..3708e7a 100644 --- a/app-dm/src/TeacherPages/MarkingPages/StudentLink.css +++ b/app-dm/src/TeacherPages/MarkingPages/StudentLink.css @@ -7,4 +7,8 @@ border-radius: 10px; float: right; background-color: #f7f8fa; +} +.submit{ + margin-left: 1000px; + margin-top: 20px; } \ No newline at end of file diff --git a/app-dm/src/TeacherPages/MarkingPages/StudentLink.jsx b/app-dm/src/TeacherPages/MarkingPages/StudentLink.jsx index f2ea93e..353e484 100644 --- a/app-dm/src/TeacherPages/MarkingPages/StudentLink.jsx +++ b/app-dm/src/TeacherPages/MarkingPages/StudentLink.jsx @@ -13,7 +13,8 @@ function StudentLink(){ try{ const sumbitScoreSrc=await axios.post('/api/teacher/UpdateTest',{ score, - testID + testID, + suggestion }) }catch{ alert('提交出错') @@ -21,7 +22,6 @@ function StudentLink(){ } const submit=()=>{ - console.log('a'); sumbitScore() alert('批改成功') window.location.href='http://localhost:3000/teacher/mark' @@ -43,6 +43,7 @@ function StudentLink(){ },[]) const [score,setscore]=useState([]) + const [suggestion,setsuggestion]=useState([]) const handleInputChange = (event) => { const { name, value } = event.target; @@ -51,27 +52,44 @@ function StudentLink(){ [name]: value }); } + const handleInputChange2=(event)=>{ + const { name, value } = event.target; + setsuggestion({ + ...suggestion, + [name]: value + }); + } return(
- + {TestLink&&
- + + + + - {TestLink&& + {Object.keys(TestLink).map((key)=>( + + + ))} - } -
学生链接链接1链接2链接3 分数建议
{key} {TestLink[key][6]}{TestLink[key][7]}{TestLink[key][8]}
- + + } + +
) } diff --git a/app-dm/src/TeacherPages/TestManage/Test.jsx b/app-dm/src/TeacherPages/TestManage/Test.jsx index 0926e46..bf6ed27 100644 --- a/app-dm/src/TeacherPages/TestManage/Test.jsx +++ b/app-dm/src/TeacherPages/TestManage/Test.jsx @@ -5,7 +5,7 @@ import { useLocation } from 'react-router-dom'; import io, { Socket } from "socket.io-client"; -export default function Test({ ip = "10.106.152.68", port = "22", password = "123456", user = "dmdba" }) { +export default function Test({ ip = "", port = "22", password = "123456", user = "dmdba" }) { const location = useLocation(); const terminalObj = useRef(null); const [terminal, setTerminal] = useState(null); @@ -21,7 +21,7 @@ export default function Test({ ip = "10.106.152.68", port = "22", password = "12 if (terminal !== null) { terminal.open(terminalObj.current); - const newSocket = io("ws://36.138.114.105:32087"); + const newSocket = io("ws://36.138.114.105:31055"); setSocket(newSocket); terminal.onData((data) => { @@ -63,7 +63,7 @@ export default function Test({ ip = "10.106.152.68", port = "22", password = "12 return (
-
+
); diff --git a/app-dm/src/pages/ListPages/Training/Operation2.css b/app-dm/src/pages/ListPages/Training/Operation2.css index 5d24732..04f990e 100644 --- a/app-dm/src/pages/ListPages/Training/Operation2.css +++ b/app-dm/src/pages/ListPages/Training/Operation2.css @@ -75,7 +75,7 @@ /* 第二页(实训题题)的右边页面 */ .body-right2{ width: 1415px; - height: 845px; + height: 550px; position: absolute; top: 64px; left: 230px; @@ -84,6 +84,7 @@ } + /* 返回按钮 */ .btn-back2{ height: 50px; @@ -119,4 +120,8 @@ font-size: 20px; margin-left: 5px; } - +.detection{ + position: absolute; + margin-left: 1300px; + margin-top: -50px; +} diff --git a/app-dm/src/pages/ListPages/Training/Operation2.jsx b/app-dm/src/pages/ListPages/Training/Operation2.jsx index b075d57..34de325 100644 --- a/app-dm/src/pages/ListPages/Training/Operation2.jsx +++ b/app-dm/src/pages/ListPages/Training/Operation2.jsx @@ -55,10 +55,6 @@ function Operation2() { setisTrue(false) } },[]) - const click=()=>{ - console.log(Src); - } - //倒计时 // const { OperationId } = useParams(); @@ -109,6 +105,24 @@ function Operation2() { localStorage.removeItem('TrainData') } + //检测按钮 + const detection=async()=>{ + try{ + const detectionSrc=await axios.post('/api/student/check_pod',{ + student_ID, + operateID + }) + const result=detectionSrc.data['result'] + if(result==='OK'){ + alert('连接成功') + }else{ + alert('连接失败') + } + }catch{ + alert('detection出错') + } + } + return (
@@ -139,24 +153,29 @@ function Operation2() {
- - - {/* 前端连接数据库⬇ */} - { !isTrue&&TrainData&&
- {TrainData['operateID'][3][0]} + { !isTrue&&TrainData&&Src&&
+

{TrainData['operateID'][3][0]}

+ {Src[6]} +
+ {Src[7]} +
+ {Src[8]}
点击以上链接前往实训 -
} + +
+ } {/* 前端连接数据库 ⬆*/} {/* 达梦数据库连接 ⬇*/} { isTrue&&TrainData&&

{TrainData['operateID'][3][0]}

- -
- + {Src&&} +
} {/* 达梦数据库连接⬆ */} diff --git a/app-dm/src/setupProxy.js b/app-dm/src/setupProxy.js index 2dedd89..9a95cdf 100644 --- a/app-dm/src/setupProxy.js +++ b/app-dm/src/setupProxy.js @@ -4,7 +4,7 @@ module.exports = function(app) { app.use( '/api', // 如果请求路径匹配'/api',则进行代理 createProxyMiddleware({ - target: 'http://36.138.114.105:32087/', // 目标后端服务地址 + target: 'http://36.138.114.105:31055/', // 目标后端服务地址 changeOrigin: true, }) ); diff --git a/python/app.py b/python/app.py index a01e096..491b45a 100644 --- a/python/app.py +++ b/python/app.py @@ -288,7 +288,8 @@ def NotMarkTest(): def UpdateTest(): testID=request.json['testID'] score=request.json['score'] - submitScoreFunc(score,testID) + suggestion=request.json['suggestion'] + submitScoreFunc(score,testID,suggestion) print('修改成功') return '修改成功' @@ -316,9 +317,13 @@ def teacher_create_pod(): def teacher_delete_pod(): return delete_pod("test2") -@app.route("/api/teacher/check_pod") # 检测数据库是否安装成功 若成功,返回OK 否则返回NO +@app.route("/api/student/check_pod",methods=['POST']) # 检测数据库是否安装成功 若成功,返回OK 否则返回NO def teacher_check_pod(): - return check_dm("test") + name=request.json["student_ID"] + testID=request.json["operateID"] + name= 'n' + str(name) + '-' + str(testID) + result = check_dm(name) + return jsonify({'result':result}) @app.route('/') @app.route('/') diff --git a/python/del.py b/python/del.py index 642c494..b21fa5e 100644 --- a/python/del.py +++ b/python/del.py @@ -1,5 +1,5 @@ import k8s_func -studentList=['s20240103-44'] +studentList=['n20240101-53','s20240101-50','s20240102-50'] for i in studentList: k8s_func.delete_pod(i) diff --git a/python/student_func.py b/python/student_func.py index af1d9a2..99dd3dc 100644 --- a/python/student_func.py +++ b/python/student_func.py @@ -334,13 +334,12 @@ def HistoryTrainFunc(ID): def FindTrain1SrcFunc(ID,testID): cursor=db.cursor() - cursor.execute("SELECT LINK FROM TRAINSCORE WHERE STUDENT_ID=? AND TEST_ID=?",(ID,testID)) - result=cursor.fetchall()[0][0] - print(result) + cursor.execute("SELECT * FROM TRAINSCORE WHERE STUDENT_ID=? AND TEST_ID=?",(ID,testID)) + result=cursor.fetchall()[0] cursor.close() return result -# FindTrain1SrcFunc('20240101','3') +# FindTrain1SrcFunc('20240101','54') diff --git a/python/teacher_func.py b/python/teacher_func.py index 32a4e0a..a80968f 100644 --- a/python/teacher_func.py +++ b/python/teacher_func.py @@ -288,9 +288,9 @@ def SendLink(): item = k8s_func.list_services() for j in item['list']: if j['name'] == name + '-service': - Link = 'http://36.138.114.105/' + str(j['ports'][0]['node_port']) - Link2 = 'http://36.138.114.105/' + str(j['ports'][1]['node_port']) - Link3 = 'http://36.138.114.105/' + str(j['ports'][2]['node_port']) + Link = 'http://36.138.114.105:' + str(j['ports'][0]['node_port']) + Link2 = 'http://36.138.114.105:' + str(j['ports'][1]['node_port']) + Link3 = 'http://36.138.114.105:' + str(j['ports'][2]['node_port']) cursor.execute(f"INSERT INTO TRAINSCORE VALUES (?,?,?,?,?,?,?,?,?)",( i,i[0:6],testID,'false','NULL','NULL',Link,Link2,Link3 )) @@ -369,10 +369,10 @@ def NotMarkTestFunc(testID): return dic # NotMarkTest('9') -def submitScoreFunc(score,testID): +def submitScoreFunc(score,testID,suggestion): cursor = db.cursor() for i in score: - cursor.execute(f'UPDATE TRAINSCORE SET TRAINRESULT=? WHERE TEST_ID=? AND STUDENT_ID=?', (score[i], testID,i)) + cursor.execute(f'UPDATE TRAINSCORE SET TRAINRESULT=? ,CRECOMMENDATION=?WHERE TEST_ID=? AND STUDENT_ID=?', (score[i],suggestion[i], testID,i)) cursor.execute(f'UPDATE TEACHERMARK SET TF=? WHERE TRAINID=?',('true',testID)) db.commit()