| | |
| | | options.method = options.method || this.common.method; |
| | | options.dataType = options.dataType || this.common.dataType; |
| | | return new Promise((resolve, reject) => { |
| | | console.log("request:", options); |
| | | //console.log("request:", options); |
| | | |
| | | uni.request({ |
| | | url: options.url, |
| | |
| | | method: options.method, |
| | | dataType: options.dataType, |
| | | success: (result) => { |
| | | console.log("result", result) |
| | | // console.log("result", result) |
| | | if (result.statusCode != 200) { |
| | | if (result.statusCode == 404) { |
| | | return reject({ |
| | | errMsg: "地址不对,请检查该地址:" + options.url |
| | | }); |
| | | } |
| | | return reject({ |
| | | errMsg: "访问失败,状态码:" + result.statusCode |
| | | }) |
| | | } |
| | | |
| | | var ret = result.data |
| | | if (typeof ret == 'string') { |
| | | try { |
| | |
| | | options.method = options.method || this.common.method; |
| | | options.dataType = options.dataType || this.common.dataType; |
| | | return new Promise((resolve, reject) => { |
| | | console.log("request:", options); |
| | | //console.log("request:", options); |
| | | |
| | | uni.request({ |
| | | url: options.url, |
| | |
| | | method: options.method, |
| | | dataType: options.dataType, |
| | | success: (result) => { |
| | | console.log("result", result) |
| | | // console.log("result", result) |
| | | if (result.statusCode != 200) { |
| | | if (result.statusCode == 404) { |
| | | return reject({ |
| | | errMsg: "地址不对,请检查该地址:" + options.url |
| | | }); |
| | | } |
| | | return reject({ |
| | | errMsg: "访问失败,状态码:" + result.statusCode |
| | | }) |
| | | } |
| | | |
| | | var ret = result.data |
| | | if (typeof ret == 'string') { |
| | | try { |