Pārlūkot izejas kodu

更新 优化定位提示

王智慧 3 gadi atpakaļ
vecāks
revīzija
c718392657
1 mainītis faili ar 16 papildinājumiem un 1 dzēšanām
  1. 16 1
      miniprogram/pages/takePhoto/takePhoto.js

+ 16 - 1
miniprogram/pages/takePhoto/takePhoto.js

@@ -19,7 +19,8 @@ Page({
     shipMmsi: "",
     authModal: false,
     modalText: "位置",
-    shipId: ''
+    shipId: '',
+    locked: false
   },
   openSetting() {
     this.setData({
@@ -49,6 +50,7 @@ Page({
     })
   },
   takeBill() {
+    if (this.data.locked) return
     wx.redirectTo({
       url: '/pages/takeBill/takeBill',
     })
@@ -110,6 +112,13 @@ Page({
     return true
   },
   async takePhoto(e) {
+    if (this.data.locked) {
+      wx.showLoading({
+        title: '高精度定位中...'
+      })
+      return
+    }
+    this.data.locked = true
     let {
       mediatype
     } = e.currentTarget.dataset
@@ -281,6 +290,12 @@ Page({
           authModal: true,
           modalText: "位置信息"
         })
+      },
+      complete: e => {
+        wx.hideLoading({
+          success: (res) => {},
+        })
+        this.data.locked = false
       }
     })