ต่อapiคนสมัครกรอกข้อมูลสมัครสอบ

This commit is contained in:
Kittapath 2023-03-25 01:07:18 +07:00
parent f74972e5ec
commit b7a91fa326
16 changed files with 567 additions and 522 deletions

View file

@ -31,7 +31,7 @@
stepRaw >= 1 ? (stepRaw == 1 ? 'mdi-pencil' : 'mdi-check-bold') : 'mdi-pencil'
"
>
<ExamDetail :fetchStep="fetchStep" :step="stepRaw" />
<ExamDetail :fetchStep="fetchStep" :status="status" />
</q-step> -->
<q-step
:done="step > 2"
@ -40,7 +40,7 @@
title="ข้อมูลสมัครสอบ"
:icon="stepRaw >= 2 ? (stepRaw == 2 ? 'mdi-pencil' : 'mdi-check-bold') : 'mdi-pencil'"
>
<ExamForm :fetchStep="fetchStep" :step="stepRaw" />
<ExamForm :fetchStep="fetchStep" :status="status" />
</q-step>
<q-step
:done="step > 3"
@ -49,7 +49,7 @@
title="ชำระค่าธรรมเนียมการสอบ"
:icon="stepRaw >= 3 ? (stepRaw == 3 ? 'mdi-pencil' : 'mdi-check-bold') : 'mdi-pencil'"
>
<ExamPayment :fetchStep="fetchStep" :step="stepRaw" />
<ExamPayment :fetchStep="fetchStep" :status="status" />
</q-step>
<q-step
:done="step > 4"
@ -58,7 +58,7 @@
title="สำเร็จ"
:icon="stepRaw >= 4 ? 'mdi-check-bold' : 'mdi-pencil'"
>
<ExamFinished :fetchStep="fetchStep" :step="stepRaw" />
<ExamFinished :fetchStep="fetchStep" :status="status" />
</q-step>
</q-stepper>
</div>
@ -67,38 +67,36 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import ExamDetail from '@/modules/01_exam/components/ExamDetail.vue'
import { useQuasar } from 'quasar'
import { useExamDataStore } from '@/modules/01_exam/store'
import keycloak from '@/plugins/keycloak'
import http from '@/plugins/http'
import config from '@/app.config'
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 keycloak from '@/plugins/keycloak'
import { useQuasar } from 'quasar'
import { useExamDataStore } from '@/modules/01_exam/store'
import http from '@/plugins/http'
import config from '@/app.config'
const $q = useQuasar()
const store = useExamDataStore()
const examId = ref<string>('zxc')
const step = ref<number>(2)
const stepRaw = ref<number>(2)
const examPost = ref<any>()
const step = ref<number>(1)
const stepRaw = ref<number>(1)
const tittle = ref<string>('การสอบภาค ข. พิเศษ สำหรับผู้สอบผ่านของส่วนราชการแล้ว ทดสอบ')
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
const loader = ref<boolean>(false)
const status = ref<string>('')
onMounted(() => {
candidateCheck()
fetchExams()
onMounted(async () => {
await candidateCheck()
})
const candidateCheck = async () => {
loader.value = true
await http
.get(config.API.candidateCheckCreate(candidateId.value))
.then((res) => {
.then(async (res) => {
const data = res.data.result
store.consend = data
if (store.consend == true) await fetchStep()
})
.catch(() => {})
.finally(() => {
@ -106,26 +104,43 @@ const candidateCheck = async () => {
})
}
const fetchExams = () => {
// const headers = { 'Content-Type': 'application/graphql' }
// this.loading = true
// this.$http
// .post(
// this.$config.API.getOrchardPath(),
// this.$config.API.getExamPostsForExamDetailQuery(this.$route.params.examId),
// { headers }
// )
// .then((response) => {
// this.examPost = response.data.data.examPost[0]
// this.test = this.examPost.bag.contentItems
// })
// .catch((err) => console.log(err))
// .finally(() => (this.loading = false))
}
const fetchStep = () => {
stepRaw.value += 1
step.value += 1
const fetchStep = async () => {
loader.value = true
await http
.get(config.API.candidateStatus(candidateId.value))
.then((res) => {
const data = res.data.result
status.value = data
if (data == 'register') {
stepRaw.value = 2
step.value = 2
} else if (data == 'checkRegister') {
stepRaw.value = 3
step.value = 3
} else if (data == 'payment') {
stepRaw.value = 3
step.value = 3
} else if (data == 'rejectRegister') {
stepRaw.value = 2
step.value = 2
} else if (data == 'checkPayment') {
stepRaw.value = 3
step.value = 3
} else if (data == 'rejectPayment') {
stepRaw.value = 3
step.value = 3
} else if (data == 'checkSeat') {
stepRaw.value = 4
step.value = 4
} else if (data == 'done') {
stepRaw.value = 4
step.value = 4
}
})
.catch(() => {})
.finally(() => {
loader.value = false
})
}
/**