|
|
@@ -1,8 +1,8 @@
|
|
|
const _Http = getApp().globalData.http;
|
|
|
-/* const QQMapWX = require('../../utils/qqmap-wx-jssdk.min'),
|
|
|
- qqmapsdk = new QQMapWX({
|
|
|
- key: 'QF6BZ-4IQC5-SN2IH-QL5BW-U4IJO-R3BY4' // 必填
|
|
|
- }); */
|
|
|
+
|
|
|
+import { tianditu } from "../../utils/tianditu.js";
|
|
|
+const api = new tianditu();
|
|
|
+
|
|
|
import {
|
|
|
formatTime
|
|
|
} from "../../utils/getTime";
|
|
|
@@ -258,29 +258,14 @@ Page({
|
|
|
latitude,
|
|
|
longitude
|
|
|
}) {
|
|
|
- console.log('bu精确', latitude, longitude)
|
|
|
wx.hideLoading();
|
|
|
- _Http.basic({
|
|
|
- "id": "10027201",
|
|
|
- "content": {
|
|
|
- "lon": longitude,
|
|
|
- "lat": latitude
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- console.log("获取逆解析地址", res)
|
|
|
- if (res.msg != '成功') return wx.showToast({
|
|
|
- title: res.msg,
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- if (res.data.msg != 'ok') return wx.showToast({
|
|
|
- title: '定位失败,请查看手机是否开启定位服务',
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- let result = res.data.result;
|
|
|
+ api.getPlace(longitude, latitude).then((place) => {
|
|
|
+ console.log("获取逆解析地址", place)
|
|
|
+ let result = place.result;
|
|
|
that.setData({
|
|
|
content: {
|
|
|
- province: result.addressComponent.province,
|
|
|
- city: result.addressComponent.city,
|
|
|
+ province: result.addressComponent.province|| result.addressComponent.city,
|
|
|
+ city: result.addressComponent.city||result.addressComponent.province,
|
|
|
county: result.addressComponent.county,
|
|
|
address: result.formatted_address,
|
|
|
latitude,
|
|
|
@@ -291,35 +276,6 @@ Page({
|
|
|
}
|
|
|
})
|
|
|
})
|
|
|
- /* qqmapsdk.reverseGeocoder({
|
|
|
- location: {
|
|
|
- latitude,
|
|
|
- longitude
|
|
|
- },
|
|
|
- success(s) {
|
|
|
- console.log("逆解析", s)
|
|
|
- that.setData({
|
|
|
- content: {
|
|
|
- province: s.result.address_component.province,
|
|
|
- city: s.result.address_component.city,
|
|
|
- county: s.result.address_component.district,
|
|
|
- address: s.result.address,
|
|
|
- longitude,
|
|
|
- latitude,
|
|
|
- remarks: "",
|
|
|
- sa_projectid: 0,
|
|
|
- sys_enterpriseid: 0
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- fail(err) {
|
|
|
- console.log(err)
|
|
|
- wx.showToast({
|
|
|
- title: '定位失败,请查看手机是否开启定位服务',
|
|
|
- icon: "none"
|
|
|
- })
|
|
|
- }
|
|
|
- }) */
|
|
|
},
|
|
|
fail: function (e) {
|
|
|
//这里是获取失败的时候
|