更新
This commit is contained in:
@@ -12,7 +12,7 @@ VUE_APP_UPLOAD_PRIVATE_URL = '/api/oil-dict/imageHandler/uploadProtectedImg'
|
||||
VUE_APP_DOMAIN = '192.168.0.150:38080'
|
||||
|
||||
# 开发环境,不会进行加密,会打印出数据
|
||||
VUE_APP_ENV = 'production'
|
||||
VUE_APP_ENV = 'development'
|
||||
#production
|
||||
|
||||
|
||||
|
||||
@@ -27,37 +27,20 @@ const instance = defineStore('user', {
|
||||
|
||||
actions: {
|
||||
getPosition() {
|
||||
this.position = { latitude: 36.636753, longitude: 119.11914 }
|
||||
|
||||
if (navigator?.geolocation?.getCurrentPosition) {
|
||||
console.log('存在原生定位')
|
||||
navigator.geolocation.getCurrentPosition(position => {
|
||||
console.log('原生定位', position)
|
||||
})
|
||||
} else {
|
||||
console.log('原生定位不可用')
|
||||
}
|
||||
|
||||
// return
|
||||
initAMap().then(() => {
|
||||
// console.log(3)
|
||||
let AMap = Vue.prototype.$AMap
|
||||
let geolocation = new AMap.Geolocation({
|
||||
// enableHighAccuracy: true // 是否使用高精度定位,默认:true
|
||||
})
|
||||
geolocation.getCurrentPosition(function (status, result) {
|
||||
console.log('geolocation.getCurrentPosition')
|
||||
console.log('status', status)
|
||||
console.log('result', result)
|
||||
// if (status === 'complete') {
|
||||
// let { lat: latitude, lng: longitude } = result.position
|
||||
// this.position = { latitude, longitude }
|
||||
// console.log('this.position', this.position)
|
||||
// }
|
||||
if (status === 'complete') {
|
||||
let { lat: latitude, lng: longitude } = result.position
|
||||
this.position = { latitude, longitude }
|
||||
} else {
|
||||
}
|
||||
})
|
||||
})
|
||||
return
|
||||
|
||||
if (navigator?.geolocation?.getCurrentPosition) {
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
position => {
|
||||
@@ -65,14 +48,6 @@ const instance = defineStore('user', {
|
||||
let { latitude, longitude } = position.coords
|
||||
this.position = { latitude, longitude }
|
||||
},
|
||||
// function (position) {
|
||||
// console.log('position', position)
|
||||
// // that.$patch(state => {
|
||||
// // ;({ latitude: state.position.latitude, longitude: state.position.longitude } = position.coords)
|
||||
// // localStorage.setItem('position', JSON.stringify(state.position))
|
||||
// // console.log(state.position, position.coords, '检测到地理位置授权')
|
||||
// // })
|
||||
// },
|
||||
error => {
|
||||
console.log('error', error)
|
||||
switch (error.code) {
|
||||
|
||||
@@ -22,6 +22,8 @@ import oilSiteApi from '@/api/oil-site.js'
|
||||
|
||||
import initAMap from '@/utils/amap.js'
|
||||
|
||||
import { Notify } from 'vant'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
homeNavBar,
|
||||
@@ -125,9 +127,27 @@ export default {
|
||||
return !position?.latitude && !position?.longitude ? true : false
|
||||
},
|
||||
getlist() {
|
||||
let position = { latitude: 36.636753, longitude: 119.11914 }
|
||||
|
||||
this.page.params = Object.assign(this.page.params, position)
|
||||
if (this.position) {
|
||||
this.obtainData()
|
||||
return
|
||||
}
|
||||
initAMap().then(() => {
|
||||
let AMap = this.$AMap
|
||||
let geolocation = new AMap.Geolocation({
|
||||
// enableHighAccuracy: true // 是否使用高精度定位,默认:true
|
||||
})
|
||||
geolocation.getCurrentPosition((status, result) => {
|
||||
if (status === 'complete') {
|
||||
let { lat: latitude, lng: longitude } = result.position
|
||||
this.position = { latitude, longitude }
|
||||
this.obtainData()
|
||||
} else {
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
obtainData() {
|
||||
this.page.params = Object.assign(this.page.params, this.position)
|
||||
this.loading = true
|
||||
oilSiteApi
|
||||
.getSiteList(this.page)
|
||||
@@ -148,45 +168,6 @@ export default {
|
||||
.catch(error => {
|
||||
this.finished = true
|
||||
})
|
||||
return
|
||||
initAMap().then(() => {
|
||||
let AMap = this.$AMap
|
||||
let geolocation = new AMap.Geolocation({
|
||||
// enableHighAccuracy: true // 是否使用高精度定位,默认:true
|
||||
})
|
||||
geolocation.getCurrentPosition((status, result) => {
|
||||
if (status === 'complete') {
|
||||
let { lat: latitude, lng: longitude } = result.position
|
||||
|
||||
// this.position = { latitude, longitude }
|
||||
// console.log('this.position', this.position)
|
||||
|
||||
let position = { latitude, longitude }
|
||||
|
||||
this.page.params = Object.assign(this.page.params, position)
|
||||
this.loading = true
|
||||
oilSiteApi
|
||||
.getSiteList(this.page)
|
||||
.then(res => {
|
||||
if (res.code == 20000) {
|
||||
if (res.data.list.length < 10) {
|
||||
this.finished = true
|
||||
}
|
||||
if (this.page.currentPage == 1) {
|
||||
this.list = res.data.list
|
||||
} else {
|
||||
this.list = this.list.concat(res.data.list)
|
||||
}
|
||||
this.loading = false
|
||||
this.refreshing = false
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.finished = true
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ module.exports = defineConfig({
|
||||
proxy: {
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
// target: `http://192.168.1.83:38080`,
|
||||
target: `https://www.xingoil.com/adminapi`,
|
||||
// target: `http://uat.xingoil.com/adminapi`,
|
||||
// target: `https://www.xingoil.com/adminapi`,
|
||||
target: `http://uat.xingoil.com/adminapi`,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||
|
||||
Reference in New Issue
Block a user