เพิ่ม Ui ตำแหน่งตอนสร้างรอบสมัคร

This commit is contained in:
Kittapath 2023-04-05 00:59:05 +07:00
parent b42d797c78
commit 3dcdba77a6
14 changed files with 420 additions and 273 deletions

View file

@ -49,7 +49,7 @@
</q-step>
</q-stepper>
<q-dialog :model-value="modalConsend" persistent>
<q-card :style="$q.screen.gt.xs ? 'min-width: 55vw':'min-width: 80vw'">
<q-card :style="$q.screen.gt.xs ? 'min-width: 55vw' : 'min-width: 80vw'">
<Conference :ok="consendOk" :close="consenClose" />
</q-card>
</q-dialog>
@ -57,6 +57,9 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import { useCounterMixin } from '@/stores/mixin'
import { useQuasar } from 'quasar'
import { useExamDataStore } from '@/modules/01_exam/store'
import http from '@/plugins/http'
import config from '@/app.config'
@ -64,38 +67,50 @@ import ExamForm from '@/modules/01_exam/components/ExamForm.vue'
import ExamPayment from '@/modules/01_exam/components/ExamPayment.vue'
import ExamFinished from '@/modules/01_exam/components/ExamFinished.vue'
import Conference from '@/modules/01_exam/components/Conference.vue'
import { useRoute } from 'vue-router'
const $q = useQuasar()
const store = useExamDataStore()
const mixin = useCounterMixin()
const { modalError } = mixin
const step = ref<number>(1)
const stepRaw = ref<number>(1)
const tittle = ref<string>('')
const route = useRoute()
const examId = ref<string>(route.params.id.toString())
const positionId = ref<string>(route.params.positionId.toString())
const loader = ref<boolean>(false)
const status = ref<string>('register')
const modalConsend = ref<boolean>(false)
onMounted(async () => {
stepRaw.value = 3
step.value = 3
/* await fetchPeriodExam()
await candidateCheck() */
// stepRaw.value = 3
// step.value = 3
await fetchPeriodExam()
await candidateCheck()
})
const candidateCheck = async () => {
loader.value = true
await http
.get(config.API.candidateCheckCreate(examId.value))
.get(config.API.candidateCheckCreate(examId.value, positionId.value))
.then(async (res) => {
const data = res.data.result
store.consend = data
if (store.consend == true) {
await fetchStep()
store.consend = data.consend
const poition = data.positionExam
if (poition == true) {
modalError(
$q,
'คุณได้สมัครสอบตำแหน่งอื่นในรอบนี้แล้ว',
'คุณได้สมัครสอบตำแหน่งอื่นในรอบนี้แล้ว'
)
} else {
modalConsend.value = true
stepRaw.value = 2
step.value = 2
if (store.consend == true) {
await fetchStep()
} else {
modalConsend.value = true
stepRaw.value = 2
step.value = 2
}
}
})
.catch(() => {})
@ -107,7 +122,7 @@ const candidateCheck = async () => {
const fetchStep = async () => {
loader.value = true
await http
.get(config.API.candidateStatus(examId.value))
.get(config.API.candidateStatus(examId.value, positionId.value))
.then((res) => {
const data = res.data.result
status.value = data
@ -132,6 +147,9 @@ const fetchStep = async () => {
} else if (data == 'checkSeat') {
stepRaw.value = 4
step.value = 4
} else if (data == 'checkPoint') {
stepRaw.value = 4
step.value = 4
} else if (data == 'done') {
stepRaw.value = 4
step.value = 4