|
|
@ -16,14 +16,14 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="map"> |
|
|
|
<map style="width: 100%; height: 100%" :latitude="latitude" :longitude="longitude" :markers="covers"> |
|
|
|
<map style="width: 100%; height: 100%" :latitude="latitude" :longitude="longitude" :markers="covers" :scale="18"> |
|
|
|
</map> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 打卡按钮 --> |
|
|
|
<view class="punch-card"> |
|
|
|
<view class="circle"> |
|
|
|
<view @click="callCard" class="circle"> |
|
|
|
<view class="title">拍照打卡</view> |
|
|
|
<view class="time">2021-10-10 10:00:00</view> |
|
|
|
</view> |
|
|
@ -91,18 +91,73 @@ |
|
|
|
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', |
|
|
|
<<<<<<< HEAD |
|
|
|
width: 30, |
|
|
|
height: 30 |
|
|
|
======= |
|
|
|
width : 38, |
|
|
|
height : 30, |
|
|
|
>>>>>>> 260f70e59eebfa09281d5d57173337efd210e7dc |
|
|
|
}) |
|
|
|
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" |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|