|
@@ -95,11 +95,11 @@
|
|
|
<script>
|
|
|
//#ifdef APP-PLUS
|
|
|
// var ALog = uni.requireNativePlugin("AndroidLog")
|
|
|
- var location = uni.requireNativePlugin("Location")
|
|
|
+ // var location = uni.requireNativePlugin("Location")
|
|
|
//#endif
|
|
|
- //#ifdef H5
|
|
|
+
|
|
|
import distance from "utils/getDistance.js"
|
|
|
- //#endif
|
|
|
+
|
|
|
export default{
|
|
|
data(){
|
|
|
return{
|
|
@@ -155,23 +155,33 @@
|
|
|
uni.getLocation({
|
|
|
type:"gcj02",
|
|
|
success : function (res) {
|
|
|
+ // console.log('定位',res)
|
|
|
uni.hideLoading();
|
|
|
//#ifdef APP-PLUS
|
|
|
- var dst = `${that.payeeinfo.latitude},${that.payeeinfo.longitude}`;
|
|
|
- var src = res.latitude + ',' + res.longitude;
|
|
|
- var locRet = location?.distance?.(src, dst);
|
|
|
+ // var dst = `${that.payeeinfo.latitude},${that.payeeinfo.longitude}`;
|
|
|
+ // var src = res.latitude + ',' + res.longitude;
|
|
|
+ // var locRet = location?.distance?.(src, dst);
|
|
|
that.positionInfo = true;
|
|
|
- that.punchDistance = locRet.distance;
|
|
|
+ // that.punchDistance = locRet.distance;
|
|
|
that.punchRange = that.payeeinfo.workDistance;
|
|
|
- if(locRet.distance <= that.payeeinfo.workDistance){//在打卡范围内
|
|
|
+ // console.log('res.latitude',res.latitude)
|
|
|
+ // console.log('res.longitude',res.longitude)
|
|
|
+ let myDistance = distance(res.latitude,res.longitude,that.payeeinfo.latitude,that.payeeinfo.longitude);
|
|
|
+ // console.log('myDistance',myDistance)
|
|
|
+ // console.log('workDistance',that.payeeinfo.workDistance)
|
|
|
+ that.punchDistance = myDistance;
|
|
|
+ if(myDistance <= that.payeeinfo.workDistance){//在打卡范围内
|
|
|
//#endif
|
|
|
//#ifdef H5
|
|
|
+ console.log('走H5')
|
|
|
that.positionInfo = true;
|
|
|
let myDistance = distance(res.latitude,res.longitude,that.payeeinfo.latitude,that.payeeinfo.longitude);
|
|
|
that.punchDistance = myDistance;
|
|
|
that.punchRange = that.payeeinfo.workDistance;
|
|
|
// console.log('res.latitude',res.latitude)
|
|
|
// console.log('res.longitude',res.longitude)
|
|
|
+ // console.log('myDistance',myDistance)
|
|
|
+ // console.log('workDistance',that.payeeinfo.workDistance)
|
|
|
// console.log('that.payeeinfo.latitude',that.payeeinfo.latitude)
|
|
|
if(myDistance <= that.payeeinfo.workDistance){//在打卡范围内
|
|
|
//#endif
|