ต่อ api ใบเข้าสอบ

This commit is contained in:
Kittapath 2023-04-06 22:52:53 +07:00
parent 8d53b576e2
commit 04bbc10531
8 changed files with 112 additions and 53 deletions

View file

@ -2,15 +2,23 @@
<div class="q-pa-md row items-center justify-center">
<div class="col-xs-12 col-sm-8 col-md-6">
<q-card flat class="q-pa-md q-mb-sm" :class="getClass(status)">
<div v-if="status != 'done' && status != 'checkPoint'" class="text-orange-6 text-bold">
<div v-if="status == 'checkRegister'" class="text-orange-6 text-bold">
<q-icon
name="mdi-timer-sand"
size="22px"
color="orange-5"
class="q-mr-sm"
/>
/>
</div>
<div v-else class="text-green-6 text-bold">
<div v-else-if="status == 'checkPoint'" class="text-orange-6 text-bold">
<q-icon
name="mdi-timer-sand"
size="22px"
color="orange-5"
class="q-mr-sm"
/>
</div>
<div v-else-if="status == 'done'" class="text-green-6 text-bold">
<q-icon
name="mdi-checkbox-marked-circle-outline"
size="22px"
@ -18,6 +26,14 @@
class="q-mr-sm"
/>
</div>
<div v-else class="text-orange-6 text-bold">
<q-icon
name="mdi-timer-sand"
size="22px"
color="orange-5"
class="q-mr-sm"
/>
</div>
</q-card>
<q-card bordered flat class="col-12 row">
@ -34,24 +50,24 @@
<div class="text-black text-bold q-pl-sm">{{ fullName }}</div>
</div>
<div class="q-pt-xs row">
<div class="">เลขประจำตสอบ :</div>
<div class="text-black text-bold q-pl-sm">{{ examNumber }}</div>
<div class="">เลขประจำตประชาชน :</div>
<div class="text-black text-bold q-pl-sm">{{ citizenId }}</div>
</div>
<div class="q-pt-xs row">
<div class="">เลขประจำตประชาชน :</div>
<div class="text-black q-pl-sm">{{ citizenId }}</div>
<div class="">เลขประจำตสอบ :</div>
<div class="text-black text-bold q-pl-sm">{{ examNumber }}</div>
</div>
<!-- <div class="q-pt-xs row">
<div class="">เวลาสอบ :</div>
<div class="text-black q-pl-sm">{{ examTime }}</div>
</div> -->
<div class="q-pt-xs row">
<div class="">สถานทสอบ :</div>
<div class="text-black q-pl-sm">{{ examLocation }}</div>
<div class="">เลขทสอบ :</div>
<div class="text-black text-bold q-pl-sm">{{ examSeat }}</div>
</div>
<div class="q-pt-xs row">
<div class="">คะแนน</div>
<div class="text-black q-pl-sm">{{ floor }}</div>
<div class="text-black text-bold q-pl-sm">{{ point }}</div>
</div>
<!-- <div class="q-pt-xs row">
<div class="">องสอบ :</div>
@ -79,6 +95,9 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import http from '@/plugins/http'
import config from '@/app.config'
import { useRoute } from 'vue-router'
const props = defineProps({
fetchStep: {
@ -91,16 +110,42 @@ const props = defineProps({
}
})
const fullName = ref<string>('นางพิมพ์ภา วงศ์สวัสดิ์')
const examNumber = ref<string>('CDE-004')
const citizenId = ref<string>('1100700954521')
const examTime = ref<string>('09:00-12:00')
const examLocation = ref<string>('ศูนย์สอบ 01 กรุงเทพฯและนนทบุรี')
const floor = ref<string>('4')
const examRoom = ref<string>('CB-706')
const seatNumber = ref<string>('75')
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 fullName = ref<string>('')
const examNumber = ref<string>('')
const citizenId = ref<string>('')
const examSeat = ref<string>('')
const point = ref<string>('')
onMounted(async () => {
await fetchStatus()
})
const fetchStatus = async () => {
loader.value = true
await http
.get(config.API.candidateCard(examId.value, positionId.value))
.then((res) => {
const data = res.data.result
fullName.value = data.prefix + data.firstName + ' ' + data.lastName
examNumber.value = data.examIdenNumber
citizenId.value = data.citizenId
examSeat.value = data.seatNumber
point.value = data.point
})
.catch(() => {
// acceptTermOfUse.value = false
})
.finally(() => {
loader.value = false
})
}
const download = () => {}
const getClass = (val: string) => {
return val == 'done' || val == 'checkPoint' ? 'bg-green-1' : 'bg-yellow-2'
}

View file

@ -23,7 +23,7 @@
label="บันทึกข้อมูล"
outline
icon="mdi-content-save"
@click="saveData"
@click="saveAuto = false && saveData"
v-if="status === 'register' || status === 'rejectRegister'"
:disable="!acceptTermOfUse || statusEdit"
/>
@ -79,6 +79,7 @@ const formInformation = ref<any>({})
const formAddress = ref<any>({})
const formFamily = ref<any>({})
const formOccupation = ref<any>({})
const saveAuto = ref<boolean>(false)
onMounted(async () => {
// if (props.status !== 'register') {
@ -91,36 +92,35 @@ const okModalConfirm = () => {
if (statusEdit.value == true) {
modalError($q, 'ไม่สามารถสมัครสอบได้', 'มีข้อมูลที่ยังไม่ถูกบันทึกข้อมูล')
} else {
saveAuto.value = true
modalConfirm(
$q,
'ยืนยันการสมัครสอบ?',
'เมื่อยืนยันการสมัครสอบแล้วจะไม่สามารถแก้ไขข้อมูลได้',
saveForm
saveData
)
}
}
const fetchStatus = async () => {
loader.value = true
await http
.get(config.API.candidateStatus(examId.value, positionId.value))
.get(config.API.candidateCard(examId.value, positionId.value))
.then((res) => {
acceptTermOfUse.value = true
})
.catch(() => {
acceptTermOfUse.value = false
})
.catch(() => {})
.finally(() => {
loader.value = false
})
}
const saveForm = async () => {
//saveform
loader.value = true
await http
.get(config.API.candidateRegister(examId.value, positionId.value))
.then(() => {
success($q, 'สมัครสอบสำเร็จสำเร็จ')
// success($q, '')
})
.catch(() => {})
.finally(async () => {
@ -227,6 +227,7 @@ const saveData = async () => {
})
.finally(async () => {
loader.value = false
if (saveAuto.value) await saveForm()
await props.fetchStep()
})
}

View file

@ -12,9 +12,9 @@
<q-item-label class="text-weight-medium text-subtitle1"
>ชำระเงนคาสมครสอบผานสำน/หนวยงาน</q-item-label
>
<q-item-label caption class="gt-xs"
<!-- <q-item-label caption class="gt-xs"
>อนหลงแจงการโอนภายใน 24 วโมง</q-item-label
>
> -->
</q-item-section>
<!-- <q-item-section avatar class="gt-xs">
<q-avatar size="32px">
@ -129,9 +129,9 @@
<q-item-label class="text-weight-medium text-subtitle1"
>ชำระเงนคาสมครสอบผานธนาคารกรงไทย</q-item-label
>
<q-item-label caption class="gt-xs"
<!-- <q-item-label caption class="gt-xs"
>อนหลงแจงการโอนภายใน 24 วโมง</q-item-label
>
> -->
</q-item-section>
<!-- <q-item-section avatar class="gt-xs">
<q-avatar size="32px">
@ -235,6 +235,8 @@
</div>
<div class="row col-12 justify-center">
<q-btn
icon="mdi-check"
color="primary"
style="width: 200px"
label="แจ้งการชำระเงิน"
@click="clickPayment"
@ -300,7 +302,6 @@ const fetchPaymentExam = async () => {
.catch(() => {})
.finally(async () => {
loader.value = false
props.fetchStep()
})
}

View file

@ -201,7 +201,6 @@ const getData = async () => {
.get(config.API.candidateUpload(examId.value, positionId.value))
.then((res) => {
const data = res.data.result
// console.log(data)
files.value = data
})
.catch(() => {})
@ -221,7 +220,6 @@ const deleteData = async (id: string) => {
})
.then((res) => {
const data = res.data.result
console.log(data)
})
.catch(() => {})
.finally(async () => {
@ -238,7 +236,6 @@ const uploadData = async () => {
.put(config.API.candidateUpload(examId.value, positionId.value), formData)
.then((res) => {
const data = res.data.result
console.log(data)
})
.catch(() => {})
.finally(async () => {
@ -257,7 +254,6 @@ const downloadData = async (id: string) => {
.get(config.API.candidateDownload(id))
.then((res) => {
const data = res
console.log(data)
})
.catch(() => {})
.finally(() => {