|
|
@ -1,5 +1,5 @@ |
|
|
|
import "./index.css"; |
|
|
|
import "./index.css"; |
|
|
|
import { useSelector } from "react-redux"; |
|
|
|
import { connect, useSelector } from "react-redux"; |
|
|
|
import { useState } from "react"; |
|
|
|
import { useState } from "react"; |
|
|
|
|
|
|
|
|
|
|
|
import img0 from "../../../../assets/azmoon-list/test.png"; |
|
|
|
import img0 from "../../../../assets/azmoon-list/test.png"; |
|
|
@ -17,150 +17,184 @@ import { Link } from "react-router-dom"; |
|
|
|
import moment from "jalali-moment"; |
|
|
|
import moment from "jalali-moment"; |
|
|
|
import { useEffect } from "react"; |
|
|
|
import { useEffect } from "react"; |
|
|
|
import { state } from "../../../../components/exam/Carousel/state"; |
|
|
|
import { state } from "../../../../components/exam/Carousel/state"; |
|
|
|
|
|
|
|
import { exam } from "../../../../redux/actions"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let gradeList = [ |
|
|
|
const EnterExam = ({ ID }) => { |
|
|
|
"اول", |
|
|
|
// const state = useSelector((state) => state.default);
|
|
|
|
"دوم", |
|
|
|
|
|
|
|
"سوم", |
|
|
|
|
|
|
|
"چهارم", |
|
|
|
|
|
|
|
"پنجم", |
|
|
|
|
|
|
|
"ششم", |
|
|
|
|
|
|
|
"هفتم", |
|
|
|
|
|
|
|
"هشتم", |
|
|
|
|
|
|
|
"نهم", |
|
|
|
|
|
|
|
"دهم", |
|
|
|
|
|
|
|
"یازدهم", |
|
|
|
|
|
|
|
"دوازدهم", |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
const EnterExam = ({ ID, getExamInfo, examInfo }) => { |
|
|
|
|
|
|
|
// const state = useSelector((state) => state.default);
|
|
|
|
|
|
|
|
console.log("Cheraaaaaaaaaaaaaa????????"); |
|
|
|
|
|
|
|
console.log(ID); |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
|
|
getExamInfo({ id: ID }); |
|
|
|
|
|
|
|
}, []); |
|
|
|
|
|
|
|
console.log(examInfo); |
|
|
|
|
|
|
|
//------------------------------------------
|
|
|
|
const [common_data] = useState(state); |
|
|
|
const [common_data] = useState(state); |
|
|
|
console.log(common_data); |
|
|
|
|
|
|
|
let data; |
|
|
|
let data; |
|
|
|
for (let i = 0; i < common_data.length; i++) { |
|
|
|
for (let i = 0; i < common_data.length; i++) { |
|
|
|
if (common_data[i].id === Number(ID)) { |
|
|
|
if (common_data[i].id === Number(ID)) { |
|
|
|
data = common_data[i]; |
|
|
|
data = common_data[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
console.log("cc:"+data); |
|
|
|
console.log("cc:" + data); |
|
|
|
//--today date--and timer setting-----------------------------
|
|
|
|
//--today date--and timer setting-----------------------------
|
|
|
|
let today = new Date(); |
|
|
|
// let today = new Date();
|
|
|
|
let examDate = new Date(data.date) |
|
|
|
// let examDate = new Date(data.date)
|
|
|
|
console.log(today); |
|
|
|
// let diff = (examDate-today)/1000;
|
|
|
|
console.log(examDate); |
|
|
|
// let d = Math.floor(diff/86400);
|
|
|
|
let diff = (examDate-today)/1000; |
|
|
|
// let h = Math.floor((diff-(86400*d))/3600);
|
|
|
|
let d = Math.floor(diff/86400); |
|
|
|
// let m = Math.floor((diff-(86400*d)-(h*3600))/60);
|
|
|
|
console.log(d); |
|
|
|
// let s = Math.floor(diff-(86400*d)-(h*3600)-(m*60));
|
|
|
|
let h = Math.floor((diff-(86400*d))/3600); |
|
|
|
// const [timer,setTimer]=useState({
|
|
|
|
console.log(h); |
|
|
|
// d,h,m,s
|
|
|
|
let m = Math.floor((diff-(86400*d)-(h*3600))/60); |
|
|
|
// })
|
|
|
|
console.log(m); |
|
|
|
|
|
|
|
let s = Math.floor(diff-(86400*d)-(h*3600)-(m*60)); |
|
|
|
|
|
|
|
console.log(s); |
|
|
|
|
|
|
|
const [timer,setTimer]=useState({ |
|
|
|
|
|
|
|
d,h,m,s |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
// console.log(sec);
|
|
|
|
// console.log(sec);
|
|
|
|
if (timer.s >= 0 && diff > 0) { |
|
|
|
// if (timer.s >= 0 && diff > 0) {
|
|
|
|
setTimeout(() => { |
|
|
|
// setTimeout(() => {
|
|
|
|
// console.log("okdkdokodkd");
|
|
|
|
// // console.log("okdkdokodkd");
|
|
|
|
setTimer({ |
|
|
|
// setTimer({
|
|
|
|
d, |
|
|
|
// d,
|
|
|
|
h, |
|
|
|
// h,
|
|
|
|
m, |
|
|
|
// m,
|
|
|
|
s:s-1 |
|
|
|
// s:s-1
|
|
|
|
}); |
|
|
|
// });
|
|
|
|
if (timer.s === 0) { |
|
|
|
// if (timer.s === 0) {
|
|
|
|
setTimer({ |
|
|
|
// setTimer({
|
|
|
|
d, |
|
|
|
// d,
|
|
|
|
h, |
|
|
|
// h,
|
|
|
|
m:m-1, |
|
|
|
// m:m-1,
|
|
|
|
s:59 |
|
|
|
// s:59
|
|
|
|
}); |
|
|
|
// });
|
|
|
|
} |
|
|
|
// }
|
|
|
|
if (timer.m === 0) { |
|
|
|
// if (timer.m === 0) {
|
|
|
|
setTimer({ |
|
|
|
// setTimer({
|
|
|
|
d, |
|
|
|
// d,
|
|
|
|
h:h-1, |
|
|
|
// h:h-1,
|
|
|
|
m:59, |
|
|
|
// m:59,
|
|
|
|
s:59 |
|
|
|
// s:59
|
|
|
|
}); |
|
|
|
// });
|
|
|
|
} |
|
|
|
// }
|
|
|
|
if (timer.h === 0) { |
|
|
|
// if (timer.h === 0) {
|
|
|
|
setTimer({ |
|
|
|
// setTimer({
|
|
|
|
d:d-1, |
|
|
|
// d:d-1,
|
|
|
|
h:23, |
|
|
|
// h:23,
|
|
|
|
m:59, |
|
|
|
// m:59,
|
|
|
|
s:59 |
|
|
|
// s:59
|
|
|
|
}); |
|
|
|
// });
|
|
|
|
} |
|
|
|
// }
|
|
|
|
}, 1000); |
|
|
|
// }, 1000);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
}); |
|
|
|
}); |
|
|
|
//-------------------------------------------
|
|
|
|
//-------------------------------------------
|
|
|
|
moment.locale("en"); |
|
|
|
moment.locale("en"); |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div className="enter-exam"> |
|
|
|
<div className="enter-exam"> |
|
|
|
<div className="enter-exam-box"> |
|
|
|
<div |
|
|
|
|
|
|
|
className="enter-exam-box" |
|
|
|
|
|
|
|
style={window.innerWidth < 1000 ? { width: "95%" } : { width: "35%",height:"auto" }} |
|
|
|
|
|
|
|
> |
|
|
|
<div className="eeb-title-box"> |
|
|
|
<div className="eeb-title-box"> |
|
|
|
<img className="eeb-title-box-img" src={img0} alt="title-box-img" /> |
|
|
|
<img className="eeb-title-box-img" src={img0} alt="title-box-img" /> |
|
|
|
<div className="eeb-title-box-title">به {data?.name}</div> |
|
|
|
<div className="eeb-title-box-title">به {examInfo?.name}</div> |
|
|
|
<div className="eeb-title-box-subtitle">خوش آمدید</div> |
|
|
|
<div className="eeb-title-box-subtitle">خوش آمدید</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="eeb-name-box"> |
|
|
|
<div className="eeb-name-box"> |
|
|
|
<img className="eeb-name-box-icon" src={icon1} alt="name-icon" /> |
|
|
|
<img className="eeb-name-box-icon" src={icon1} alt="name-icon" /> |
|
|
|
<div className="eeb-name-box-label">نام آزمون:</div> |
|
|
|
<div className="eeb-name-box-label">نام آزمون:</div> |
|
|
|
<div className="eeb-name-box-name">{data?.name.substr(6)}</div> |
|
|
|
<div className="eeb-name-box-name">{examInfo?.name}</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="eeb-level-box"> |
|
|
|
<div className="eeb-level-box"> |
|
|
|
<img className="eeb-level-box-icon" src={icon2} alt="name-icon" /> |
|
|
|
<img className="eeb-level-box-icon" src={icon2} alt="name-icon" /> |
|
|
|
<div className="eeb-level-box-label">پایه تحصیلی:</div> |
|
|
|
<div className="eeb-level-box-label">پایه تحصیلی:</div> |
|
|
|
<div className="eeb-level-box-level">{data?.level}</div> |
|
|
|
<div className="eeb-level-box-level"> |
|
|
|
|
|
|
|
{gradeList[examInfo?.gradeId - 1]} |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="eeb-date-box"> |
|
|
|
<div className="eeb-date-box"> |
|
|
|
<img className="eeb-date-box-icon" src={icon3} alt="name-icon" /> |
|
|
|
<img className="eeb-date-box-icon" src={icon3} alt="name-icon" /> |
|
|
|
<div className="eeb-date-box-label">زمان آزمون:</div> |
|
|
|
<div className="eeb-date-box-label">زمان آزمون:</div> |
|
|
|
|
|
|
|
{examInfo?.startDate && ( |
|
|
|
<div className="eeb-date-box-date"> |
|
|
|
<div className="eeb-date-box-date"> |
|
|
|
{moment(data?.date, 'YYYY/MM/DD').format('jYYYY/jM/jD')} |
|
|
|
از{" "} |
|
|
|
</div> |
|
|
|
{examInfo?.startDate && |
|
|
|
<div className="eeb-date-box-time">ساعت
|
|
|
|
moment(examInfo?.startDate, "YYYY/MM/DD") |
|
|
|
{examDate.getHours()}:{examDate.getMinutes()} |
|
|
|
.locale("fa") |
|
|
|
|
|
|
|
.format("YYYY/MM/DD")}{" "} |
|
|
|
|
|
|
|
تا{" "} |
|
|
|
|
|
|
|
{examInfo?.endDate && |
|
|
|
|
|
|
|
moment(examInfo?.endDate, "YYYY/MM/DD") |
|
|
|
|
|
|
|
.locale("fa") |
|
|
|
|
|
|
|
.format("YYYY/MM/DD")} |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
{!examInfo?.startDate && ( |
|
|
|
|
|
|
|
<div className="eeb-date-box-date">نامشخص</div> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
{/* <div className="eeb-date-box-time"> |
|
|
|
|
|
|
|
ساعت |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> */} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div |
|
|
|
<div className="eeb-negetive-point-and-question-type-box"> |
|
|
|
className="eeb-negetive-point-and-question-type-box" |
|
|
|
<div className="eeb-np-box"> |
|
|
|
style={{ display: "block" }} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<div className="eeb-np-box border-b border-[#F5F5F5]"> |
|
|
|
<img className="eeb-np-box-icon" src={icon4} alt="name-icon" /> |
|
|
|
<img className="eeb-np-box-icon" src={icon4} alt="name-icon" /> |
|
|
|
<div className="eeb-np-box-label">نمره منفی:</div> |
|
|
|
<div className="eeb-np-box-label">نمره منفی:</div> |
|
|
|
<div className="eeb-np-box-have"> |
|
|
|
<div className="eeb-np-box-have"> |
|
|
|
{data?.negattiveMode && "دارد"} |
|
|
|
{examInfo?.negativePoint && "دارد"} |
|
|
|
{!data?.negattiveMode && "ندارد"} |
|
|
|
{!examInfo?.negativePoint && "ندارد"} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="eeb-qt-box"> |
|
|
|
<div className="eeb-qt-box"> |
|
|
|
<img className="eeb-qt-box-icon" src={icon5} alt="name-icon" /> |
|
|
|
<img className="eeb-qt-box-icon" src={icon5} alt="name-icon" /> |
|
|
|
<div className="eeb-qt-box-label">نوع سوالات:</div> |
|
|
|
<div className="eeb-qt-box-label">نوع سوالات:</div> |
|
|
|
<div className="eeb-qt-box-type">{data?.types}</div> |
|
|
|
<div className="eeb-qt-box-type">تستی</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="eeb-max-user-and-exam-type-box"> |
|
|
|
<div className="eeb-max-user-and-exam-type-box"> |
|
|
|
<div className="eeb-mu-box"> |
|
|
|
{/* <div className="eeb-mu-box"> |
|
|
|
<img className="eeb-mu-box-icon" src={icon6} alt="name-icon" /> |
|
|
|
<img className="eeb-mu-box-icon" src={icon6} alt="name-icon" /> |
|
|
|
<div className="eeb-mu-box-label">حدنصاب شرکت کنندگان: </div> |
|
|
|
<div className="eeb-mu-box-label">حدنصاب شرکت کنندگان: </div> |
|
|
|
<div className="eeb-mu-box-number">{data?.capacity} نفر</div> |
|
|
|
<div className="eeb-mu-box-number">{data?.capacity} نفر</div> |
|
|
|
</div> |
|
|
|
</div> */} |
|
|
|
<div className="eeb-et-box"> |
|
|
|
<div className="eeb-et-box"> |
|
|
|
<img className="eeb-et-box-icon" src={icon7} alt="name-icon" /> |
|
|
|
<img className="eeb-et-box-icon" src={icon7} alt="name-icon" /> |
|
|
|
<div className="eeb-et-box-label">نوع شرکت در آزمون:</div> |
|
|
|
<div className="eeb-et-box-label">نوع شرکت در آزمون:</div> |
|
|
|
<div className="eeb-et-box-type"> |
|
|
|
<div className="eeb-et-box-type"> |
|
|
|
{data?.type===1 && "انفرادی"} |
|
|
|
{data?.type === 1 && "انفرادی"} |
|
|
|
{data?.type===2 && "گروهی"} |
|
|
|
{data?.type === 2 && "گروهی"} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="eeb-guide-box"> |
|
|
|
{/* <div className="eeb-guide-box"> |
|
|
|
<img className="eeb-guide-box-icon" src={icon8} alt="name-icon" /> |
|
|
|
<img className="eeb-guide-box-icon" src={icon8} alt="name-icon" /> |
|
|
|
<div className="eeb-guide-box-label">فایل راهنما:</div> |
|
|
|
<div className="eeb-guide-box-label">فایل راهنما:</div> |
|
|
|
<div className="eeb-guide-box-have"> |
|
|
|
<div className="eeb-guide-box-have"> |
|
|
|
{data?.guideFileId && "دارد"} |
|
|
|
{data?.guideFileId && "دارد"} |
|
|
|
{!data?.guideFileId && "ندارد"} -</div> |
|
|
|
{!data?.guideFileId && "ندارد"} - |
|
|
|
<Link |
|
|
|
</div> |
|
|
|
to={data?.guideFileId || "#"} |
|
|
|
<Link to={data?.guideFileId || "#"} className="eeb-guide-box-link"> |
|
|
|
className="eeb-guide-box-link" |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
دریافت فایل |
|
|
|
دریافت فایل |
|
|
|
</Link> |
|
|
|
</Link> |
|
|
|
</div> |
|
|
|
</div> */} |
|
|
|
<div className="eeb-created-box"> |
|
|
|
{/* <div className="eeb-created-box"> |
|
|
|
<div className="eeb-created-box-img-container"> |
|
|
|
<div className="eeb-created-box-img-container"> |
|
|
|
<img |
|
|
|
<img |
|
|
|
className="eeb-created-box-icon" |
|
|
|
className="eeb-created-box-icon" |
|
|
@ -170,14 +204,14 @@ const EnterExam = ({ ID }) => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className="eeb-created-box-label">ایجاد شده توسط</div> |
|
|
|
<div className="eeb-created-box-label">ایجاد شده توسط</div> |
|
|
|
<div className="eeb-created-box-file">موسسه فرهنگی مصباح نور</div> |
|
|
|
<div className="eeb-created-box-file">موسسه فرهنگی مصباح نور</div> |
|
|
|
</div> |
|
|
|
</div> */} |
|
|
|
{(new Date(data.date)<today) &&<Link |
|
|
|
<Link |
|
|
|
to={`/dashboard/azmoon_list/exam/${data?.id}`} |
|
|
|
to={`/dashboard/azmoon_list/exam/${data?.id}`} |
|
|
|
className="eeb-btn" |
|
|
|
className="eeb-btn" |
|
|
|
> |
|
|
|
> |
|
|
|
شروع آزمون |
|
|
|
شروع آزمون |
|
|
|
</Link>} |
|
|
|
</Link> |
|
|
|
{(new Date(data.date)>today) &&
|
|
|
|
{/* {(new Date(data.date)>today) && |
|
|
|
<div className="eeb-timer"> |
|
|
|
<div className="eeb-timer"> |
|
|
|
<div>{timer.d} روز و </div> |
|
|
|
<div>{timer.d} روز و </div> |
|
|
|
<div>{timer.h} ساعت و </div> |
|
|
|
<div>{timer.h} ساعت و </div> |
|
|
@ -185,10 +219,18 @@ const EnterExam = ({ ID }) => { |
|
|
|
<div>{timer.s} ثانیه </div> |
|
|
|
<div>{timer.s} ثانیه </div> |
|
|
|
<div>تا شروع آزمون</div> |
|
|
|
<div>تا شروع آزمون</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
} |
|
|
|
} */} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
); |
|
|
|
); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export default EnterExam; |
|
|
|
const mapStateToProps = (state) => ({ |
|
|
|
|
|
|
|
examInfo: state.exam2.info, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const mapDispatchToProps = { |
|
|
|
|
|
|
|
getExamInfo: exam.info, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, mapDispatchToProps)(EnterExam); |
|
|
|