6.25
This commit is contained in:
parent
f18f5dc80e
commit
9d08bddb45
|
@ -6,6 +6,11 @@ import Test from '../../pages/Home/img/test.jpg'
|
|||
|
||||
// 批改
|
||||
function Marking(){
|
||||
const teacher_ID=localStorage.getItem('islogin')
|
||||
if(teacher_ID==null){
|
||||
alert('登录过期,请重新登录')
|
||||
window.location.href='http://localhost:3000/signin'
|
||||
}
|
||||
|
||||
return(
|
||||
<div className='body-right-mark'>
|
||||
|
|
|
@ -7,6 +7,10 @@ import axios from 'axios';
|
|||
function SendTest(){
|
||||
// const { key } = useParams();
|
||||
const teacher_ID=localStorage.getItem('islogin')
|
||||
if(teacher_ID==null){
|
||||
alert('登录过期,请重新登录')
|
||||
window.location.href='http://localhost:3000/signin'
|
||||
}
|
||||
//获取题目
|
||||
const [ChoiceQuestion,SetChoiceQuestion]=useState()
|
||||
const [Completion,SetCompletion]=useState()
|
||||
|
|
|
@ -5,6 +5,11 @@ import { Link } from 'react-router-dom';
|
|||
|
||||
|
||||
function TrainManage(){
|
||||
const teacher_ID=localStorage.getItem('islogin')
|
||||
if(teacher_ID==null){
|
||||
alert('登录过期,请重新登录')
|
||||
window.location.href='http://localhost:3000/signin'
|
||||
}
|
||||
return(
|
||||
<div className='body-trainmanage'>
|
||||
<p>已批改试卷</p>
|
||||
|
|
|
@ -5,6 +5,10 @@ import axios from 'axios';
|
|||
|
||||
function SendTrain(){
|
||||
const teacher_ID=localStorage.getItem('islogin')
|
||||
if(teacher_ID==null){
|
||||
alert('登录过期,请重新登录')
|
||||
window.location.href='http://localhost:3000/signin'
|
||||
}
|
||||
//获取所有基础题的所有题目
|
||||
const [Trainquestion,SetTrainquestion]=useState()
|
||||
//章节内容
|
||||
|
|
|
@ -5,29 +5,12 @@ import axios from 'axios';
|
|||
// import { useParams } from 'react-router-dom';
|
||||
|
||||
function TeacherPage() {
|
||||
const [isChecked, setisChecked] = useState(false);
|
||||
const [teacher_ID, setTeacher_ID] = useState(localStorage.getItem('islogin'));
|
||||
const teacher_ID = localStorage.getItem('islogin')
|
||||
if(teacher_ID==null){
|
||||
alert('登录过期,请重新登录')
|
||||
window.location.href='http://localhost:3000/signin'
|
||||
}
|
||||
const [classData, setClassData] = useState({});
|
||||
|
||||
//判断是否登录
|
||||
// useEffect(() => {
|
||||
// if (!isChecked) {
|
||||
// const is_login = localStorage.getItem('islogin');
|
||||
// if (!is_login) {
|
||||
// alert('未登录');
|
||||
// window.location.href = 'http://36.138.114.105:30294/signin';
|
||||
// } else {
|
||||
// if(teacher_ID.length===8){
|
||||
// window.location.href='http://36.138.114.105:30294'
|
||||
// return
|
||||
// }else{
|
||||
// console.log(teacher_ID);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }, []);
|
||||
|
||||
//可以删
|
||||
const log=(key)=>{
|
||||
console.log(key);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,11 @@ import './classid.css'
|
|||
|
||||
|
||||
function TeacherPage() {
|
||||
const teacher_ID=localStorage.getItem('islogin')
|
||||
if(teacher_ID==null){
|
||||
alert('登录过期,请重新登录')
|
||||
window.location.href='http://localhost:3000/signin'
|
||||
}
|
||||
const { key } = useParams();
|
||||
const [isclick,setisclick]=useState(false)
|
||||
//学生表格
|
||||
|
|
|
@ -7,6 +7,10 @@ import './ManageTest.css'
|
|||
function TeacherPage() {
|
||||
|
||||
const teacher_ID=localStorage.getItem('islogin')
|
||||
if(teacher_ID==null){
|
||||
alert('登录过期,请重新登录')
|
||||
window.location.href='http://localhost:3000/signin'
|
||||
}
|
||||
const [classData, setClassData] = useState({});
|
||||
const [classtest,setClassTest]=useState()
|
||||
const [defaultclass,setDefaultClass]=useState()
|
||||
|
|
|
@ -12,22 +12,11 @@ import { max, min } from 'lodash';
|
|||
// 首页
|
||||
function Home(){
|
||||
const [isChecked,setisChecked]=useState(false)
|
||||
//判断是否登录
|
||||
// useEffect(()=>{
|
||||
// if (!isChecked){
|
||||
// const is_login=localStorage.getItem('islogin')
|
||||
// if(!is_login){
|
||||
// alert('未登录')
|
||||
// window.location.href='http://localhost:3000/signin'
|
||||
// }else{
|
||||
// console.log(is_login);
|
||||
// console.log('已登录');
|
||||
// setisChecked(true)
|
||||
// }
|
||||
// //组件加载时自动调用login函数进行登录检测
|
||||
// }
|
||||
// },[]);//在组件加载时只调用一次
|
||||
|
||||
const student_ID=localStorage.getItem('islogin')
|
||||
if(student_ID==null){
|
||||
alert('未登录,请先前往登录')
|
||||
window.location.href='http://localhost:3000/signin'
|
||||
}
|
||||
//课表数据
|
||||
const [lesson, setLesson] = useState([]);
|
||||
const [firstlesson, setfirstlesson] = useState([]);
|
||||
|
|
|
@ -9,6 +9,10 @@ import axios from 'axios';
|
|||
// 首页 学习分析
|
||||
function SubjectPage(){
|
||||
const student_ID=localStorage.getItem('islogin')
|
||||
if(student_ID==null){
|
||||
alert('登录过期,请重新登录')
|
||||
window.location.href='http://localhost:3000/signin'
|
||||
}
|
||||
//点击li弹出图像窗口
|
||||
const [SubjectModal,setSubjectModal] = useState(false);
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@ import { useEffect, useState } from 'react';
|
|||
function Exam(){
|
||||
const {examId} = useParams()
|
||||
const student_ID=localStorage.getItem('islogin')
|
||||
if(student_ID==null){
|
||||
alert('登录过期,请重新登录')
|
||||
window.location.href='http://localhost:3000/signin'
|
||||
}
|
||||
// 初始化倒计时状态
|
||||
const [countdown, setCountdown] = useState(0);
|
||||
const Countdown=true
|
||||
|
|
|
@ -10,6 +10,10 @@ import moment from 'moment';
|
|||
// 首页 题目集
|
||||
function SubjectPage(){
|
||||
const student_ID=localStorage.getItem('islogin')
|
||||
if(student_ID==null){
|
||||
alert('登录过期,请重新登录')
|
||||
window.location.href='http://localhost:3000/signin'
|
||||
}
|
||||
const [testdata,settestdata]=useState('')
|
||||
const [time,settime]=useState(moment().format('YYYY-MM-DD HH:mm:ss'))
|
||||
const [result,setresult]=useState({})
|
||||
|
|
|
@ -128,4 +128,14 @@
|
|||
margin-top: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.answered {
|
||||
/* 例如,改变题目的背景色 */
|
||||
width: 40px;
|
||||
height: 30px;
|
||||
background-color: rgb(136, 243, 209);
|
||||
text-align: center;
|
||||
margin-left: 5px;
|
||||
margin-top: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import axios from 'axios';
|
|||
|
||||
function Operation1() {
|
||||
const click=()=>{
|
||||
console.log(TrainData);
|
||||
console.log(answeredJudge);
|
||||
}
|
||||
const clear=()=>{
|
||||
localStorage.clear('choice_answers');
|
||||
|
@ -20,6 +20,12 @@ function Operation1() {
|
|||
setcompletion_answer({})
|
||||
localStorage.clear('judge_answer')
|
||||
setjudge_answer({})
|
||||
localStorage.clear('answeredChoice')
|
||||
setAnsweredChoice([])
|
||||
localStorage.clear('answeredComple')
|
||||
setAnsweredComple([])
|
||||
localStorage.clear('answeredJudge')
|
||||
setAnsweredJudge([])
|
||||
}
|
||||
|
||||
const { operateID } = useParams();
|
||||
|
@ -33,28 +39,24 @@ function Operation1() {
|
|||
})
|
||||
const returnData=TrainDataSrc.data
|
||||
setTrainData(returnData)
|
||||
settime(parseInt(returnData['operateID'][4]))
|
||||
setCountdown(60*parseInt(returnData['operateID'][4]))
|
||||
}catch{
|
||||
alert('TrainDataFunc出错')
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
TrainDataFunc()
|
||||
},[])
|
||||
//倒计时
|
||||
const [countdown, setCountdown] = useState(0);
|
||||
const [countdown, setCountdown] = useState();
|
||||
const [time,settime]=useState()
|
||||
// 倒计时初始化
|
||||
useEffect(() => {
|
||||
const examDuration = 60 * time; // 假设考试时长为1小时
|
||||
setCountdown(examDuration);
|
||||
}, [time]);
|
||||
|
||||
|
||||
// 倒计时更新
|
||||
useEffect(() => {
|
||||
let interval = setInterval(() => {
|
||||
if (countdown > 0) {
|
||||
if (countdown != 0) {
|
||||
setCountdown(countdown - 1);
|
||||
} else {
|
||||
clearInterval(interval);
|
||||
|
@ -79,6 +81,11 @@ function Operation1() {
|
|||
const [choice_answer,setchoice_answer]=useState({})
|
||||
const [completion_answer,setcompletion_answer]=useState({})
|
||||
const [judge_answer,setjudge_answer]=useState({})
|
||||
//选中反馈
|
||||
const [answeredChoice, setAnsweredChoice] = useState([]);
|
||||
const [answeredComple, setAnsweredComple] = useState([]);
|
||||
const [answeredJudge, setAnsweredJudge] = useState([]);
|
||||
|
||||
|
||||
//给选择题添加事件监听器
|
||||
const handleOptionChange = (event) => {
|
||||
|
@ -86,6 +93,10 @@ function Operation1() {
|
|||
const key = parseInt(event.target.name.replace('group', ''));
|
||||
const updatedChoiceAnswer = { ...choice_answer, [key]: selectedValue };
|
||||
setchoice_answer(updatedChoiceAnswer);
|
||||
// 更新已做题目的状态
|
||||
if (!answeredChoice.includes(key)) {
|
||||
setAnsweredChoice([...answeredChoice, key]);
|
||||
}
|
||||
};
|
||||
//填空题
|
||||
const handleInputChange = (event) => {
|
||||
|
@ -94,6 +105,10 @@ function Operation1() {
|
|||
...completion_answer,
|
||||
[name]: value
|
||||
});
|
||||
if (!answeredComple.includes(parseInt(name))) {
|
||||
setAnsweredComple([...answeredComple, parseInt(name)]);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//判断题
|
||||
|
@ -102,6 +117,9 @@ function Operation1() {
|
|||
const key=parseInt(event.target.name.replace('judge',''))
|
||||
const updatedJudgeAnswer={ ...judge_answer,[key]:judgeoption}
|
||||
setjudge_answer(updatedJudgeAnswer)
|
||||
if (!answeredJudge.includes(key)) {
|
||||
setAnsweredJudge([...answeredJudge, key]);
|
||||
}
|
||||
}
|
||||
|
||||
//保存答案到 localStorage
|
||||
|
@ -109,6 +127,9 @@ function Operation1() {
|
|||
localStorage.setItem('choice_answers', JSON.stringify(choice_answer));
|
||||
localStorage.setItem('completion_answer', JSON.stringify(completion_answer));
|
||||
localStorage.setItem('judge_answer',JSON.stringify(judge_answer))
|
||||
localStorage.setItem('answeredChoice',answeredChoice)
|
||||
localStorage.setItem('answeredComple',answeredComple)
|
||||
localStorage.setItem('answeredJudge',answeredJudge)
|
||||
};
|
||||
|
||||
// 在组件加载时从 localStorage 中恢复答案
|
||||
|
@ -116,6 +137,9 @@ function Operation1() {
|
|||
const storedChoiceAnswers = localStorage.getItem('choice_answers');
|
||||
const storedCompleAnswers = localStorage.getItem('completion_answer');
|
||||
const storedJudgeAnswers = localStorage.getItem('judge_answer')
|
||||
const storedAnsweredChoice=localStorage.getItem('answeredChoice')
|
||||
const storedAnsweredComple=localStorage.getItem('answeredComple')
|
||||
const storedAnsweredJudge=localStorage.getItem('answeredJudge')
|
||||
if (storedChoiceAnswers) {
|
||||
const parsedAnswers = JSON.parse(storedChoiceAnswers);
|
||||
setchoice_answer(parsedAnswers);
|
||||
|
@ -128,6 +152,16 @@ function Operation1() {
|
|||
const parsedAnswers = JSON.parse(storedJudgeAnswers);
|
||||
setjudge_answer(parsedAnswers);
|
||||
}
|
||||
|
||||
if(storedAnsweredChoice){
|
||||
setAnsweredChoice(storedAnsweredChoice)
|
||||
}
|
||||
if(storedAnsweredComple){
|
||||
setAnsweredComple(storedAnsweredComple)
|
||||
}
|
||||
if(storedAnsweredJudge){
|
||||
setAnsweredJudge(storedAnsweredJudge)
|
||||
}
|
||||
}, []);
|
||||
|
||||
//不包含实训分数
|
||||
|
@ -158,6 +192,8 @@ function Operation1() {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className='nav-operation1'>
|
||||
|
@ -191,19 +227,19 @@ function Operation1() {
|
|||
<tr>选择题:</tr>
|
||||
<div>
|
||||
{Object.keys(TrainData['operateID'][0]).map((key,index)=>(
|
||||
<td key={key}>{index+1}</td>
|
||||
<td key={key} className={answeredChoice.includes(index) ? 'answered' : ''}>{index+1}</td>
|
||||
))}
|
||||
</div>
|
||||
<tr>填空题:</tr>
|
||||
<div>
|
||||
{Object.keys(TrainData['operateID'][1]).map((key,index)=>(
|
||||
<td key={key}>{index+1}</td>
|
||||
<td key={key} className={answeredComple.includes(index) ? 'answered' : ''}>{index+1}</td>
|
||||
))}
|
||||
</div>
|
||||
<tr>判断题:</tr>
|
||||
<div>
|
||||
{Object.keys(TrainData['operateID'][2]).map((key,index)=>(
|
||||
<td key={key}>{index+1}</td>
|
||||
<td key={key} className={answeredJudge.includes(index) ? 'answered' : ''}>{index+1}</td>
|
||||
))}
|
||||
</div>
|
||||
</table>}
|
||||
|
|
|
@ -11,6 +11,10 @@ const list4=[
|
|||
// 首页 学习分析
|
||||
function SubjectPage(){
|
||||
const student_ID=localStorage.getItem('islogin')
|
||||
if(student_ID==null){
|
||||
alert('登录过期,请重新登录')
|
||||
window.location.href='http://localhost:3000/signin'
|
||||
}
|
||||
const [title,setTitle]=useState()
|
||||
// 获取实训标题
|
||||
const FetchTrainFunc=async()=>{
|
||||
|
|
|
@ -2,6 +2,7 @@ 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": "*"}})
|
||||
|
@ -230,6 +231,13 @@ def SendTrainTest():
|
|||
SendTrainTestFunc(TrainChoice, TrainCompletion, TrainJudge, Hour, Min, StopTime,Class,Train,teacher_id)
|
||||
return '发布成功'
|
||||
|
||||
|
||||
|
||||
@app.route('/api/student-test',methods=["POST"])
|
||||
def student_test():
|
||||
return k8s.list_pods()
|
||||
|
||||
|
||||
@app.route('/')
|
||||
@app.route('/<path:path>')
|
||||
def catch_all(path = "index.html"):
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
import json
|
||||
def list_pods():
|
||||
return json.load('test.txt')
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue