อัพโหลดคะแนนภาค ข ค

This commit is contained in:
Kittapath 2023-04-25 03:45:41 +07:00
parent 9b9432f779
commit b768d7e754
5 changed files with 118 additions and 27 deletions

View file

@ -76,7 +76,14 @@
<div class="absolute-bottom text-center">หลกฐานชำระเง</div>
</q-img>
</label>
<q-file
<input
id="file-upload"
type="file"
v-if="status == 'payment' || status == 'rejectPayment'"
accept="image/*"
@change="uploadImage"
/>
<!-- <q-file
id="file-upload"
v-model="filePayment"
dense
@ -90,7 +97,7 @@
<template v-slot:prepend>
<q-icon name="attach_file" />
</template>
</q-file>
</q-file> -->
</div>
</div>
</div>
@ -292,12 +299,12 @@ const fetchData = async () => {
}
const clickPayment = async () => {
if (filePayment.value.length > 0) {
if (img.value != null || img.value != '') {
const formData = new FormData()
formData.append('', filePayment.value[0])
loader.value = true
await http
.put(config.API.candidatePayment(examId.value, positionId.value), formData)
.post(config.API.candidatePayment(examId.value, positionId.value))
.then(() => {
success($q, 'ส่งหลักฐานชำระเงินสำเร็จ')
})
@ -308,12 +315,31 @@ const clickPayment = async () => {
filePayment.value = []
})
} else {
modalError($q, 'ไม่สามารถอัพโหลดไฟล์ได้', 'กรุณาเลือกไฟล์ที่ต้องการอัพโหลด')
modalError($q, 'ไม่สามารถยืนยันการชำระเงินได้', 'กรุณาอัปโหลดเอกสารหลักฐานชำระเงิน')
}
}
const uploadImage = async (e: any) => {
filePayment.value = e
const uploadImage = async (file: any) => {
let input = file.target.files
if (input.length > 0) {
const formData = new FormData()
formData.append('', input[0])
loader.value = true
await http
.put(config.API.candidatePayment(examId.value, positionId.value), formData)
.then(() => {
success($q, 'ส่งหลักฐานชำระเงินสำเร็จ')
})
.catch(() => {})
.finally(async () => {
loader.value = false
props.fetchStep()
await fetchData()
file = []
})
} else {
modalError($q, 'ไม่สามารถอัพโหลดไฟล์ได้', 'กรุณาเลือกไฟล์ที่ต้องการอัพโหลด')
}
}
const downloadBillPayment = () => {