|
@@ -128,73 +128,73 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- getLocation() {
|
|
|
- let that = this;
|
|
|
- return new Promise((resove, reject) => {
|
|
|
- wx.getLocation({
|
|
|
- success: function (res) {
|
|
|
- resove(res)
|
|
|
- },
|
|
|
- fail: function (res) {
|
|
|
- reject(res)
|
|
|
- that.hideAll()
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- getLocation(_this) {
|
|
|
-
|
|
|
- let ak = 'GoI7BxLpfvBEyf1TcMXCloi99Vov7flZ'
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
- wx.getLocation({
|
|
|
- type: 'wgs84',
|
|
|
- success: function (res) {
|
|
|
- let latitude = res.latitude
|
|
|
- let longitude = res.longitude
|
|
|
- wx.request({
|
|
|
- url: 'https://api.map.baidu.com/reverse_geocoding/v3/?ak=sHZTomd7grslfP7sPKB8tRgT49FK9TEu&output=json&coordtype=gcj02&location=' + latitude + ',' + longitude,
|
|
|
- data: {},
|
|
|
- header: {
|
|
|
- 'Content-Type': 'application/json'
|
|
|
- },
|
|
|
- success: function (ops) {
|
|
|
- let {
|
|
|
- province,
|
|
|
- city,
|
|
|
- district
|
|
|
- } = ops.data.result.addressComponent
|
|
|
- let region = province + city + district
|
|
|
- resolve({
|
|
|
- region,
|
|
|
- latitude,
|
|
|
- longitude
|
|
|
- })
|
|
|
- },
|
|
|
- fail: function (err) {
|
|
|
- wx.showModal({
|
|
|
- title: '信息提示',
|
|
|
- content: '请求失败',
|
|
|
- showCancel: false,
|
|
|
- confirmColor: '#f37938'
|
|
|
- });
|
|
|
- },
|
|
|
- complete: function () { }
|
|
|
- })
|
|
|
- },
|
|
|
- fail(err) {
|
|
|
- wx.showModal({
|
|
|
- title: '未授权',
|
|
|
- content: `为保证功能正常使用,点击「右上角」-「关于**」-「右上角」-「设置」,打开位置权限后重试`,
|
|
|
- showCancel: false,
|
|
|
- })
|
|
|
- resolve()
|
|
|
- },
|
|
|
- complete: (data) => {
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
networkError(status = 0) {
|
|
|
const netMessage = {
|