| | |
| | | export default { |
| | | // BASE_URL: 'https://huacheng.psciio.com', |
| | | BASE_URL: 'http://192.168.110.188:6194', |
| | | BASE_URL: 'https://huacheng.psciio.com', |
| | | // BASE_URL: 'http://192.168.110.188:6194', |
| | | imageUrl: 'https://huacheng.psciio.com/api/huacheng-applets/common/uploadimages', |
| | | } |
| | |
| | |
|
| | | <script>
|
| | | import {
|
| | | searchLocation
|
| | | searchLocation,
|
| | | geoconv
|
| | | } from './service'
|
| | | export default {
|
| | | data() {
|
| | |
| | | navigator.geolocation.getCurrentPosition(success, error, options);
|
| | |
|
| | | function success(position) {
|
| | | uni.request({
|
| | | url: `https://api.map.baidu.com/geoconv/v2/?coords=${position.coords.longitude},${position.coords.latitude}&model=2&ak=3mHKIXMArjgIkgADzOlTYp4XssNSNkwr`,
|
| | | method: 'GET',
|
| | | success: (res) => {
|
| | | const latitude = res.data.result[0].y;
|
| | | const longitude = res.data.result[0].x;
|
| | | var point = new BMapGL.Point(longitude, latitude); // 创建点坐标
|
| | | geoconv({coords:`${position.coords.longitude},${position.coords.latitude}`}).then(res=>{
|
| | | const latitude = res.data[0].y;
|
| | | const longitude = res.data[0].x;
|
| | | that.map.enableScrollWheelZoom(true);
|
| | | that.map.centerAndZoom(point, 12);
|
| | | var marker = new BMapGL.Marker(point);
|
| | |
| | | return item
|
| | | })
|
| | | })
|
| | | },
|
| | | });
|
| | | })
|
| | | }
|
| | |
|
| | | function error(err) {
|
| | |
| | | export const searchLocation = (params) => { |
| | | return request.get(`/api/huacheng-sangeshenbian/applet/home/search-location`, params) |
| | | } |
| | | // 地点搜索 |
| | | export const geoconv = (params) => { |
| | | return request.get(`/api/huacheng-sangeshenbian/applet/home/geoconv`, params) |
| | | } |