diff --git a/app-dm/src/TeacherPages/MarkingPages/Marking.jsx b/app-dm/src/TeacherPages/MarkingPages/Marking.jsx index 2f08a58..a96da06 100644 --- a/app-dm/src/TeacherPages/MarkingPages/Marking.jsx +++ b/app-dm/src/TeacherPages/MarkingPages/Marking.jsx @@ -9,7 +9,7 @@ function Marking(){ const teacher_ID=localStorage.getItem('islogin') if(teacher_ID==null){ alert('登录过期,请重新登录') - window.location.href='http://localhost:3000/signin' + window.location.href='http://36.138.114.105:30294/' } return( diff --git a/app-dm/src/TeacherPages/SendTest/SendTest.jsx b/app-dm/src/TeacherPages/SendTest/SendTest.jsx index 32dc9f9..8e58515 100644 --- a/app-dm/src/TeacherPages/SendTest/SendTest.jsx +++ b/app-dm/src/TeacherPages/SendTest/SendTest.jsx @@ -9,7 +9,7 @@ function SendTest(){ const teacher_ID=localStorage.getItem('islogin') if(teacher_ID==null){ alert('登录过期,请重新登录') - window.location.href='http://localhost:3000/signin' + window.location.href='http://36.138.114.105:30294/' } //获取题目 const [ChoiceQuestion,SetChoiceQuestion]=useState() diff --git a/app-dm/src/TeacherPages/SendTest/trainmanage.jsx b/app-dm/src/TeacherPages/SendTest/trainmanage.jsx index 4311dcf..7e97232 100644 --- a/app-dm/src/TeacherPages/SendTest/trainmanage.jsx +++ b/app-dm/src/TeacherPages/SendTest/trainmanage.jsx @@ -8,7 +8,7 @@ function TrainManage(){ const teacher_ID=localStorage.getItem('islogin') if(teacher_ID==null){ alert('登录过期,请重新登录') - window.location.href='http://localhost:3000/signin' + window.location.href='http://36.138.114.105:30294/' } return(
diff --git a/app-dm/src/TeacherPages/SendTrain/SendTrain.jsx b/app-dm/src/TeacherPages/SendTrain/SendTrain.jsx index a7fd2c3..d4e7411 100644 --- a/app-dm/src/TeacherPages/SendTrain/SendTrain.jsx +++ b/app-dm/src/TeacherPages/SendTrain/SendTrain.jsx @@ -7,7 +7,7 @@ function SendTrain(){ const teacher_ID=localStorage.getItem('islogin') if(teacher_ID==null){ alert('登录过期,请重新登录') - window.location.href='http://localhost:3000/signin' + window.location.href='http://36.138.114.105:30294/' } //获取所有基础题的所有题目 const [Trainquestion,SetTrainquestion]=useState() diff --git a/app-dm/src/TeacherPages/TeacherPage.jsx b/app-dm/src/TeacherPages/TeacherPage.jsx index c02b880..c8475c7 100644 --- a/app-dm/src/TeacherPages/TeacherPage.jsx +++ b/app-dm/src/TeacherPages/TeacherPage.jsx @@ -5,10 +5,11 @@ import axios from 'axios'; // import { useParams } from 'react-router-dom'; function TeacherPage() { + const teacher_ID = localStorage.getItem('islogin') if(teacher_ID==null){ alert('登录过期,请重新登录') - window.location.href='http://localhost:3000/signin' + window.location.href='http://36.138.114.105:30294/' } const [classData, setClassData] = useState({}); const log=(key)=>{ diff --git a/app-dm/src/TeacherPages/classlistpages/classId.jsx b/app-dm/src/TeacherPages/classlistpages/classId.jsx index 6baf715..33f7a0d 100644 --- a/app-dm/src/TeacherPages/classlistpages/classId.jsx +++ b/app-dm/src/TeacherPages/classlistpages/classId.jsx @@ -9,12 +9,12 @@ import './classid.css' function TeacherPage() { const click=()=>{ - console.log(classdata); + console.log(TestScore); } const teacher_ID=localStorage.getItem('islogin') if(teacher_ID==null){ alert('登录过期,请重新登录') - window.location.href='http://localhost:3000/signin' + window.location.href='http://36.138.114.105:30294/' } const { key } = useParams(); const [isclick,setisclick]=useState(false) @@ -59,13 +59,15 @@ function TeacherPage() { const formattedDate = `${year}-${(monthIndex + 1).toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`; return formattedDate; } + const[TestScore,setTestScore]=useState() const Find_details=async (ID)=>{ try{ - const Find_details=await axios.post('api/Find_details',{ + const Find_details_Src=await axios.post('api/Find_details',{ ID }) + setTestScore(Find_details_Src.data) }catch{ - + alert('Find_details出错') } } diff --git a/app-dm/src/TeacherPages/list_pods/List_pods.css b/app-dm/src/TeacherPages/list_pods/List_pods.css new file mode 100644 index 0000000..e69de29 diff --git a/app-dm/src/TeacherPages/list_pods/List_pods.jsx b/app-dm/src/TeacherPages/list_pods/List_pods.jsx new file mode 100644 index 0000000..9822453 --- /dev/null +++ b/app-dm/src/TeacherPages/list_pods/List_pods.jsx @@ -0,0 +1,5 @@ +function List_pods(){ + return( +
+ ) +} \ No newline at end of file diff --git a/app-dm/src/TeacherPages/teachermanagetest/ManageTest.jsx b/app-dm/src/TeacherPages/teachermanagetest/ManageTest.jsx index a9974ab..4a70674 100644 --- a/app-dm/src/TeacherPages/teachermanagetest/ManageTest.jsx +++ b/app-dm/src/TeacherPages/teachermanagetest/ManageTest.jsx @@ -9,7 +9,7 @@ function TeacherPage() { const teacher_ID=localStorage.getItem('islogin') if(teacher_ID==null){ alert('登录过期,请重新登录') - window.location.href='http://localhost:3000/signin' + window.location.href='http://36.138.114.105:30294/' } const [classData, setClassData] = useState({}); const [classtest,setClassTest]=useState() diff --git a/app-dm/src/pages/Home/Home.jsx b/app-dm/src/pages/Home/Home.jsx index 5c5e246..bb83281 100644 --- a/app-dm/src/pages/Home/Home.jsx +++ b/app-dm/src/pages/Home/Home.jsx @@ -15,7 +15,7 @@ function Home(){ const student_ID=localStorage.getItem('islogin') if(student_ID==null){ alert('未登录,请先前往登录') - window.location.href='http://localhost:3000/signin' + window.location.href='http://36.138.114.105:30294/' } //课表数据 const [lesson, setLesson] = useState([]); diff --git a/app-dm/src/pages/ListPages/Analyse/AnalysePages.jsx b/app-dm/src/pages/ListPages/Analyse/AnalysePages.jsx index e45fdd9..3a9b4c1 100644 --- a/app-dm/src/pages/ListPages/Analyse/AnalysePages.jsx +++ b/app-dm/src/pages/ListPages/Analyse/AnalysePages.jsx @@ -11,7 +11,7 @@ function SubjectPage(){ const student_ID=localStorage.getItem('islogin') if(student_ID==null){ alert('登录过期,请重新登录') - window.location.href='http://localhost:3000/signin' + window.location.href='http://36.138.114.105:30294/' } //点击li弹出图像窗口 const [SubjectModal,setSubjectModal] = useState(false); diff --git a/app-dm/src/pages/ListPages/Subject/Exam.jsx b/app-dm/src/pages/ListPages/Subject/Exam.jsx index c9aef5e..a23fd21 100644 --- a/app-dm/src/pages/ListPages/Subject/Exam.jsx +++ b/app-dm/src/pages/ListPages/Subject/Exam.jsx @@ -9,7 +9,7 @@ function Exam(){ const student_ID=localStorage.getItem('islogin') if(student_ID==null){ alert('登录过期,请重新登录') - window.location.href='http://localhost:3000/signin' + window.location.href='http://36.138.114.105:30294/' } // 初始化倒计时状态 const [countdown, setCountdown] = useState(0); diff --git a/app-dm/src/pages/ListPages/Subject/SubjectPage.jsx b/app-dm/src/pages/ListPages/Subject/SubjectPage.jsx index 13d77f8..5363dd9 100644 --- a/app-dm/src/pages/ListPages/Subject/SubjectPage.jsx +++ b/app-dm/src/pages/ListPages/Subject/SubjectPage.jsx @@ -12,7 +12,7 @@ function SubjectPage(){ const student_ID=localStorage.getItem('islogin') if(student_ID==null){ alert('登录过期,请重新登录') - window.location.href='http://localhost:3000/signin' + window.location.href='http://36.138.114.105:30294/' } const [testdata,settestdata]=useState('') const [time,settime]=useState(moment().format('YYYY-MM-DD HH:mm:ss')) diff --git a/app-dm/src/pages/ListPages/Training/TrainingPage.jsx b/app-dm/src/pages/ListPages/Training/TrainingPage.jsx index fb68215..f9600dd 100755 --- a/app-dm/src/pages/ListPages/Training/TrainingPage.jsx +++ b/app-dm/src/pages/ListPages/Training/TrainingPage.jsx @@ -13,7 +13,7 @@ function SubjectPage(){ const student_ID=localStorage.getItem('islogin') if(student_ID==null){ alert('登录过期,请重新登录') - window.location.href='http://localhost:3000/signin' + window.location.href='http://36.138.114.105:30294/' } const [title,setTitle]=useState() // 获取实训标题 diff --git a/app-dm/src/pages/SighUp/SignUpForm.jsx b/app-dm/src/pages/SighUp/SignUpForm.jsx index a822c17..27d6d93 100644 --- a/app-dm/src/pages/SighUp/SignUpForm.jsx +++ b/app-dm/src/pages/SighUp/SignUpForm.jsx @@ -72,7 +72,7 @@ import axios from 'axios'; const register_data=register_func.data if (register_data.result==='注册成功'){ alert('注册成功') - window.location.href='http://localhost:3000/signin' + window.location.href='http://36.138.114.105:30294/' }else if(register_data.result==='注册失败'){ alert('账号已存在') } diff --git a/app-dm/src/setupProxy.js b/app-dm/src/setupProxy.js index f7ade0b..4a40b4f 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://127.0.0.1:5000', // 目标后端服务地址 changeOrigin: true, }) ); diff --git a/python/app.py b/python/app.py index 76cdd08..4dedab1 100644 --- a/python/app.py +++ b/python/app.py @@ -2,7 +2,6 @@ from teacher_func import * from student_func import * from flask import Flask, render_template, request, jsonify, send_from_directory, session from flask_cors import CORS -import python.k8s as k8s app = Flask(__name__, static_folder="public") CORS(app, resources={r"/*": {"origins": "*"}}) @@ -234,11 +233,8 @@ def SendTrainTest(): @app.route('/api/Find_details',methods=["POST"]) def Find_details(): - return 'a' - -@app.route('/api/student-test',methods=["POST"]) -def student_test(): - return k8s.list_pods() + id=request.json['student_ID'] + return Find_details(id) @app.route('/') diff --git a/python/teacher_func.py b/python/teacher_func.py index a9e62f3..10e6516 100644 --- a/python/teacher_func.py +++ b/python/teacher_func.py @@ -256,30 +256,29 @@ def SendTrainTestFunc(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,StopTime,C return '发布成功' -def Find_dic(dic): - # 获取字典的键,并按照从大到小的顺序排序 - keys_sorted = sorted(dic.keys(), reverse=True) - - # 取最后三个键 - last_three_keys = keys_sorted[:3] - - # 输出对应的值或进行进一步处理 - for key in last_three_keys: - print(dic[key]) # 这里假设你想打印每个键对应的值,可以根据需求进行处理 - print(dic) +# def Find_dic(dic): +# # 获取字典的键,并按照从大到小的顺序排序 +# keys_sorted = sorted(dic.keys(), reverse=True) +# +# # 取最后三个键 +# last_three_keys = keys_sorted[:3] +# +# # 创建一个新的字典,仅包含排序后的最后三个键及其对应的值 +# dic_last_three = {key: dic[key] for key in last_three_keys} +# +# return dic_last_three # 返回一个新字典,该字典仅包含排序后的最后三个键及其对应的值 - -def Find_details(ID,teacher_ID): - dic={} - subject=fetch_subject(teacher_ID) +def Find_details(ID): + dic = {} cursor = db.cursor() - cursor.execute(f"SELECT * FROM STUDENT_TEST WHERE STUDENT_ID=? AND TF='true' AND SUBJECT=? ",(ID,subject)) - data=cursor.fetchall() + cursor.execute(f"SELECT * FROM STUDENT_TEST WHERE STUDENT_ID=? AND TF='true' ", (ID)) + data = cursor.fetchall() for i in data: - dic[i[3]]=i + dic[i[3]] = i cursor.close() - Find_dic(dic) + # 调用Find_dic函数并传入dic字典作为参数 return dic -Find_details('20240101','111111') + +# print(Find_details('20240101'))