123
This commit is contained in:
parent
00391c6857
commit
f0407650bc
|
@ -77,7 +77,7 @@ function Marking(){
|
|||
<img src={Test} alt="" width='35px' height='35px'/>
|
||||
<p>
|
||||
<p className='p-mark'><span>实训ID:{MarkData[key][0][10]}</span>{eval(MarkData[key][0][11])}</p>
|
||||
<div id='TF'>{MarkData[key][0][6]>currentTime?'未开始':''}</div>
|
||||
<div id='TF'>{MarkData[key][0][6]>currentTime? ' ':'未开始'}</div>
|
||||
<span>{MarkData[key][0][6]}</span>
|
||||
</p>
|
||||
</li>
|
||||
|
|
|
@ -8,3 +8,7 @@
|
|||
float: right;
|
||||
background-color: #f7f8fa;
|
||||
}
|
||||
.submit{
|
||||
margin-left: 1000px;
|
||||
margin-top: 20px;
|
||||
}
|
|
@ -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(
|
||||
<div className='body-right-studentlink'>
|
||||
<table>
|
||||
{TestLink&&<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>学生</th>
|
||||
<th>链接</th>
|
||||
<th>链接1</th>
|
||||
<th>链接2</th>
|
||||
<th>链接3</th>
|
||||
<th>分数</th>
|
||||
<th>建议</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{TestLink&&<tbody>
|
||||
<tbody>
|
||||
{Object.keys(TestLink).map((key)=>(
|
||||
<tr key={key}>
|
||||
<td>{key}</td>
|
||||
<td><Link to={TestLink[key][6]} target="_blank">{TestLink[key][6]}</Link></td>
|
||||
<td><Link to={TestLink[key][7]} target="_blank">{TestLink[key][7]}</Link></td>
|
||||
<td><Link to={TestLink[key][8]} target="_blank">{TestLink[key][8]}</Link></td>
|
||||
<td><input type="text" onChange={handleInputChange} name={TestLink[key][0]}/></td>
|
||||
<td><input type="text" onChange={handleInputChange2} name={TestLink[key][0]} /></td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>}
|
||||
</table>
|
||||
<button onClick={submit}>提交</button>
|
||||
</tbody>
|
||||
</table>}
|
||||
<button onClick={submit} className='submit'>确定</button>
|
||||
<button onClick={()=>{
|
||||
console.log(score);
|
||||
console.log(suggestion);
|
||||
}}>测试</button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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 (
|
||||
<div>
|
||||
<div ref={terminalObj} onContextMenu={pasteContent} style={{ height: "100vh", width: "100%" }}>
|
||||
<div ref={terminalObj} onContextMenu={pasteContent} style={{ height: "500px", width: "100%" }}>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 (
|
||||
<div>
|
||||
<div className='nav-operation2'>
|
||||
|
@ -139,24 +153,29 @@ function Operation2() {
|
|||
</ul>
|
||||
</div>
|
||||
<div className='body-right2'>
|
||||
|
||||
|
||||
<button onClick={click}>测试按钮</button>
|
||||
{/* 前端连接数据库⬇ */}
|
||||
{ !isTrue&&TrainData&&<div>
|
||||
<Link to={Src}>{TrainData['operateID'][3][0]}</Link>
|
||||
{ !isTrue&&TrainData&&Src&&<div>
|
||||
<p>{TrainData['operateID'][3][0]}</p>
|
||||
<Link to={Src[6]}>{Src[6]}</Link>
|
||||
<br />
|
||||
<Link to={Src[7]}>{Src[7]}</Link>
|
||||
<br />
|
||||
<Link to={Src[8]}>{Src[8]}</Link>
|
||||
<br />
|
||||
点击以上链接前往实训
|
||||
</div>}
|
||||
<button onClick={()=>{
|
||||
console.log(Src);
|
||||
}}>dads</button>
|
||||
</div>
|
||||
}
|
||||
{/* 前端连接数据库 ⬆*/}
|
||||
|
||||
{/* 达梦数据库连接 ⬇*/}
|
||||
{ isTrue&&TrainData&&
|
||||
<div>
|
||||
<p>{TrainData['operateID'][3][0]}</p>
|
||||
<Test/>
|
||||
<div className=''><button>检测</button></div>
|
||||
|
||||
{Src&&<Test ip={Src[6]}/>}
|
||||
<div className='detection'><button onClick={detection}>检测</button></div>
|
||||
</div>}
|
||||
{/* 达梦数据库连接⬆ */}
|
||||
|
||||
|
|
|
@ -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,
|
||||
})
|
||||
);
|
||||
|
|
|
@ -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('/<path:path>')
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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')
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue