Browse Source

签退打卡加锁

ymz 3 tuần trước cách đây
mục cha
commit
f142b7318f

+ 1 - 1
env/.env.development

@@ -8,5 +8,5 @@ NODE_ENV=development
 # 中生测试
 VITE_APP_URL=https://mic-t.cnbg.com.cn
 
-
+# VITE_APP_URL=https://cnbg.yaoyi.net
 

+ 54 - 42
src/pages-sub-task/location/index.vue

@@ -247,15 +247,23 @@ const checkSignInState = () => {
 }
 
 const act = ref(0)
+
+const getResult = ref(false)
 // 拜访对象滚动
-const visitScroll = (event: any) => {
+const visitScroll = async (event: any) => {
+  getResult.value = true
+  uni.showLoading({
+    mask: true,
+    title: '获取签到信息中'
+  })
   let curr = event.detail.value[0]
   act.value = curr
   // 设置当前选中的地方,重置markers
   curentDistance.value = locationList.value[curr]
 
-  getSignInfo()
+  await getSignInfo()
   setMarkers(curentDistance.value)
+  uni.hideLoading()
 }
 
 const getSignInfo = debounce(() => {
@@ -281,6 +289,7 @@ const getsignTempResult = async () => {
     notClockedIn.value = true
     signResultTime.value = ''
   }
+  getResult.value = false
   uni.hideLoading()
 }
 
@@ -327,49 +336,52 @@ onShow(async () => {
 const Lock = ref(false)
 // 签退去填写表单
 
-const toDetail = () => {
-  if (Lock.value) return
+const toDetail = debounce(() => {
+  setTimeout(() => {
+    if (getResult.value) return
 
-  uni.showLoading({
-    mask: true,
-    title: '加载中'
-  })
+    uni.showLoading({
+      mask: true,
+      title: '加载中'
+    })
 
-  Lock.value = true
-  let TIME: number = 10
-  // 签退时间
-  const signOutTime = dayjs(signResultTime.value)
-  // 获取当前时间
-  const currentTime = dayjs()
-
-  // 计算时间差是否超过15分钟
-
-  if (currentTime.diff(signOutTime, 'minute') > TIME) {
-    const data = {
-      address: curentDistance.value?.signEntName,
-      locationId: curentDistance.value?.signEntId,
-      signTime: signResultTime.value,
-      signEntType: curentDistance.value?.signEntType,
-      longitude: curentDistance.value?.longitude,
-      latitude: curentDistance.value?.latitude,
-      checkOutTime: dayjs().format('YYYY-MM-DD HH:mm:ss')
-    }
+    let TIME: number = 10
+    // 签退时间
 
-    useTaskStore.setSignAddressInfo(data)
-    uni.navigateTo({
-      url: `/pages-sub-task/task/index?value=${taskTypeId.value}&title=${title.value}`
-    })
-    uni.hideLoading()
-    setTimeout(() => {
-      Lock.value = false
-    }, 3000)
-  } else {
-    uni.showToast({
-      title: `签到和签退时间间隔不可少于${TIME}分钟。`,
-      icon: 'none'
-    })
-  }
-}
+    const signOutTime = dayjs(signResultTime.value)
+
+    // 获取当前时间
+    const currentTime = dayjs()
+
+    // 计算时间差是否超过15分钟
+
+    if (currentTime.diff(signOutTime, 'minute') > TIME) {
+      const data = {
+        address: curentDistance.value?.signEntName,
+        locationId: curentDistance.value?.signEntId,
+        signTime: signResultTime.value,
+        signEntType: curentDistance.value?.signEntType,
+        longitude: curentDistance.value?.longitude,
+        latitude: curentDistance.value?.latitude,
+        checkOutTime: dayjs().format('YYYY-MM-DD HH:mm:ss')
+      }
+
+      useTaskStore.setSignAddressInfo(data)
+      uni.navigateTo({
+        url: `/pages-sub-task/task/index?value=${taskTypeId.value}&title=${title.value}`
+      })
+      uni.hideLoading()
+      setTimeout(() => {
+        Lock.value = false
+      }, 3000)
+    } else {
+      uni.showToast({
+        title: `签到和签退时间间隔不可少于${TIME}分钟。`,
+        icon: 'none'
+      })
+    }
+  }, 1000)
+}, 500)
 
 // 卸载
 onUnmounted(() => {

+ 1 - 1
src/pages-sub-task/task/index.vue

@@ -337,7 +337,7 @@ const getTaskContentConfigByTaskTypeId = async () => {
       }
 
       // 日期禁止选择
-      const arr = ['14', '17', '53']
+      const arr = ['53']
       if (arr.includes(item.taskTypeId)) {
         item.disabled = true
       }