You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.4 KiB
50 lines
1.4 KiB
const baseURL = 'https://yoursairdata.com/gis/' |
|
// const baseURL = 'http://47.108.164.110:8080/' |
|
|
|
const GET = 'GET'; |
|
const POST = 'POST'; |
|
const PUT = 'PUT'; |
|
const FORM = 'FORM'; |
|
const DELETE = 'DELETE'; |
|
|
|
|
|
function request(method, url, data,is_token) { |
|
let token = wx.getStorageSync('access_token') |
|
|
|
return new Promise(function (resolve, reject) { |
|
let header = { |
|
'content-type': 'application/json' |
|
}; |
|
if(is_token){ |
|
header.access_token = `Bearer ${token}`; |
|
} |
|
wx.request({ |
|
url: baseURL + url, |
|
method: method, |
|
data: method === POST ? JSON.stringify(data) : data, |
|
header: header, |
|
success(res) { |
|
resolve(res.data); |
|
}, |
|
fail(err) { |
|
//请求失败 |
|
reject(err) |
|
} |
|
}) |
|
}) |
|
} |
|
|
|
|
|
const API = { |
|
getLandListing: (data) => request(GET, `getLandListing`,data), //已出让 |
|
getLandList: (data) => request(GET, `getLandList`,data), //挂牌中 |
|
getRegionByLocation: (data) => request(GET, `getRegionByLocation`,data), //行政区 |
|
getLandToList: (data) => request(GET, `getLandToList`,data), //待挂牌 |
|
getFacilitiesByLocation: (data) => request(GET, `getFacilitiesByLocation`,data), //配套 |
|
getLoopLine: (data) => request(GET, `getLoopLine`,data), //环线 |
|
getTypeRegionByLocation: (data) => request(GET, `getTypeRegionByLocation`,data), //大组团或者小组团 |
|
AJAX: (GET,url,data,is_token) => request(GET, url,data,is_token), |
|
}; |
|
module.exports = { |
|
API: API |
|
} |