fix:privacy
This commit is contained in:
parent
9793df1c57
commit
8b26530d52
6 changed files with 120 additions and 12 deletions
|
|
@ -7,6 +7,8 @@ import Camera from 'simple-vue-camera'
|
|||
import config from '@/app.config'
|
||||
import http from '@/plugins/http'
|
||||
import { useCounterMixin } from '@/stores/mixin'
|
||||
import { usePermissions } from '@/composables/usePermissions'
|
||||
import { usePrivacyStore } from '@/stores/privacy'
|
||||
|
||||
import type { FormRef, OptionReason } from '@/interface/response/checkin'
|
||||
|
||||
|
|
@ -15,6 +17,8 @@ import MapCheck from '@/components/AscGISMap.vue'
|
|||
const mixin = useCounterMixin()
|
||||
const { date2Thai, showLoader, hideLoader, messageError, dialogConfirm } = mixin
|
||||
const $q = useQuasar()
|
||||
const { checkCameraPermission, checkLocationPermission } = usePermissions()
|
||||
const privacyStore = usePrivacyStore()
|
||||
|
||||
const modalTime = ref<boolean>(false) // Dailog ลงเวลาเข้างานของคุณ
|
||||
const checkStatus = ref<string>('')
|
||||
|
|
@ -261,6 +265,12 @@ async function stopChecking() {
|
|||
|
||||
/** function เปิดกล้อง*/
|
||||
async function openCamera() {
|
||||
// เช็คสิทธิ์ privacy ก่อนเปิดกล้อง
|
||||
if (!checkCameraPermission()) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// change camera device
|
||||
if (cameraIsOn.value) {
|
||||
await camera.value?.stop()
|
||||
|
|
@ -336,6 +346,11 @@ const timeChickin = ref<string>('') //เวลาเข้างาน,เว
|
|||
|
||||
/** function ยืนยันการลงเวลาเข้า - ออก*/
|
||||
async function confirm() {
|
||||
// เช็คสิทธิ์ privacy ก่อนใช้งานแผนที่และกล้อง
|
||||
if (!checkLocationPermission() || !checkCameraPermission()) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!formLocation.POI || !formLocation.lat || !formLocation.lng) {
|
||||
mapRef.value?.requestLocationPermission()
|
||||
return
|
||||
|
|
@ -473,7 +488,11 @@ onMounted(async () => {
|
|||
isLoadingCheckTime.value = true
|
||||
updateClock()
|
||||
startChecking() //เช็ค status จาก คิว #1
|
||||
mapRef.value?.requestLocationPermission()
|
||||
|
||||
// เรียกแผนที่เฉพาะเมื่อยอมรับ privacy แล้ว
|
||||
if (privacyStore.isAccepted) {
|
||||
mapRef.value?.requestLocationPermission()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import config from '@/app.config'
|
|||
import avatar from '@/assets/avatar_user.jpg'
|
||||
import { logout, tokenParsed, getCookie } from '@/plugins/auth'
|
||||
import { useCounterMixin } from '@/stores/mixin'
|
||||
import { usePrivacyStore } from '@/stores/privacy'
|
||||
|
||||
import type { notiType } from '@/interface/index/Main'
|
||||
import type { Noti } from '@/interface/response/Main'
|
||||
|
|
@ -16,6 +17,7 @@ import DialogHeader from '@/components/DialogHeader.vue'
|
|||
import PopupPrivacy from '@/components/PopupPrivacy.vue'
|
||||
|
||||
const mixin = useCounterMixin()
|
||||
const privacyStore = usePrivacyStore()
|
||||
const {
|
||||
date2Thai,
|
||||
hideLoader,
|
||||
|
|
@ -56,8 +58,6 @@ const isPwdOld = ref<boolean>(true)
|
|||
const isPwdNewOld = ref<boolean>(true)
|
||||
const isPwdReNewOld = ref<boolean>(true)
|
||||
|
||||
const modalPrivacy = ref<boolean>(false)
|
||||
|
||||
/**
|
||||
* ฟังก์ชั่นดึงข้อมูลจำนวนการแจ้งเตือน
|
||||
*/
|
||||
|
|
@ -173,7 +173,7 @@ async function fetchKeycloakPosition() {
|
|||
.get(config.API.keycloakPosition())
|
||||
.then(async (res) => {
|
||||
const data = await res.data.result
|
||||
modalPrivacy.value = !data.privacyCheckin ? true : false
|
||||
privacyStore.modalPrivacy = !data.privacyCheckin ? true : false
|
||||
//เช็คว่ามีรูปไหม ถ้ามีรูปเรียกข้อมูลรูป
|
||||
if (data.avatarName) {
|
||||
await getImg(data.profileId, data.avatarName)
|
||||
|
|
@ -606,7 +606,7 @@ onMounted(async () => {
|
|||
</q-card>
|
||||
</q-dialog>
|
||||
|
||||
<popup-privacy v-model:modal="modalPrivacy" />
|
||||
<popup-privacy v-model:modal="privacyStore.modalPrivacy" />
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue