diff --git a/manifest.json b/manifest.json index e2ab7d7..dc46cab 100644 --- a/manifest.json +++ b/manifest.json @@ -52,7 +52,7 @@ "quickapp" : {}, /* 小程序特有相关 */ "mp-weixin" : { - "appid" : "wxe7ae8cbe1673834c", + "appid" : "wxf7152f59d366236b", "setting" : { "urlCheck" : false }, diff --git a/pages.json b/pages.json index 98e4d68..415aabb 100644 --- a/pages.json +++ b/pages.json @@ -33,6 +33,13 @@ { "navigationBarTitleText" : "" } + }, + { + "path" : "pages/human/human", + "style" : + { + "navigationBarTitleText" : "" + } } ], // "preloadRule": { diff --git a/pages/human/human.vue b/pages/human/human.vue new file mode 100644 index 0000000..ccc3876 --- /dev/null +++ b/pages/human/human.vue @@ -0,0 +1,149 @@ + + + + + + \ No newline at end of file diff --git a/pages/index/index.vue b/pages/index/index.vue index 5e57b8f..c511c5e 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -16,14 +16,14 @@ - + - + 拍照打卡 2021-10-10 10:00:00 @@ -93,18 +93,68 @@ self.longitude = res.longitude; self.latitude = res.latitude; self.covers.push({ - id : 1, + id: 1, latitude: res.latitude, longitude: res.longitude, iconPath: '/static/image/home/location.png', - width : 30, - height : 30 + width: 30, + height: 30 }) - console.log('当前位置的经度:' + res.longitude); - console.log('当前位置的纬度:' + res.latitude); + }, + fail() { + self.checkAndRequestLocationPermission() } }); + }, + + checkAndRequestLocationPermission() { + let self = this; + uni.getSetting({ + success: function(res) { + if (!res.authSetting['scope.userLocation']) { + // 用户未授权定位权限 + uni.showModal({ + title: '提示', + content: '当前定位未开启,请点击确定手动开启定位', + success: function(modalRes) { + if (modalRes.confirm) { + // 用户选择确认开启定位 + uni.openSetting({ + success: function(settingRes) { + if (settingRes.authSetting[ + 'scope.userLocation']) { + // 重新获取位置信息 + self.getLocation(); + } else { + // 用户未开启定位权限 + console.log('用户未开启定位权限'); + } + }, + fail: function(err) { + console.log('打开设置页面失败:', err); + } + }); + } else { + // 用户选择取消 + self.getLocation() + } + } + }); + } else { + // 用户已授权定位权限但获取位置失败(可能是设备未开启定位服务) + console.log('用户已授权定位权限,但获取位置失败'); + // 可以提示用户检查设备定位服务是否开启 + } + } + }); + }, + + //打卡(跳转人脸识别) + callCard(){ + uni.navigateTo({ + url: "/pages/human/human" + }) } } } diff --git a/static/image/human/icon1.png b/static/image/human/icon1.png new file mode 100644 index 0000000..f7c0bda Binary files /dev/null and b/static/image/human/icon1.png differ diff --git a/static/image/human/icon2.png b/static/image/human/icon2.png new file mode 100644 index 0000000..253691b Binary files /dev/null and b/static/image/human/icon2.png differ diff --git a/static/image/human/icon3.png b/static/image/human/icon3.png new file mode 100644 index 0000000..97e728f Binary files /dev/null and b/static/image/human/icon3.png differ diff --git a/static/image/human/img.png b/static/image/human/img.png new file mode 100644 index 0000000..c7f2138 Binary files /dev/null and b/static/image/human/img.png differ