-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
160 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<template lang=""> | ||
<div class="mb-4"> | ||
<h1 v-html="props.name" class="mb-2"></h1> | ||
<p v-for="(ans, idx) in props.answers" :key="ans.id" class="text-sm mb-4 px-1 flex items-center"> | ||
<input | ||
:id="'question-'+props.questionId" | ||
type="radio" | ||
:value="idx" | ||
:name="'question-'+props.questionId" | ||
v-model="checked" | ||
class="w-4 h-4 bg-gray-100 border-gray-300 cursor-pointer focus:outline-none" | ||
/> | ||
|
||
<label | ||
:for="'question-'+props.questionId" | ||
:class="'ms-2 cursor-pointer ' + (checked===idx && 'text-[#67c23a]')" | ||
> | ||
{{ ans.name }} | ||
</label> | ||
</p> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { ref } from "vue"; | ||
const props = defineProps({ | ||
name: { | ||
type: String, | ||
required: true, | ||
}, | ||
answers: { | ||
type: Array, | ||
required: true, | ||
}, | ||
questionId: { | ||
type: Number, | ||
required: true, | ||
} | ||
}); | ||
const checked = ref(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template lang=""> | ||
<div class="my-5 flex md:gap-2 gap-4 items-center"> | ||
<h1 class="md:text-2xl text-xl font-bold text-center flex-1"> | ||
{{ props.name }} | ||
</h1> | ||
<router-link to="/" class="w-1/12"> | ||
<Icon icon="pi-home" className="md:text-2xl text-xl"/> | ||
</router-link> | ||
</div> | ||
|
||
</template> | ||
|
||
<script setup> | ||
import Icon from "@/components/Icon.vue"; | ||
const props = defineProps({ | ||
name: { | ||
type: String, | ||
required: true, | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
@tailwind utilities; | ||
|
||
body { | ||
box-sizing: border-box; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
|
||
input[type='radio'] { | ||
accent-color: green; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template lang=""> | ||
<div class="bg-slate-50 m-0 py-2 px-1"> | ||
<div class="md:w-9/12 rounded mx-auto box-shadow bg-white text-[#606266] flex flex-col"> | ||
<div v-if="!loadingStore.isLoading && examData"> | ||
<Title :name="examData.value.exam.name"/> | ||
<div class="md:px-4 px-2 text-lg mb-8"> | ||
<i class="font-medium">Thí sinh đọc kỹ đề trước khi làm bài.</i> | ||
<div class="my-3"> | ||
<Question | ||
v-for="q in examData.value.exam.pages[0].questions" | ||
:key="q.id" | ||
:name="q.name" | ||
:answers="q.answers" | ||
:question-id="q.id" | ||
/> | ||
</div> | ||
</div> | ||
|
||
<div class="flex justify-center mb-3"> | ||
<button @click="submitExam" type="button" class="px-4 py-1.5 rounded bg-[#67c23a] text-white hover:bg-[#67c23a]/80 flex items-center gap-2 text-base"> | ||
<Icon icon="pi-check"/> | ||
Nộp bài | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { useRoute } from 'vue-router'; | ||
import { watch, reactive } from "vue"; | ||
import { RepositoryFactory } from "@/api/RepositoryFactory"; | ||
import { useLoadingStore } from "@/store/loading"; | ||
import Title from "@/components/DoExercise/Title.vue"; | ||
import Question from "@/components/DoExercise/Question.vue"; | ||
import Icon from "@/components/Icon.vue"; | ||
const examData = reactive([]); | ||
const loadingStore = useLoadingStore(); | ||
const route = useRoute(); | ||
watch(() => [route.path, route.query], async () => { | ||
const exerciseId = route.params.exerciseId; | ||
const ExamRepository = RepositoryFactory.get("exams"); | ||
loadingStore.changeLoadingState(true); | ||
const { data } = await ExamRepository.getOne(exerciseId); | ||
loadingStore.changeLoadingState(false); | ||
examData.value = data; | ||
}, { immediate: true }); | ||
function submitExam() { | ||
alert("This feature will implement later"); | ||
} | ||
</script> | ||
|
||
<style lang="scss"> | ||
.box-shadow { | ||
box-shadow: 0 0 10px rgba(37, 41, 45, .1); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters