ต่อ Api หน้ Address
This commit is contained in:
parent
79182a1e86
commit
8d2b93b6a3
4 changed files with 48 additions and 26 deletions
|
|
@ -2,6 +2,7 @@ import env from '../index'
|
|||
const candidate = `${env.API_URI}/candidate/`
|
||||
|
||||
export default {
|
||||
countDashbordSubHistory: (examId: string) => `${candidate}information/${examId}`,
|
||||
candidateInformation: (examId: string) => `${candidate}information/${examId}`,
|
||||
candidateAddress: (examId: string) => `${candidate}address/${examId}`,
|
||||
candidate
|
||||
}
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ import { useExamDataStore } from '@/modules/01_exam/store'
|
|||
const mixin = useCounterMixin()
|
||||
const store = useExamDataStore()
|
||||
const { date2Thai, calAge } = mixin
|
||||
|
||||
const candidateId = ref<string>('2223ba53-2fb2-470b-8dc1-27e5471b0331')
|
||||
const edit = ref<boolean>(false)
|
||||
const addressData = ref<Address>(defaultAddress)
|
||||
const myform = ref<any>()
|
||||
|
|
@ -272,11 +272,32 @@ const props = defineProps({
|
|||
|
||||
const emit = defineEmits(['update:statusEdit'])
|
||||
|
||||
onMounted(() => {
|
||||
fetchProvince()
|
||||
fetchDistrict(addressData.value.provinceId, '1')
|
||||
fetchDistrict(addressData.value.provinceIdC, '2')
|
||||
onMounted(async () => {
|
||||
await fetchData()
|
||||
await fetchProvince()
|
||||
await fetchDistrict(addressData.value.provinceId, '1')
|
||||
await fetchDistrict(addressData.value.provinceIdC, '2')
|
||||
})
|
||||
const fetchData = async () => {
|
||||
await http
|
||||
.get(config.API.candidateAddress(candidateId.value))
|
||||
.then((res) => {
|
||||
const data = res.data.result
|
||||
addressData.value.provinceId = data.registProvinceId
|
||||
addressData.value.provinceIdC = data.currentProvinceId
|
||||
addressData.value.districtId = data.registDistrictId
|
||||
addressData.value.districtIdC = data.currentDistrictId
|
||||
addressData.value.subdistrictId = data.registSubDistrictId
|
||||
addressData.value.subdistrictIdC = data.currentSubDistrictId
|
||||
addressData.value.code = data.registZipCode
|
||||
addressData.value.codeC = data.currentZipCode
|
||||
// informaData.value = data
|
||||
})
|
||||
.catch((e: any) => {})
|
||||
.finally(() => {
|
||||
// loader.value = false;
|
||||
})
|
||||
}
|
||||
|
||||
const saveData = async () => {
|
||||
if (store.consend == true) {
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ onMounted(async () => {
|
|||
})
|
||||
const fetchData = async () => {
|
||||
await http
|
||||
.get(config.API.countDashbordSubHistory(candidateId.value))
|
||||
.get(config.API.candidateInformation(candidateId.value))
|
||||
.then((res) => {
|
||||
const data = res.data.result
|
||||
informaData.value.prefix = data.prefixId
|
||||
|
|
|
|||
|
|
@ -216,25 +216,25 @@ const defaultAddress: Address = {
|
|||
}
|
||||
|
||||
const defaultInformation: Information = {
|
||||
cardid: '10238002345325',
|
||||
prefix: 'นางสาว',
|
||||
prefixId: 'นางสาว',
|
||||
firstname: 'ณัฐกา',
|
||||
lastname: 'ชมสิน',
|
||||
birthDate: new Date('2002-01-01'),
|
||||
genderId: 'หญิง',
|
||||
bloodId: 'O',
|
||||
nationality: 'ไทย',
|
||||
ethnicity: 'ไทย',
|
||||
religionId: 'พุทธ',
|
||||
tel: '0914569982',
|
||||
phone: '0914569982',
|
||||
email: 'kittapath@frappet.com',
|
||||
province: 'กรุงเทพ',
|
||||
cardIdDate: new Date('2000-01-10'),
|
||||
relationship: 'โสด',
|
||||
knowledge: 'excel, word, photoshop',
|
||||
district: 'บางพลัด'
|
||||
cardid: '',
|
||||
prefix: '',
|
||||
prefixId: '',
|
||||
firstname: '',
|
||||
lastname: '',
|
||||
birthDate: new Date(''),
|
||||
genderId: '',
|
||||
bloodId: '',
|
||||
nationality: '',
|
||||
ethnicity: '',
|
||||
religionId: '',
|
||||
tel: '',
|
||||
phone: '',
|
||||
email: '',
|
||||
province: '',
|
||||
cardIdDate: new Date(''),
|
||||
relationship: '',
|
||||
knowledge: '',
|
||||
districtId: ''
|
||||
}
|
||||
|
||||
const defaultFamily: Family = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue