|
@@ -33,7 +33,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { clzConfirm } from '@/libs/tools.js'
|
|
|
+ import { clzConfirm,getGpsLocation } from '@/libs/tools.js'
|
|
|
import { findStoreList } from '@/api/store.js'
|
|
|
import { queryCurrentTaskUsing } from '@/api/task.js'
|
|
|
export default{
|
|
@@ -60,29 +60,11 @@
|
|
|
// 获取当前位置
|
|
|
getLocation(){
|
|
|
const _this = this
|
|
|
- uni.getLocation({
|
|
|
- type: 'gcj02',
|
|
|
- geocode: true,
|
|
|
- success: function (res) {
|
|
|
- console.log(res)
|
|
|
- _this.lng = res.longitude
|
|
|
- _this.lat = res.latitude
|
|
|
- _this.location = res.address.province + res.address.city + res.address.district + res.address.street + res.address.streetNum +'靠近' + res.address.poiName
|
|
|
- setTimeout(()=>{
|
|
|
- // 按照经纬度查询
|
|
|
- _this.searchHandle({lng:this.lng,lat:this.lat})
|
|
|
- }, 500)
|
|
|
- },
|
|
|
- fail: function(error){
|
|
|
- console.log(error)
|
|
|
- _this.searchHandle({})
|
|
|
- if(JSON.parse(error.errMsg.replace('getLocation:fail ','')).message){
|
|
|
- uni.showToast({
|
|
|
- icon: 'none',
|
|
|
- title: JSON.parse(error.errMsg.replace('getLocation:fail ','')).message
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+ getGpsLocation(function(gps){
|
|
|
+ console.log(gps)
|
|
|
+ // _this.location
|
|
|
+ // 按照经纬度查询
|
|
|
+ _this.searchHandle({lng:gps[0],lat:gps[1]})
|
|
|
})
|
|
|
},
|
|
|
// 按名称查询
|