6.25,18.44

This commit is contained in:
30404 2024-06-25 18:44:33 +08:00
parent f5dbab3a28
commit aa49c5dd8f
18 changed files with 46 additions and 43 deletions

View File

@ -9,7 +9,7 @@ function Marking(){
const teacher_ID=localStorage.getItem('islogin') const teacher_ID=localStorage.getItem('islogin')
if(teacher_ID==null){ if(teacher_ID==null){
alert('登录过期,请重新登录') alert('登录过期,请重新登录')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/'
} }
return( return(

View File

@ -9,7 +9,7 @@ function SendTest(){
const teacher_ID=localStorage.getItem('islogin') const teacher_ID=localStorage.getItem('islogin')
if(teacher_ID==null){ if(teacher_ID==null){
alert('登录过期,请重新登录') alert('登录过期,请重新登录')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/'
} }
// //
const [ChoiceQuestion,SetChoiceQuestion]=useState() const [ChoiceQuestion,SetChoiceQuestion]=useState()

View File

@ -8,7 +8,7 @@ function TrainManage(){
const teacher_ID=localStorage.getItem('islogin') const teacher_ID=localStorage.getItem('islogin')
if(teacher_ID==null){ if(teacher_ID==null){
alert('登录过期,请重新登录') alert('登录过期,请重新登录')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/'
} }
return( return(
<div className='body-trainmanage'> <div className='body-trainmanage'>

View File

@ -7,7 +7,7 @@ function SendTrain(){
const teacher_ID=localStorage.getItem('islogin') const teacher_ID=localStorage.getItem('islogin')
if(teacher_ID==null){ if(teacher_ID==null){
alert('登录过期,请重新登录') alert('登录过期,请重新登录')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/'
} }
// //
const [Trainquestion,SetTrainquestion]=useState() const [Trainquestion,SetTrainquestion]=useState()

View File

@ -5,10 +5,11 @@ import axios from 'axios';
// import { useParams } from 'react-router-dom'; // import { useParams } from 'react-router-dom';
function TeacherPage() { function TeacherPage() {
const teacher_ID = localStorage.getItem('islogin') const teacher_ID = localStorage.getItem('islogin')
if(teacher_ID==null){ if(teacher_ID==null){
alert('登录过期,请重新登录') alert('登录过期,请重新登录')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/'
} }
const [classData, setClassData] = useState({}); const [classData, setClassData] = useState({});
const log=(key)=>{ const log=(key)=>{

View File

@ -9,12 +9,12 @@ import './classid.css'
function TeacherPage() { function TeacherPage() {
const click=()=>{ const click=()=>{
console.log(classdata); console.log(TestScore);
} }
const teacher_ID=localStorage.getItem('islogin') const teacher_ID=localStorage.getItem('islogin')
if(teacher_ID==null){ if(teacher_ID==null){
alert('登录过期,请重新登录') alert('登录过期,请重新登录')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/'
} }
const { key } = useParams(); const { key } = useParams();
const [isclick,setisclick]=useState(false) 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')}`; const formattedDate = `${year}-${(monthIndex + 1).toString().padStart(2, '0')}-${day.toString().padStart(2, '0')}`;
return formattedDate; return formattedDate;
} }
const[TestScore,setTestScore]=useState()
const Find_details=async (ID)=>{ const Find_details=async (ID)=>{
try{ try{
const Find_details=await axios.post('api/Find_details',{ const Find_details_Src=await axios.post('api/Find_details',{
ID ID
}) })
setTestScore(Find_details_Src.data)
}catch{ }catch{
alert('Find_details出错')
} }
} }

View File

@ -0,0 +1,5 @@
function List_pods(){
return(
<div></div>
)
}

View File

@ -9,7 +9,7 @@ function TeacherPage() {
const teacher_ID=localStorage.getItem('islogin') const teacher_ID=localStorage.getItem('islogin')
if(teacher_ID==null){ if(teacher_ID==null){
alert('登录过期,请重新登录') alert('登录过期,请重新登录')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/'
} }
const [classData, setClassData] = useState({}); const [classData, setClassData] = useState({});
const [classtest,setClassTest]=useState() const [classtest,setClassTest]=useState()

View File

@ -15,7 +15,7 @@ function Home(){
const student_ID=localStorage.getItem('islogin') const student_ID=localStorage.getItem('islogin')
if(student_ID==null){ if(student_ID==null){
alert('未登录,请先前往登录') alert('未登录,请先前往登录')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/'
} }
// //
const [lesson, setLesson] = useState([]); const [lesson, setLesson] = useState([]);

View File

@ -11,7 +11,7 @@ function SubjectPage(){
const student_ID=localStorage.getItem('islogin') const student_ID=localStorage.getItem('islogin')
if(student_ID==null){ if(student_ID==null){
alert('登录过期,请重新登录') alert('登录过期,请重新登录')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/'
} }
//li //li
const [SubjectModal,setSubjectModal] = useState(false); const [SubjectModal,setSubjectModal] = useState(false);

View File

@ -9,7 +9,7 @@ function Exam(){
const student_ID=localStorage.getItem('islogin') const student_ID=localStorage.getItem('islogin')
if(student_ID==null){ if(student_ID==null){
alert('登录过期,请重新登录') alert('登录过期,请重新登录')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/'
} }
// //
const [countdown, setCountdown] = useState(0); const [countdown, setCountdown] = useState(0);

View File

@ -12,7 +12,7 @@ function SubjectPage(){
const student_ID=localStorage.getItem('islogin') const student_ID=localStorage.getItem('islogin')
if(student_ID==null){ if(student_ID==null){
alert('登录过期,请重新登录') alert('登录过期,请重新登录')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/'
} }
const [testdata,settestdata]=useState('') const [testdata,settestdata]=useState('')
const [time,settime]=useState(moment().format('YYYY-MM-DD HH:mm:ss')) const [time,settime]=useState(moment().format('YYYY-MM-DD HH:mm:ss'))

View File

@ -13,7 +13,7 @@ function SubjectPage(){
const student_ID=localStorage.getItem('islogin') const student_ID=localStorage.getItem('islogin')
if(student_ID==null){ if(student_ID==null){
alert('登录过期,请重新登录') alert('登录过期,请重新登录')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/'
} }
const [title,setTitle]=useState() const [title,setTitle]=useState()
// //

View File

@ -72,7 +72,7 @@ import axios from 'axios';
const register_data=register_func.data const register_data=register_func.data
if (register_data.result==='注册成功'){ if (register_data.result==='注册成功'){
alert('注册成功') alert('注册成功')
window.location.href='http://localhost:3000/signin' window.location.href='http://36.138.114.105:30294/'
}else if(register_data.result==='注册失败'){ }else if(register_data.result==='注册失败'){
alert('账号已存在') alert('账号已存在')
} }

View File

@ -4,7 +4,7 @@ module.exports = function(app) {
app.use( app.use(
'/api', // 如果请求路径匹配'/api',则进行代理 '/api', // 如果请求路径匹配'/api',则进行代理
createProxyMiddleware({ createProxyMiddleware({
target: 'http://36.138.114.105:32087/', // 目标后端服务地址 target: 'http://127.0.0.1:5000', // 目标后端服务地址
changeOrigin: true, changeOrigin: true,
}) })
); );

View File

@ -2,7 +2,6 @@ from teacher_func import *
from student_func import * from student_func import *
from flask import Flask, render_template, request, jsonify, send_from_directory, session from flask import Flask, render_template, request, jsonify, send_from_directory, session
from flask_cors import CORS from flask_cors import CORS
import python.k8s as k8s
app = Flask(__name__, static_folder="public") app = Flask(__name__, static_folder="public")
CORS(app, resources={r"/*": {"origins": "*"}}) CORS(app, resources={r"/*": {"origins": "*"}})
@ -234,11 +233,8 @@ def SendTrainTest():
@app.route('/api/Find_details',methods=["POST"]) @app.route('/api/Find_details',methods=["POST"])
def Find_details(): def Find_details():
return 'a' id=request.json['student_ID']
return Find_details(id)
@app.route('/api/student-test',methods=["POST"])
def student_test():
return k8s.list_pods()
@app.route('/') @app.route('/')

View File

@ -256,30 +256,29 @@ def SendTrainTestFunc(TrainChoice,TrainCompletion,TrainJudge,Hour,Min,StopTime,C
return '发布成功' return '发布成功'
def Find_dic(dic): # def Find_dic(dic):
# 获取字典的键,并按照从大到小的顺序排序 # # 获取字典的键,并按照从大到小的顺序排序
keys_sorted = sorted(dic.keys(), reverse=True) # keys_sorted = sorted(dic.keys(), reverse=True)
#
# 取最后三个键 # # 取最后三个键
last_three_keys = keys_sorted[:3] # last_three_keys = keys_sorted[:3]
#
# 输出对应的值或进行进一步处理 # # 创建一个新的字典,仅包含排序后的最后三个键及其对应的值
for key in last_three_keys: # dic_last_three = {key: dic[key] for key in last_three_keys}
print(dic[key]) # 这里假设你想打印每个键对应的值,可以根据需求进行处理 #
print(dic) # return dic_last_three # 返回一个新字典,该字典仅包含排序后的最后三个键及其对应的值
def Find_details(ID):
def Find_details(ID,teacher_ID):
dic = {} dic = {}
subject=fetch_subject(teacher_ID)
cursor = db.cursor() cursor = db.cursor()
cursor.execute(f"SELECT * FROM STUDENT_TEST WHERE STUDENT_ID=? AND TF='true' AND SUBJECT=? ",(ID,subject)) cursor.execute(f"SELECT * FROM STUDENT_TEST WHERE STUDENT_ID=? AND TF='true' ", (ID))
data = cursor.fetchall() data = cursor.fetchall()
for i in data: for i in data:
dic[i[3]] = i dic[i[3]] = i
cursor.close() cursor.close()
Find_dic(dic) # 调用Find_dic函数并传入dic字典作为参数
return dic return dic
Find_details('20240101','111111')
# print(Find_details('20240101'))