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