heikabujianai vor 5 Jahren
Ursprung
Commit
44a063bcab
4 geänderte Dateien mit 48 neuen und 8 gelöschten Zeilen
  1. 34 6
      pages/clock/clock.js
  2. 3 1
      pages/clock/clock.json
  3. 5 1
      pages/clock/clock.wxml
  4. 6 0
      pages/clock/clock.wxss

+ 34 - 6
pages/clock/clock.js

@@ -17,6 +17,7 @@ Page({
   data: {
     approveStatus: false,
     showCover: true,
+    settingVisible: false,
     imgServerUrl,
     navigation: [
       {
@@ -41,7 +42,26 @@ Page({
     todayMoney: 0,
     sumDuration: 0,
     sumMoney: 0,
-    wsPunchClockId: ''
+    wsPunchClockId: '',
+    actions: [
+      {
+        name: '取消',
+        color: '#007AFF'
+      },
+      {
+        name: '确认',
+        color: '#007AFF',
+        fontWeight: 600
+      }
+    ]
+  },
+  closeSettingVisible(data) {
+    const { index } = data.detail;
+    if (index === 0) {
+      this.setData({
+        settingVisible: false
+      })
+    }
   },
   toRule() {
     wx.navigateTo({
@@ -70,10 +90,15 @@ Page({
             const info = wx.getSystemInfoSync()
             if (data.errMsg.indexOf('system permission denied') !== -1 || info.locationEnabled === false) {
               wx.showModal({
-                content: '无法使用打卡功能',
-                title: '微信未开启系统定位功能',
+                content: '请授权微信获取位置信息权限',
+                title: '微信未能获取位置信息',
                 showCancel: false,
+                confirmColor: '#007AFF',
+                confirmText: '确认',
               })
+              // this.setData({
+              //   settingVisible: true
+              // })
               reject()
             } else {
               console.log(data)
@@ -87,9 +112,12 @@ Page({
               },
               fail: () => {
                 wx.showModal({
-                  content: '无法使用打卡功能',
-                  confirmText: '去授权',
-                  title: '位置信息未授权',
+                  content: '',
+                  // confirmText: '去授权',
+                  title: '请前往设置打开用户定位权限',
+                  confirmColor: '#007AFF',
+                  cancelColor: '#007AFF',
+                  confirmText: '确认',
                   success: (result) => {
                     if (result.confirm) {
                       wx.openSetting({})

+ 3 - 1
pages/clock/clock.json

@@ -1,4 +1,6 @@
 {
   "enablePullDownRefresh": true,
-  "usingComponents": {}
+  "usingComponents": {
+    "modal":"../../ui/modal/index"
+  }
 }

+ 5 - 1
pages/clock/clock.wxml

@@ -125,4 +125,8 @@
       <text>一键拨号</text>
     </view>
   </view>
-</view>
+</view>
+
+<modal visible='{{settingVisible}}' actions='{{actions}}' bind:click='closeSettingVisible'>
+  <view class="settingVisible">请前往设置打开用户定位权限</view>
+</modal>

+ 6 - 0
pages/clock/clock.wxss

@@ -384,4 +384,10 @@ page {
   width: 36rpx;
   height: 35rpx;
   margin-right: 20rpx;
+}
+
+.settingVisible{
+  color: #000;
+  font-size: 34rpx;
+  font-weight: 600;
 }