diff --git a/package.json b/package.json index 7ae1fe9..aff0b79 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,8 @@ "version": "0.0.1", "private": true, "scripts": { - "dev": "astro dev --host --port 2008", - "start": "astro dev --host --port 2008", + "dev": "astro dev --host --port 2020", + "start": "astro dev --host --port 2020", "build": "astro build", "preview": "astro preview", "astro": "astro" diff --git a/src/components/AddQuestion.vue b/src/components/AddQuestion.vue new file mode 100644 index 0000000..bf057db --- /dev/null +++ b/src/components/AddQuestion.vue @@ -0,0 +1,125 @@ + + \ No newline at end of file diff --git a/src/components/MCQQuestion.vue b/src/components/MCQQuestion.vue index e6c9f48..0745330 100644 --- a/src/components/MCQQuestion.vue +++ b/src/components/MCQQuestion.vue @@ -7,43 +7,49 @@
-
+

Question: {{ qPoint + 1 }} / {{ noOfQs }}

-

00:00

- + +
-
+
Question ID: {{ qsActive.id }}

-
- {{ index + 1 }}   -   +
+ {{ index + 1 }}   +  
-
+
- - - - + + + +
- +
No Data Found
+
+

Your Response

+
+

{{ index + 1}}

+
+
@@ -52,8 +58,8 @@ export default { data() { return { - totalAnswer: {}, - allAnswer: [], + saveAnswer: 0, + totalAnswer: [], qsData: "", noOfQs: 0, qPoint: 0, @@ -66,25 +72,29 @@ export default { }; }, methods: { + resetRadioInputs() { + // this.selectedOptions = {}; + this.saveAnswer = null; + }, saveAns() { - // if (this.totalAnswer !== null) { + // if (this.saveAnswer !== null) { const selectedAnswer = { - answer: this.totalAnswer, + answer: this.saveAnswer, questionId: this.qsData[this.qPoint].id, view: this.viewStatus = 1, // Set status to 1 for "Save Answer" }; - this.allAnswer.push(selectedAnswer); - console.log('array', this.allAnswer); + this.totalAnswer.push(selectedAnswer); + console.log('array', this.totalAnswer); // } else { // // Show an alert or set a message indicating that no option is selected // alert("Select an answer before saving."); // } + this.resetRadioInputs(); + if (this.totalAnswer.length <= 24) { + this.getNextQs(); + } }, - resetRadioInputs() { - // this.selectedOptions = {}; - this.totalAnswer = null; - }, - getNextQs() { + getNextQs() { this.qPoint++; this.qsActive=this.qsData[this.qPoint]; this.resetRadioInputs(); @@ -103,11 +113,18 @@ export default { questionId: this.qsData[this.qPoint].id, view: this.viewStatus = 1// Set status to 1 for "Save Answer" }; - this.allAnswer.push(selectedAnswer); + this.totalAnswer.push(selectedAnswer); + console.log('array later', this.totalAnswer); + }, selectOption(index) { this.selectedOptionIndex = index; }, + // submitExam(){ + // if (this.qPoint == this.noOfQs) { + // aler + // } + // }, }, mounted() { fetch('/assets/qs.json') @@ -122,19 +139,22 @@ export default { .catch(error => { console.error('Error fetching data:', error); }); - let intervalId; - // Start countdown on mounted - intervalId = setInterval(() => { - if (this.countdown > 0) { - this.countdown--; - } else { - clearInterval(intervalId); - } - }, 1000); + // this.remainingTime(); }, }; \ No newline at end of file diff --git a/src/pages/add-question.astro b/src/pages/add-question.astro new file mode 100644 index 0000000..23b05d2 --- /dev/null +++ b/src/pages/add-question.astro @@ -0,0 +1,7 @@ +--- +import Layout from "../layouts/Layout.astro"; +import AddQuestion from "../components/AddQuestion.vue"; +--- + + + \ No newline at end of file diff --git a/src/pages/identifier.astro b/src/pages/identifier.astro new file mode 100644 index 0000000..5b0f33d --- /dev/null +++ b/src/pages/identifier.astro @@ -0,0 +1,57 @@ +--- +import Layout from "../layouts/Layout.astro"; +import QuestionIdentifier from "../components/QuestionIdentifier.vue"; +--- + + + + + + \ No newline at end of file