fixing logo & banner recruiting

This commit is contained in:
Warunee Tamkoo 2024-08-09 17:34:37 +07:00
parent 84ae839226
commit 8f3e1b0973

View file

@ -1,7 +1,7 @@
<script setup lang="ts">
import type { QTableProps } from "quasar";
import { checkPermission } from "@/utils/permissions";
import { ref, onMounted } from "vue";
import { ref, onMounted, nextTick } from "vue";
import type {
WebType,
AddressWeb,
@ -398,9 +398,11 @@ const fetchData = async () => {
address.value.code = data.zipCode;
if (data.bannerImg) {
imageUrl.value = data.bannerImg.detail;
checkFileBanner();
}
if (data.logoImg) {
imageUrlLogo.value = data.logoImg.detail;
checkFileLogo();
}
address.value.provinceId = data.provinceId;
address.value.districtId = data.districtId;
@ -634,6 +636,26 @@ const clickImage = () => {
}
};
const checkLogoExits = ref<boolean>(false);
const checkFileLogo = async () => {
try {
const response = await fetch(imageUrlLogo.value, { method: "GET" });
checkLogoExits.value = response.ok;
} catch (error) {
checkLogoExits.value = false;
}
};
const checkBannerExits = ref<boolean>(false);
const checkFileBanner = async () => {
try {
const response = await fetch(imageUrl.value, { method: "GET" });
checkBannerExits.value = response.ok;
} catch (error) {
checkBannerExits.value = false;
}
};
const uploadImageLogo = (e: any) => {
let input = e.target.files;
if (input.length > 0) {
@ -667,6 +689,7 @@ const getClass = (val: boolean) => {
};
};
</script>
<template>
<div class="toptitle text-dark col-12 row items-center">
งคาเวบไซตระบบสรรหา
@ -691,7 +714,7 @@ const getClass = (val: boolean) => {
<q-img
class="rounded-borders"
:src="
imageUrlLogo !== null
imageUrlLogo !== null && checkLogoExits
? imageUrlLogo
: 'https://cdn.quasar.dev/img/image-src.png'
"
@ -727,7 +750,7 @@ const getClass = (val: boolean) => {
<q-img
class="rounded-borders full-width"
:src="
imageUrl !== null
imageUrl !== null && checkBannerExits
? imageUrl
: 'https://cdn.quasar.dev/img/image-src.png'
"