fix
This commit is contained in:
parent
8b26530d52
commit
112e6911ad
3 changed files with 50 additions and 34 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed, nextTick } from 'vue'
|
||||||
import { useQuasar } from 'quasar'
|
import { useQuasar } from 'quasar'
|
||||||
import http from '@/plugins/http'
|
import http from '@/plugins/http'
|
||||||
import config from '@/app.config'
|
import config from '@/app.config'
|
||||||
|
|
@ -53,6 +53,7 @@ const privacyContent = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const scrollContainer = ref<HTMLElement | null>(null)
|
||||||
const hasScrolledToBottom = ref(false)
|
const hasScrolledToBottom = ref(false)
|
||||||
const acceptPrivacy = ref(false)
|
const acceptPrivacy = ref(false)
|
||||||
const showDetails = ref(false)
|
const showDetails = ref(false)
|
||||||
|
|
@ -60,6 +61,7 @@ const isAcceptDisabled = computed(() => !acceptPrivacy.value)
|
||||||
|
|
||||||
const handleScroll = (event: Event) => {
|
const handleScroll = (event: Event) => {
|
||||||
const target = event.target as HTMLElement
|
const target = event.target as HTMLElement
|
||||||
|
|
||||||
if (!target) return
|
if (!target) return
|
||||||
|
|
||||||
const { scrollTop, scrollHeight, clientHeight } = target
|
const { scrollTop, scrollHeight, clientHeight } = target
|
||||||
|
|
@ -82,6 +84,20 @@ const handleAccept = async () => {
|
||||||
|
|
||||||
const toggleDetails = () => {
|
const toggleDetails = () => {
|
||||||
showDetails.value = !showDetails.value
|
showDetails.value = !showDetails.value
|
||||||
|
checkIfScrollable()
|
||||||
|
}
|
||||||
|
|
||||||
|
const checkIfScrollable = () => {
|
||||||
|
nextTick(() => {
|
||||||
|
const container = scrollContainer.value?.$el || scrollContainer.value
|
||||||
|
if (container) {
|
||||||
|
const { scrollHeight, clientHeight } = container
|
||||||
|
|
||||||
|
if (scrollHeight <= clientHeight + 20) {
|
||||||
|
hasScrolledToBottom.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,34 +5,35 @@ export function usePermissions() {
|
||||||
const $q = useQuasar()
|
const $q = useQuasar()
|
||||||
const privacyStore = usePrivacyStore()
|
const privacyStore = usePrivacyStore()
|
||||||
|
|
||||||
const checkCameraPermission = (): boolean => {
|
// const checkCameraPermission = (): boolean => {
|
||||||
if (!privacyStore.isAccepted) {
|
// if (!privacyStore.isAccepted) {
|
||||||
privacyStore.modalPrivacy = true
|
// privacyStore.modalPrivacy = true
|
||||||
$q.notify({
|
// $q.notify({
|
||||||
type: 'warning',
|
// type: 'warning',
|
||||||
message: 'กรุณายอมรับนโยบายคุ้มครองข้อมูลส่วนบุคคลก่อนใช้งานกล้อง',
|
// message: 'กรุณายอมรับนโยบายคุ้มครองข้อมูลส่วนบุคคลก่อนใช้งานกล้อง',
|
||||||
position: 'top',
|
// position: 'top',
|
||||||
})
|
// })
|
||||||
return false
|
// return false
|
||||||
}
|
// }
|
||||||
return true
|
// return true
|
||||||
}
|
// }
|
||||||
|
|
||||||
const checkLocationPermission = (): boolean => {
|
// const checkLocationPermission = (): boolean => {
|
||||||
if (!privacyStore.isAccepted) {
|
// if (!privacyStore.isAccepted) {
|
||||||
privacyStore.modalPrivacy = true
|
// privacyStore.modalPrivacy = true
|
||||||
$q.notify({
|
// $q.notify({
|
||||||
type: 'warning',
|
// type: 'warning',
|
||||||
message: 'กรุณายอมรับนโยบายคุ้มครองข้อมูลส่วนบุคคลก่อนใช้งานแผนที่',
|
// message: 'กรุณายอมรับนโยบายคุ้มครองข้อมูลส่วนบุคคลก่อนใช้งานแผนที่',
|
||||||
position: 'top',
|
// position: 'top',
|
||||||
})
|
// })
|
||||||
return false
|
// return false
|
||||||
}
|
// }
|
||||||
return true
|
// return true
|
||||||
}
|
// }
|
||||||
|
|
||||||
const checkPrivacyAccepted = (): boolean => {
|
const checkPrivacyAccepted = (): boolean => {
|
||||||
if (!privacyStore.isAccepted) {
|
if (!privacyStore.isAccepted) {
|
||||||
|
privacyStore.modalPrivacy = true
|
||||||
$q.notify({
|
$q.notify({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
message: 'กรุณายอมรับนโยบายคุ้มครองข้อมูลส่วนบุคคลก่อนใช้งาน',
|
message: 'กรุณายอมรับนโยบายคุ้มครองข้อมูลส่วนบุคคลก่อนใช้งาน',
|
||||||
|
|
@ -44,8 +45,8 @@ export function usePermissions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
checkCameraPermission,
|
// checkCameraPermission,
|
||||||
checkLocationPermission,
|
// checkLocationPermission,
|
||||||
checkPrivacyAccepted,
|
checkPrivacyAccepted,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import MapCheck from '@/components/AscGISMap.vue'
|
||||||
const mixin = useCounterMixin()
|
const mixin = useCounterMixin()
|
||||||
const { date2Thai, showLoader, hideLoader, messageError, dialogConfirm } = mixin
|
const { date2Thai, showLoader, hideLoader, messageError, dialogConfirm } = mixin
|
||||||
const $q = useQuasar()
|
const $q = useQuasar()
|
||||||
const { checkCameraPermission, checkLocationPermission } = usePermissions()
|
const { checkPrivacyAccepted } = usePermissions()
|
||||||
const privacyStore = usePrivacyStore()
|
const privacyStore = usePrivacyStore()
|
||||||
|
|
||||||
const modalTime = ref<boolean>(false) // Dailog ลงเวลาเข้างานของคุณ
|
const modalTime = ref<boolean>(false) // Dailog ลงเวลาเข้างานของคุณ
|
||||||
|
|
@ -266,8 +266,7 @@ async function stopChecking() {
|
||||||
/** function เปิดกล้อง*/
|
/** function เปิดกล้อง*/
|
||||||
async function openCamera() {
|
async function openCamera() {
|
||||||
// เช็คสิทธิ์ privacy ก่อนเปิดกล้อง
|
// เช็คสิทธิ์ privacy ก่อนเปิดกล้อง
|
||||||
if (!checkCameraPermission()) {
|
if (!checkPrivacyAccepted()) {
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -347,7 +346,7 @@ const timeChickin = ref<string>('') //เวลาเข้างาน,เว
|
||||||
/** function ยืนยันการลงเวลาเข้า - ออก*/
|
/** function ยืนยันการลงเวลาเข้า - ออก*/
|
||||||
async function confirm() {
|
async function confirm() {
|
||||||
// เช็คสิทธิ์ privacy ก่อนใช้งานแผนที่และกล้อง
|
// เช็คสิทธิ์ privacy ก่อนใช้งานแผนที่และกล้อง
|
||||||
if (!checkLocationPermission() || !checkCameraPermission()) {
|
if (!checkPrivacyAccepted()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue