| 1234567891011121314151617181920212223242526272829303132 | 
							- /* 文档 http://lbs.tianditu.gov.cn/server/search2.html */
 
- class tianditu {
 
-     /* 逆解析 */
 
-     getPlace(lon, lat) {
 
-         return this.request(`/geocoder?postStr={'lon':${lon},'lat':${lat},'ver':1}&type=geocode`)
 
-     }
 
-     /* 地名搜索 */
 
-     placeNameSearch(data = {}) {
 
-         return this.request(`/v2/search?postStr=${JSON.stringify(data)}&type=query`)
 
-     }
 
-     request(query, method = 'GET') {
 
-         const tks = ['524ebc3954aaa26259f80ea937a3f569', '8aad97b24c38ed6643207de9da174b98', '47bb2ca36a43839fd7c45e2d762561f8'],
 
-             url = 'https://api.tianditu.gov.cn' + query + `&tk=${tks[ Math.floor(Math.random() * tks.length)]}`
 
-         return new Promise((resolve, reject) => {
 
-             this._request(url, method, resolve)
 
-         })
 
-     }
 
-     _request(url, method, resolve) {
 
-         uni.request({
 
-             url,
 
-             method,
 
-             success: (res) => {
 
-                 resolve(res.data)
 
-             }
 
-         });
 
-     }
 
- }
 
- export {
 
-     tianditu
 
- }
 
 
  |