diff --git a/src/api/exam/api.candidate.ts b/src/api/exam/api.candidate.ts index 461878a..018db96 100644 --- a/src/api/exam/api.candidate.ts +++ b/src/api/exam/api.candidate.ts @@ -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 } diff --git a/src/modules/01_exam/components/Form/Profile/Address.vue b/src/modules/01_exam/components/Form/Profile/Address.vue index 0966df4..c4edf93 100644 --- a/src/modules/01_exam/components/Form/Profile/Address.vue +++ b/src/modules/01_exam/components/Form/Profile/Address.vue @@ -241,7 +241,7 @@ import { useExamDataStore } from '@/modules/01_exam/store' const mixin = useCounterMixin() const store = useExamDataStore() const { date2Thai, calAge } = mixin - +const candidateId = ref('2223ba53-2fb2-470b-8dc1-27e5471b0331') const edit = ref(false) const addressData = ref
(defaultAddress) const myform = ref() @@ -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) { diff --git a/src/modules/01_exam/components/Form/Profile/Information.vue b/src/modules/01_exam/components/Form/Profile/Information.vue index aa46643..fd90ed1 100644 --- a/src/modules/01_exam/components/Form/Profile/Information.vue +++ b/src/modules/01_exam/components/Form/Profile/Information.vue @@ -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 diff --git a/src/modules/01_exam/interface/index/Main.ts b/src/modules/01_exam/interface/index/Main.ts index 324ff22..68f8b3e 100644 --- a/src/modules/01_exam/interface/index/Main.ts +++ b/src/modules/01_exam/interface/index/Main.ts @@ -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 = {