From 50b9ed9d35e0d967bc7334c0cbc15b271b6d2856 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Wed, 21 Jan 2026 16:23:25 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B8=9B=E0=B8=B8=E0=B9=88=E0=B8=A1=E0=B9=84=E0=B8=9B=E0=B8=AB?= =?UTF-8?q?=E0=B8=99=E0=B9=89=E0=B8=B2=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=A5?= =?UTF-8?q?=E0=B8=B2=20=E0=B9=81=E0=B8=A5=E0=B8=B0=E0=B9=81=E0=B8=81?= =?UTF-8?q?=E0=B9=89=E0=B9=84=E0=B8=82=20disbled=20=E0=B8=9B=E0=B8=B8?= =?UTF-8?q?=E0=B9=88=E0=B8=A1=E0=B8=A5=E0=B8=87=E0=B9=80=E0=B8=A7=E0=B8=A5?= =?UTF-8?q?=E0=B8=B2=E0=B8=AB=E0=B8=A5=E0=B8=B1=E0=B8=87=E0=B8=88=E0=B8=B2?= =?UTF-8?q?=E0=B8=81=E0=B8=84=E0=B8=A5=E0=B8=B4=E0=B8=81=E0=B8=A5=E0=B8=87?= =?UTF-8?q?=E0=B9=80=E0=B8=A7=E0=B8=A5=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.production | 3 ++- docker/entrypoint.sh | 1 + src/plugins/auth.ts | 14 ++++++++++++-- src/views/HomeView.vue | 8 ++++++-- src/views/MainView.vue | 18 ++++++++++++++++-- 5 files changed, 37 insertions(+), 7 deletions(-) diff --git a/.env.production b/.env.production index 065bcc6..71ad4b3 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,4 @@ VITE_API_URI_CONFIG=VITE_API_URI_CONFIG VITE_URL_SSO=VITE_URL_SSO -VITE_URL_LANDING=VITE_URL_LANDING \ No newline at end of file +VITE_URL_LANDING=VITE_URL_LANDING +VITE_URL_USER=VITE_URL_USER \ No newline at end of file diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 34dd4e2..aacd544 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -11,6 +11,7 @@ do sed -i 's|VITE_API_URI_CONFIG|'${VITE_API_URI_CONFIG}'|g' $file sed -i 's|VITE_URL_SSO|'${VITE_URL_SSO}'|g' $file sed -i 's|VITE_URL_LANDING|'${VITE_URL_LANDING}'|g' $file + sed -i 's|VITE_URL_USER|'${VITE_URL_USER}'|g' $file done diff --git a/src/plugins/auth.ts b/src/plugins/auth.ts index 0c171ea..0594dd4 100644 --- a/src/plugins/auth.ts +++ b/src/plugins/auth.ts @@ -2,7 +2,8 @@ import router from '@/router' const ACCESS_TOKEN = 'BMAHRISCKI_KEYCLOAK_IDENTITY' const key_C_Config = { - url_Logout: import.meta.env.VITE_URL_SSO, + urlLogout: import.meta.env.VITE_URL_SSO, + urlUser: import.meta.env.VITE_URL_USER, } interface AuthResponse { @@ -31,7 +32,7 @@ async function setCookieSso(val: string, r: AuthResponse) { async function logout() { await deleteCookie(ACCESS_TOKEN) - // window.location.href = key_C_Config.url_Logout + // window.location.href = key_C_Config.urlLogout router.push('/login') } @@ -97,6 +98,14 @@ async function tokenParsed() { return JSON.parse(jsonPayload) } +async function gotoLeavePage() { + const token = await getToken() + if (!token) { + return + } + window.location.href = `${key_C_Config.urlUser}/auth?token=${token}&accessToken=${token}&redirectUrl=${key_C_Config.urlUser}/leave` +} + export { getCookie, getToken, @@ -105,4 +114,5 @@ export { setAuthen, tokenParsed, setAuthenCheckin, + gotoLeavePage, } diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue index ae79034..b24ed63 100644 --- a/src/views/HomeView.vue +++ b/src/views/HomeView.vue @@ -31,6 +31,7 @@ const isErr = ref(null) // ข้อความแจ้งเ const endTimeAfternoon = ref('12:00:00') //เวลาเช็คเอาท์ตามรอบ const isLoadingCheckTime = ref(false) // ตัวแปรสำหรับการโหลด +const disabledBtn = ref(false) /** * fetch เช็คเวลาต้องลงเวลาเข้าหรือออกงาน @@ -354,6 +355,7 @@ async function confirm() { mapRef.value?.requestLocationPermission() return } + disabledBtn.value = true showLoader() const isLocation = workplace.value === 'in-place' //*true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง const locationName = workplace.value === 'in-place' ? '' : useLocation.value @@ -383,9 +385,11 @@ async function confirm() { timeChickin.value = timeString modalTime.value = true remark.value = '' + disabledBtn.value = false }) .catch((err) => { messageError($q, err) + disabledBtn.value = false }) .finally(() => { hideLoader() @@ -889,7 +893,7 @@ watch( push size="18px" :class="$q.screen.gt.xs ? 'q-px-md' : 'full-width q-pa-sm'" - :disable="camera && img ? false : true" + :disable="disabledBtn ? true : camera && img ? false : true" @click="validateForm" :loading="inQueue" /> @@ -1004,7 +1008,7 @@ watch( push size="18px" :class="$q.screen.gt.xs ? 'q-px-md' : 'full-width q-pa-sm'" - :disable="camera && img ? false : true" + :disable="disabledBtn ? true : camera && img ? false : true" @click="validateForm" :loading="inQueue" /> diff --git a/src/views/MainView.vue b/src/views/MainView.vue index 06cafd0..bb7932e 100644 --- a/src/views/MainView.vue +++ b/src/views/MainView.vue @@ -6,7 +6,7 @@ import { useRouter } from 'vue-router' import http from '@/plugins/http' import config from '@/app.config' import avatar from '@/assets/avatar_user.jpg' -import { logout, tokenParsed, getCookie } from '@/plugins/auth' +import { logout, tokenParsed, getCookie, gotoLeavePage } from '@/plugins/auth' import { useCounterMixin } from '@/stores/mixin' import { usePrivacyStore } from '@/stores/privacy' @@ -324,6 +324,18 @@ onMounted(async () => { + + ไปหน้าการลา + { flat color="white" @click="router.push('/history')" - /> + > + ไปหน้าประวัติการลงเวลาฯ +