diff --git a/app-dm/src/TeacherPages/MarkingPages/StudentLink.jsx b/app-dm/src/TeacherPages/MarkingPages/StudentLink.jsx
index 94f01db..6f0d1fc 100644
--- a/app-dm/src/TeacherPages/MarkingPages/StudentLink.jsx
+++ b/app-dm/src/TeacherPages/MarkingPages/StudentLink.jsx
@@ -86,10 +86,6 @@ function StudentLink(){
}
-
)
}
diff --git a/app-dm/src/TeacherPages/Trainmanage/TrainPods.css b/app-dm/src/TeacherPages/Trainmanage/TrainPods.css
index ab82ec6..352d6b9 100644
--- a/app-dm/src/TeacherPages/Trainmanage/TrainPods.css
+++ b/app-dm/src/TeacherPages/Trainmanage/TrainPods.css
@@ -7,4 +7,31 @@
border-radius: 10px;
float: right;
background-color: #f7f8fa;
-}
\ No newline at end of file
+}
+.body-right-Pods-table{
+ margin-left: 20px;
+ text-align: center;
+ margin-top: 10px;
+}
+.body-right-Pods-table th{
+ width: 100px;
+}
+.body-right-Pods-table td{
+ text-align: center;
+}
+span{
+ all: unset;
+ }
+ .SrcBox{
+ border: 1px solid black;
+ }
+.SrcBox th{
+ border-bottom: 1px solid black;
+ width: 220px;
+}
+.SrcBox td{
+ text-align: center;
+}
+.thd{
+ font-weight: bold;
+}
diff --git a/app-dm/src/TeacherPages/Trainmanage/TrainPods.jsx b/app-dm/src/TeacherPages/Trainmanage/TrainPods.jsx
index 6ac5723..df02232 100644
--- a/app-dm/src/TeacherPages/Trainmanage/TrainPods.jsx
+++ b/app-dm/src/TeacherPages/Trainmanage/TrainPods.jsx
@@ -3,8 +3,86 @@ import axios from 'axios';
import './TrainPods.css'
function TrainPods(){
+ const teacher_ID=localStorage.getItem('islogin')
+ const[isTrue,setisTrue]=useState(true)
+ const [Pods,setPods]=useState()
+ const FindPodsFunc=async ()=>{
+ try{
+ const FindPodsFunc=await axios.post('/api/teacher/list_pods')
+ setPods(FindPodsFunc.data)
+ }catch{
+
+ }
+ }
+
+ useEffect(()=>{
+ FindPodsFunc()
+ },[])
+
+ const handleDelete=async(name)=> {
+ try{
+ const delPods=await axios.post('/api/teacher/DelPods',{
+ name
+ })
+ alert('删除成功')
+ }catch{
+ alert('出错')
+ }
+ };
+
+ const [SrcData,setSrcData]=useState()
+ const FindSrc=async(ID,key)=>{
+ try{
+ const FindSrcc=await axios.post('/api/teacher/FindSrc',{
+ ID,
+ key
+ })
+ setSrcData(FindSrcc.data['data'])
+ setisTrue(false)
+ }catch{
+ alert('SrcDAta出错')
+ }
+ }
+ // // eslint-disable-next-line no-restricted-globals
+ //
+
return(
-
asdas
+
+ {isTrue&&
+
+
+ 学号 | 实训类型 | 实训ID | IP | 实训链接 | 操作
+
+
+ {Pods&&
+ {Object.keys(Pods['list']).map((key,index)=>(
+ index>1&&
+
+ {Pods['list'][key]['name'].substring(1, 9)} |
+ {Pods['list'][key]['name'].substring(0,1)==='n'? '终端实训':'网页实训'} |
+ {Pods['list'][key]['name'].substring(10)} |
+ {Pods['list'][key]['ip']} |
+ |
+ |
+
+ ))}
+ }
+
}
+ {!isTrue&&
+ 此学生的实训地址为:
+
+
+ LINK | LINK2 | LINK3 |
+
+ {Object.keys(SrcData).map((key)=>(
+
+ {SrcData[0][0]} | {SrcData[0][1]} | {SrcData[0][2]} |
+
+ ))}
+
+
+
}
+
)
}
diff --git a/app-dm/src/TeacherPages/Trainmanage/Trainmanage.css b/app-dm/src/TeacherPages/Trainmanage/Trainmanage.css
index 3d2e878..7f4f8f4 100644
--- a/app-dm/src/TeacherPages/Trainmanage/Trainmanage.css
+++ b/app-dm/src/TeacherPages/Trainmanage/Trainmanage.css
@@ -68,7 +68,19 @@
text-decoration: none;
color: #000;
position: absolute;
- bottom: 50px;
+ bottom: 170px;
right: 100px;
background-color: rgb(186, 237, 237);
+ border-radius: 20px;
+}
+.ManagePods{
+ border-radius: 20px;
+ position: absolute;
+ padding: 20px 30px;
+ text-decoration: none;
+ font-size: 20px;
+ color: #000;
+ right: 300px;
+ bottom: 170px;
+ background-color: rgb(186, 237, 237);
}
\ No newline at end of file
diff --git a/app-dm/src/TeacherPages/Trainmanage/Trainmanage.jsx b/app-dm/src/TeacherPages/Trainmanage/Trainmanage.jsx
index 0b83b8a..a9777b9 100644
--- a/app-dm/src/TeacherPages/Trainmanage/Trainmanage.jsx
+++ b/app-dm/src/TeacherPages/Trainmanage/Trainmanage.jsx
@@ -48,12 +48,9 @@ function TrainManage(){
关闭时间:2024-11-5
- 管理实训
- 前往发布实训
+ 管理实训
+ 发布实训
}
-
)
}
diff --git a/app-dm/src/pages/ListPages/Training/Operation1.jsx b/app-dm/src/pages/ListPages/Training/Operation1.jsx
index be7ec80..f47696b 100644
--- a/app-dm/src/pages/ListPages/Training/Operation1.jsx
+++ b/app-dm/src/pages/ListPages/Training/Operation1.jsx
@@ -145,6 +145,7 @@ function Operation1() {
localStorage.setItem('answeredComple',answeredComple)
localStorage.setItem('answeredJudge',answeredJudge)
localStorage.setItem('TrainData',JSON.stringify(TrainData))
+ localStorage.setItem('score',score)
};
@@ -205,6 +206,7 @@ function Operation1() {
}
JUD_sum++
}
+ alert('保存成功')
}
// 题目预览框
@@ -349,9 +351,7 @@ function Operation1() {
)}
-
-
-
+
diff --git a/app-dm/src/pages/ListPages/Training/Operation2.jsx b/app-dm/src/pages/ListPages/Training/Operation2.jsx
index 976272b..8cfcade 100644
--- a/app-dm/src/pages/ListPages/Training/Operation2.jsx
+++ b/app-dm/src/pages/ListPages/Training/Operation2.jsx
@@ -12,6 +12,7 @@ import axios from 'axios';
import Test from '../../../TeacherPages/TestManage/Test';
function Operation2() {
const student_ID=localStorage.getItem('islogin')
+ const score=localStorage.getItem('score')
const { operateID } = useParams();
const [isTrue,setisTrue]=useState(false)
@@ -100,6 +101,7 @@ function Operation2() {
localStorage.removeItem('answeredComple')
localStorage.removeItem('answeredJudge')
localStorage.removeItem('RemainingTime')
+ localStorage.removeItem('score')
alert('提交成功')
window.location.href='/train'
localStorage.removeItem('TrainData')
@@ -163,9 +165,6 @@ function Operation2() {
{Src[8]}
点击以上链接前往实训
-
}
{/* 前端连接数据库 ⬆*/}
diff --git a/python/app.py b/python/app.py
index 491b45a..9e9e078 100644
--- a/python/app.py
+++ b/python/app.py
@@ -299,23 +299,30 @@ def GetTrain():
data=getTrainFunc(teacherID)
return jsonify({'data':data})
+@app.route('/api/teacher/FindSrc',methods=["POST"])
+def FindSrc():
+ testID=request.json['key']
+ studentID=request.json['ID']
+ data=FindSrcFunc(studentID,testID)
+ return jsonify({'data':data})
-@app.route("/api/teacher/list_pods") # 列出pod
+@app.route("/api/teacher/list_pods",methods=['POST']) # 列出pod
def teacher_list_pods():
- return jsonify(list_pods())
+ return list_pods()
@app.route("/api/teacher/list_services") # 列出服务
def teacher_list_services():
return list_services()
-@app.route("/api/teacher/create_pod") # 创建服务 1为项目实训, 0为安装实训
-def teacher_create_pod():
- create_pod(1, "test2")
-
-@app.route("/api/teacher/delete_pod") # 删除服务
+# @app.route("/api/teacher/create_pod") # 创建服务 1为项目实训, 0为安装实训
+# def teacher_create_pod():
+# create_pod(1, "test2")
+#
+@app.route("/api/teacher/delete_pod",methods=['POST']) # 删除服务
def teacher_delete_pod():
- return delete_pod("test2")
+ name=request.json['name']
+ return delete_pod(name=name)
@app.route("/api/student/check_pod",methods=['POST']) # 检测数据库是否安装成功 若成功,返回OK 否则返回NO
def teacher_check_pod():
@@ -323,7 +330,7 @@ def teacher_check_pod():
testID=request.json["operateID"]
name= 'n' + str(name) + '-' + str(testID)
result = check_dm(name)
- return jsonify({'result':result})
+ return jsonify(result)
@app.route('/')
@app.route('/')
diff --git a/python/assets/type0-pod.yaml b/python/assets/type0-pod.yaml
index f9f71e1..c6a7484 100644
--- a/python/assets/type0-pod.yaml
+++ b/python/assets/type0-pod.yaml
@@ -17,8 +17,8 @@ spec:
runAsGroup: 0
resources:
limits:
- cpu: '1'
- memory: 1.2Gi
- requests:
cpu: '0.2'
- memory: 0.2Gi
\ No newline at end of file
+ memory: 0.2Gi
+ requests:
+ cpu: '0.1'
+ memory: 0.1Gi
\ No newline at end of file
diff --git a/python/assets/type1-pod.yaml b/python/assets/type1-pod.yaml
index 837e33e..5eda626 100644
--- a/python/assets/type1-pod.yaml
+++ b/python/assets/type1-pod.yaml
@@ -15,8 +15,8 @@ spec:
runAsGroup: 0
resources:
limits:
- cpu: '1.3'
- memory: 1.3Gi
+ cpu: '0.2'
+ memory: 0.2Gi
requests:
- cpu: '0.3'
- memory: 0.3Gi
\ No newline at end of file
+ cpu: '0.1'
+ memory: 0.1Gi
\ No newline at end of file
diff --git a/python/del.py b/python/del.py
index 0eb97a3..31d8395 100644
--- a/python/del.py
+++ b/python/del.py
@@ -1,5 +1,5 @@
import k8s_func
-studentList=['n20240101-56','n20240102-56','s20240101-52','s20240102-52']
+studentList=['n20240101-63','n20240102-63','s20240101-66']
for i in studentList:
k8s_func.delete_pod(i)
diff --git a/python/teacher_func.py b/python/teacher_func.py
index 908569a..6d05176 100644
--- a/python/teacher_func.py
+++ b/python/teacher_func.py
@@ -388,3 +388,13 @@ def getTrainFunc(teacherID):
data = cursor.fetchall()
return data
+def FindSrcFunc(studentID, testID):
+ cursor = db.cursor()
+ cursor.execute(f'SELECT LINK,LINK2,LINK3 FROM TRAINSCORE WHERE STUDENT_ID=? AND TEST_ID=?',(studentID,testID))
+ data = cursor.fetchall()
+ cursor.close()
+ return data
+
+# FindSrcFunc('20240101','68')
+
+
diff --git a/python/test.py b/python/test.py
index f6171ca..5f8bcf9 100644
--- a/python/test.py
+++ b/python/test.py
@@ -1,29 +1,4 @@
-import json
-import dmPython
-import k8s_func
-db = dmPython.connect(user='SYSDBA', password='dameng!!', host="36.138.114.105", port="32522")
-cursor=db.cursor()
-studentList=['20240101','20240102']
-testID='5'
-type1=2
-for i in studentList:
- if type1==1:
- name='s'+i+'-'+testID
- # k8s_func.create_pod(type1,name)
- 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'])
- else:
- name='n'+i+'-'+testID
- # k8s_func.create_pod(0,name)
- item=k8s_func.list_services()
- for j in item['list']:
- if j['name']==name+'-service':
- Link=j['ip']
- print(Link)
+print('a')