|
|
@ -28,6 +28,8 @@ export default { |
|
|
|
success: false, |
|
|
|
type: 0, // 0进 / 1出 |
|
|
|
timer: null, |
|
|
|
longitude: 37.80079, |
|
|
|
latitude: 112.58679, |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
@ -42,6 +44,7 @@ export default { |
|
|
|
onLoad(options) { |
|
|
|
console.log('options: ', options); |
|
|
|
this.init(options); |
|
|
|
this.getLocation(); |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
@ -82,13 +85,27 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取当前的地址位置 |
|
|
|
// 注意用国测局的数据 map只支持gcj02 |
|
|
|
getLocation() { |
|
|
|
uni.getLocation({ |
|
|
|
type: 'gcj02', |
|
|
|
success: res => { |
|
|
|
this.longitude = res.longitude; |
|
|
|
this.latitude = res.latitude; |
|
|
|
console.log('当前位置的经度:' + res.longitude); |
|
|
|
console.log('当前位置的纬度:' + res.latitude); |
|
|
|
}, |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* 扫码打卡 |
|
|
|
* @param {string} siteId 场所id |
|
|
|
*/ |
|
|
|
async handleSign(siteId) { |
|
|
|
try { |
|
|
|
const params = { param: { siteId } }; |
|
|
|
const params = { param: { siteId, locationLatitude: this.latitude, locationLongitude: this.longitude } }; |
|
|
|
await this.sign(params); |
|
|
|
this.success = true; |
|
|
|
} catch (error) { |
|
|
|