|
|
@@ -82,8 +82,6 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-var QQMapWX = require('../util/qqmap-wx-jssdk1.1/qqmap-wx-jssdk')
|
|
|
-var qqmapsdk
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -128,17 +126,14 @@ export default {
|
|
|
// 是否需要拍摄场景照片
|
|
|
takePicture: true,
|
|
|
// 刷新定位定时器
|
|
|
- timer2: null
|
|
|
+ timer2: null,
|
|
|
+ // 密匙
|
|
|
+ key: 'a9757735c230c231ea1c61c02c80dac1'
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
|
// 获取用户的个人信息数据
|
|
|
this.getUserInfo()
|
|
|
- // 实例化API核心类
|
|
|
- qqmapsdk = new QQMapWX({
|
|
|
- // 申请的key
|
|
|
- key: 'X57BZ-ZISE3-KTN3O-3P45H-C3J7Q-D5B67'
|
|
|
- })
|
|
|
// 获取当前系统时间
|
|
|
this.getNowTime()
|
|
|
},
|
|
|
@@ -161,10 +156,6 @@ export default {
|
|
|
onPullDownRefresh() {
|
|
|
uni.removeStorageSync('manager')
|
|
|
uni.removeStorageSync('sub-administrator')
|
|
|
- qqmapsdk = new QQMapWX({
|
|
|
- // 申请的key
|
|
|
- key: 'X57BZ-ZISE3-KTN3O-3P45H-C3J7Q-D5B67'
|
|
|
- })
|
|
|
if (this.timer2) {
|
|
|
clearInterval(this.timer2)
|
|
|
}
|
|
|
@@ -286,30 +277,28 @@ export default {
|
|
|
title: '定位中,请稍后',
|
|
|
mask: true
|
|
|
})
|
|
|
- qqmapsdk.reverseGeocoder({
|
|
|
+
|
|
|
+ // 获取经纬度
|
|
|
+ uni.getLocation({
|
|
|
+ type: 'gcj02',
|
|
|
success: (res) => {
|
|
|
- // console.log(res);
|
|
|
- if (res.status == 0) {
|
|
|
- // 获取详细地址信息 经纬度
|
|
|
- this.address = res.result.address
|
|
|
- this.myLat = res.result.location.lat
|
|
|
- this.myLng = res.result.location.lng
|
|
|
- // 获取当天的打卡列表数组
|
|
|
- this.getRulesList()
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: '请求定位失败',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- fail: (error) => {
|
|
|
- uni.getLocation({
|
|
|
- type: 'gcj02',
|
|
|
+ // console.log('当前位置的经度:' + res.longitude)
|
|
|
+ // console.log('当前位置的纬度:' + res.latitude)
|
|
|
+ this.myLat = res.latitude
|
|
|
+ this.myLng = res.longitude
|
|
|
+
|
|
|
+ // 获取详细地址
|
|
|
+ uni.request({
|
|
|
+ url: `https://api.tianditu.gov.cn/geocoder?postStr={'lon':${res.longitude},'lat':${res.latitude},'ver':1}&type=geocode&tk=${this.key}`,
|
|
|
success: (res) => {
|
|
|
- this.myLat = res.latitude
|
|
|
- this.myLng = res.longitude
|
|
|
+ // console.log(res)
|
|
|
+ this.address = res.data.result.formatted_address
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
this.address = '未知地址'
|
|
|
+ },
|
|
|
+ complete: () => {
|
|
|
+ // 获取当天的打卡列表数组
|
|
|
this.getRulesList()
|
|
|
}
|
|
|
})
|
|
|
@@ -388,30 +377,25 @@ export default {
|
|
|
if (this.timer2) {
|
|
|
clearInterval(this.timer2)
|
|
|
}
|
|
|
+
|
|
|
this.timer2 = setInterval(() => {
|
|
|
- qqmapsdk.reverseGeocoder({
|
|
|
+ uni.getLocation({
|
|
|
+ type: 'gcj02',
|
|
|
success: (res) => {
|
|
|
- if (res.status == 0) {
|
|
|
- // 获取详细地址信息 经纬度
|
|
|
- this.address = res.result.address
|
|
|
- this.myLat = res.result.location.lat
|
|
|
- this.myLng = res.result.location.lng
|
|
|
- this.getTimestamp()
|
|
|
- this.changeType()
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: '请求定位失败',
|
|
|
- icon: 'none'
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- fail: (error) => {
|
|
|
- uni.getLocation({
|
|
|
- type: 'gcj02',
|
|
|
+ this.myLat = res.latitude
|
|
|
+ this.myLng = res.longitude
|
|
|
+
|
|
|
+ // 获取详细地址
|
|
|
+ uni.request({
|
|
|
+ url: `https://api.tianditu.gov.cn/geocoder?postStr={'lon':${res.longitude},'lat':${res.latitude},'ver':1}&type=geocode&tk=${this.key}`,
|
|
|
success: (res) => {
|
|
|
- this.myLat = res.latitude
|
|
|
- this.myLng = res.longitude
|
|
|
+ // console.log(res)
|
|
|
+ this.address = res.data.result.formatted_address
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
this.address = '未知地址'
|
|
|
+ },
|
|
|
+ complete: () => {
|
|
|
this.getTimestamp()
|
|
|
this.changeType()
|
|
|
}
|