1234567891011121314151617181920212223242526272829303132 |
- // method OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
- function request(dever, url, param, callback, method, header){
- if(!method) {
- method = 'get';
- }
-
- if (!header) {
- var header = {};
- header['content-type'] = 'application/x-www-form-urlencoded';
- }
- for (var i in dever.config.host) {
- if (url.indexOf(i + '.') != -1) {
- url = url.replace(i + '.', dever.config.host[i]);
- break;
- }
- }
- wx.request({
- url: url,
- data: param,
- method: method.toUpperCase(),
- header: header,
- success: callback.success,
- fail: callback.fail,
- complete: callback.complete
- })
- }
- module.exports = {
- request:request
- }
|