This commit is contained in:
30404 2024-06-29 22:19:01 +08:00
parent 5c5803e819
commit dea760fcb9
1 changed files with 8 additions and 4 deletions

View File

@ -15,6 +15,7 @@ function Exam() {
const {examId}=useParams() const {examId}=useParams()
const student_ID=localStorage.getItem('islogin') const student_ID=localStorage.getItem('islogin')
const [score,setscore]=useState(0) const [score,setscore]=useState(0)
const [isEntry,setisEntry]=useState(false)
// //
const [TestData,setTestData]=useState() const [TestData,setTestData]=useState()
@ -49,7 +50,9 @@ function Exam() {
} }
useEffect(()=>{ useEffect(()=>{
scoreEntry() if(isEntry){
scoreEntry()
}
},[score]) },[score])
function daojishi(){ function daojishi(){
@ -65,7 +68,7 @@ function Exam() {
useEffect(()=>{ useEffect(()=>{
daojishi() daojishi()
console.log('a'); console.log('a');
},[]) },[TestData])
// //
@ -78,7 +81,6 @@ function Exam() {
clearInterval(interval); clearInterval(interval);
alert('考试时间到!'); alert('考试时间到!');
correct() correct()
window.location.href='http://localhost:3000/subject' window.location.href='http://localhost:3000/subject'
} }
}, 1000); }, 1000);
@ -87,8 +89,9 @@ function Exam() {
useEffect(()=>{ useEffect(()=>{
if(countdown<0){ if(countdown<0){
setCountdown(60 * parseInt(TestData['examID'][3]))
localStorage.removeItem('time') localStorage.removeItem('time')
setCountdown(60 * parseInt(TestData['examID'][3]))
} }
},[TestData]) },[TestData])
@ -171,6 +174,7 @@ function Exam() {
} }
JUD_sum++ JUD_sum++
} }
setisEntry(true)
} }