This commit is contained in:
nopy 2024-06-27 10:53:55 +08:00
commit 2c486a8c0a
4 changed files with 20 additions and 8 deletions

View File

@ -11,7 +11,7 @@ import axios from 'axios';
function Operation1() { function Operation1() {
const click=()=>{ const click=()=>{
console.log(answeredJudge); console.log(TrainData);
} }
const clear=()=>{ const clear=()=>{
localStorage.removeItem('choice_answers'); localStorage.removeItem('choice_answers');
@ -26,6 +26,7 @@ function Operation1() {
setAnsweredComple([]) setAnsweredComple([])
localStorage.removeItem('answeredJudge') localStorage.removeItem('answeredJudge')
setAnsweredJudge([]) setAnsweredJudge([])
localStorage.removeItem('RemainingTime')
} }
const { operateID } = useParams(); const { operateID } = useParams();
@ -39,13 +40,19 @@ function Operation1() {
}) })
const returnData=TrainDataSrc.data const returnData=TrainDataSrc.data
setTrainData(returnData) setTrainData(returnData)
setCountdown(60*parseInt(returnData['operateID'][4])) //60*parseInt(returnData['operateID'][4]
}catch{ }catch{
alert('TrainDataFunc出错') alert('TrainDataFunc出错')
} }
} }
useEffect(()=>{ useEffect(()=>{
TrainDataFunc() TrainDataFunc()
const RemainingTime=localStorage.getItem('RemainingTime')
if(!isNaN(RemainingTime) && RemainingTime !== '') {
setCountdown(RemainingTime);
} else {
setCountdown(60 * parseInt(TrainData['operateID'][4]));
}
},[]) },[])
// //
const [countdown, setCountdown] = useState(); const [countdown, setCountdown] = useState();
@ -58,6 +65,7 @@ function Operation1() {
let interval = setInterval(() => { let interval = setInterval(() => {
if (countdown != 0) { if (countdown != 0) {
setCountdown(countdown - 1); setCountdown(countdown - 1);
localStorage.setItem('RemainingTime',countdown)
} else { } else {
clearInterval(interval); clearInterval(interval);
alert('考试时间到!'); alert('考试时间到!');
@ -130,6 +138,7 @@ function Operation1() {
localStorage.setItem('answeredChoice',answeredChoice) localStorage.setItem('answeredChoice',answeredChoice)
localStorage.setItem('answeredComple',answeredComple) localStorage.setItem('answeredComple',answeredComple)
localStorage.setItem('answeredJudge',answeredJudge) localStorage.setItem('answeredJudge',answeredJudge)
}; };
// localStorage // localStorage

View File

@ -11,6 +11,10 @@ import top from '../img/top.jpg'
function Operation2() { function Operation2() {
const { operateID } = useParams(); const { operateID } = useParams();
//
const RemainingTime=localStorage.getItem('RemainingTime')
// //
const terminalObj = useRef(null); const terminalObj = useRef(null);
let sock = null; let sock = null;
@ -63,15 +67,15 @@ function Operation2() {
// //
useEffect(() => { useEffect(() => {
const examDuration = 60 * 60; // 1 setCountdown(RemainingTime);
setCountdown(examDuration);
}, []); }, []);
// //
useEffect(() => { useEffect(() => {
let interval = setInterval(() => { let interval = setInterval(() => {
if (countdown > 0) { if (countdown != 0) {
setCountdown(countdown - 1); setCountdown(countdown - 1);
localStorage.setItem('RemainingTime',countdown)
} else { } else {
clearInterval(interval); clearInterval(interval);
alert('考试时间到!'); alert('考试时间到!');

View File

@ -23,8 +23,8 @@ import ClassID from '../TeacherPages/classlistpages/classId';
import ManageTest from '../TeacherPages/TestManage/ManageTest'; import ManageTest from '../TeacherPages/TestManage/ManageTest';
import SendTest from '../TeacherPages/TestManage/SendTest'; import SendTest from '../TeacherPages/TestManage/SendTest';
import Marking from '../TeacherPages/MarkingPages/Marking'; import Marking from '../TeacherPages/MarkingPages/Marking';
import SendTrain from '../TeacherPages/TrainManage/SendTrain'; import SendTrain from '../TeacherPages//Trainmanage/SendTrain';
import TrainManage from '../TeacherPages/TrainManage/Trainmanage'; import TrainManage from '../TeacherPages/Trainmanage/Trainmanage';
import StudentLink from '../TeacherPages/MarkingPages/StudentLink'; import StudentLink from '../TeacherPages/MarkingPages/StudentLink';
import List_pods from '../TeacherPages/list_pods/list_pods'; import List_pods from '../TeacherPages/list_pods/list_pods';

View File

@ -97,7 +97,6 @@ def fetch_result_func(id): # 查询一个同学在不同时间段的不同考
for i in result: for i in result:
result_dic[i[3]]=i[5] result_dic[i[3]]=i[5]
cursor.close() cursor.close()
print(result_dic)
return result_dic return result_dic
def get_lesson_func(id): def get_lesson_func(id):