1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- const baseUrl = 'http://mz.tshe.cn:802/prod-api';
- module.exports = {
- query({url, data, method = 'GET'}) {
- return new Promise((resolve, reject) => {
- wx.request({
- url: `${baseUrl}/${url}`,
- data: data,
- method: method,
- timeout: 5000,
- header: {
- 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8;'
- },
- // dataType: 'json',
- success: resolve,
- fail: reject,
- });
- });
- },
- query2({url, data, method = 'GET'}) {
- return new Promise((resolve, reject) => {
- wx.request({
- url: `${baseUrl}/${url}`,
- data: data,
- method: method,
- timeout: 5000,
- header: {
- 'content-type': 'application/json;'
- },
- dataType: 'json',
- success: resolve,
- fail: reject,
- });
- });
- },
- fetch({url, id}) {
- return new Promise((resolve, reject) => {
- wx.request({
- url: `${baseUrl}/${url}/${id}`,
- method: 'GET',
- header: {'content-type': 'application/json'},
- dataType: 'json',
- success: resolve,
- fail: reject,
- });
- });
- },
- }
|