|
@@ -1,6 +1,8 @@
|
1
|
1
|
//index.js
|
2
|
2
|
//获取应用实例
|
3
|
3
|
const app = getApp()
|
|
4
|
+const HttpSever = require('../../../utils/http.js').HttpSever;
|
|
5
|
+const $api = require('../../../config/api.js').$api;
|
4
|
6
|
|
5
|
7
|
Component({
|
6
|
8
|
behaviors: [],
|
|
@@ -28,7 +30,23 @@ Component({
|
28
|
30
|
}]
|
29
|
31
|
},
|
30
|
32
|
lifetimes: {},
|
31
|
|
- ready: function() {},
|
|
33
|
+ ready: function() {
|
|
34
|
+ const _that = this
|
|
35
|
+ wx.getSetting({
|
|
36
|
+ success(res) {
|
|
37
|
+ if (!res.authSetting['scope.userLocation']) {
|
|
38
|
+ wx.authorize({
|
|
39
|
+ scope: 'scope.userLocation',
|
|
40
|
+ success() {
|
|
41
|
+ _that.ShowLocation()
|
|
42
|
+ }
|
|
43
|
+ })
|
|
44
|
+ } else {
|
|
45
|
+ _that.ShowLocation()
|
|
46
|
+ }
|
|
47
|
+ }
|
|
48
|
+ })
|
|
49
|
+ },
|
32
|
50
|
pageLifetimes: {
|
33
|
51
|
show: function() {},
|
34
|
52
|
},
|
|
@@ -37,6 +55,20 @@ Component({
|
37
|
55
|
wx.navigateTo({
|
38
|
56
|
url: '/pages/EstateDetail/index?id='
|
39
|
57
|
})
|
|
58
|
+ },
|
|
59
|
+ ShowLocation() {
|
|
60
|
+ wx.getLocation({
|
|
61
|
+ type: 'wgs84',
|
|
62
|
+ success(res) {
|
|
63
|
+ console.log(res)
|
|
64
|
+ HttpSever.Ajax({
|
|
65
|
+ url: $api.building.list.url,
|
|
66
|
+ method: $api.building.list.method,
|
|
67
|
+ }).then((date) => {
|
|
68
|
+ console.log(date)
|
|
69
|
+ })
|
|
70
|
+ }
|
|
71
|
+ })
|
40
|
72
|
}
|
41
|
73
|
}
|
42
|
74
|
})
|