ต่อ 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(() => {

View file

@ -15,6 +15,7 @@ export const useExamDataStore = defineStore('exam', () => {
})
const consend = ref<boolean>(false)
const status = ref<string>('')
const changeExamColumns = (system: String, val: String[]) => {
if (system == 'main') examData.value.main.columns = val
@ -27,9 +28,15 @@ export const useExamDataStore = defineStore('exam', () => {
examData.value = JSON.parse(localStorage.getItem('exam') || '{}')
}
const changeStatus = (val: string) => {
status.value = val
}
return {
examData,
changeExamColumns,
consend
consend,
status,
changeStatus
}
})

View file

@ -3,7 +3,7 @@
<q-toolbar class="q-pa-sm text-center">
<q-toolbar-title class="text-dark">
{{ tittle }}
<div class="text-light">ตำแหน..&nbsp;&nbsp;{{ position }}</div>
<div class="text-light text-body2">{{ position }}</div>
</q-toolbar-title>
</q-toolbar>
<q-stepper
@ -102,15 +102,9 @@ const candidateCheck = async () => {
store.consend = data.consend
const positionExam = data.positionExam
stepPayment.value = data.bank
// console.log('qwe')
// console.log(positionId.value != '00000000-0000-0000-0000-000000000000')
// console.log(positionId.value)
// console.log(positionExam)
// console.log(positionExam.id)
// console.log(data.status != 'register')
// console.log(data.status != 'rejectRegister')
if (
positionId.value != '00000000-0000-0000-0000-000000000000' &&
positionExam != null &&
positionExam.id != positionId.value &&
data.status != 'register' &&
data.status != 'rejectRegister'
@ -118,7 +112,8 @@ const candidateCheck = async () => {
modalError(
$q,
'คุณได้สมัครสอบตำแหน่งอื่นในรอบนี้แล้ว',
'คุณได้สมัครสอบตำแหน่งอื่นในรอบนี้แล้ว'
'คุณได้สมัครสอบตำแหน่งอื่นในรอบนี้แล้ว',
closeWindow
)
} else {
if (store.consend == true) {
@ -136,6 +131,12 @@ const candidateCheck = async () => {
})
}
const closeWindow = async () => {
// window.close()
// window.closed = true
// console.log(window)
}
const fetchStep = async () => {
loader.value = true
await http
@ -147,8 +148,8 @@ const fetchStep = async () => {
stepRaw.value = 2
step.value = 2
} else if (data == 'checkRegister') {
stepRaw.value = 2
step.value = 2
stepRaw.value = 3
step.value = 3
} else if (data == 'payment') {
stepRaw.value = 3
step.value = 3
@ -156,8 +157,8 @@ const fetchStep = async () => {
stepRaw.value = 2
step.value = 2
} else if (data == 'checkPayment') {
stepRaw.value = 3
step.value = 3
stepRaw.value = 4
step.value = 4
} else if (data == 'rejectPayment') {
stepRaw.value = 3
step.value = 3
@ -171,10 +172,15 @@ const fetchStep = async () => {
stepRaw.value = 4
step.value = 4
}
if (stepPayment.value == false && data != 'register' && data != 'rejectRegister') {
stepRaw.value = 4
step.value = 4
}
})
.catch(() => {})
.finally(() => {
loader.value = false
store.changeStatus(status.value)
})
}
@ -185,7 +191,7 @@ const fetchPeriodExam = async () => {
.then((res) => {
const data = res.data.result
tittle.value = data.name
position.value = data.posiiton == null ? '' : '(' + data.posiiton.positionName + ')'
position.value = data.posiiton == null ? '' : 'ตำแหน่ง: ' + data.posiiton.positionName
})
.catch(() => {})
.finally(() => {