//是否是正式环境 const wx_rlxf = true //设置域名 // const dev_baseUrl_wxrlxf = 'https://hanghuikeji.mynatapp.cc/yx-fyzd'; //测试 const dev_baseUrl_wxrlxf = 'http://192.168.77.11:9100/yx-fyzd'; //测试 const pro_baseUrl_wxrlxf = 'https://tx.hz-hanghui.com:8088/yx-fyzd'; //正式 const baseUrl = wx_rlxf ? pro_baseUrl_wxrlxf : dev_baseUrl_wxrlxf; //https请求 const request_wxrlxf = e => { return new Promise(function (resolve, reject) { wx.request({ url: wx_rlxf ? (pro_baseUrl_wxrlxf + e.url) : (dev_baseUrl_wxrlxf + e.url), data: e.data, method: e.method, header: { 'content-type': e.type }, success: res => { if (res.statusCode == 200) { resolve(res.data) } else { reject(res.data) }; }, fail: error => { reject(error.errMsg) } }) }) } //是否是正式环境 const env = true //设置域名 const dev_baseUrl = 'http://192.168.18.117:8088'; //测试 const pro_baseUrl = 'https://renhe.hz-hanghui.com'; //正式 //https请求 const request = e => { return new Promise(function (resolve, reject) { wx.request({ url: env ? (pro_baseUrl + e.url) : (dev_baseUrl + e.url), data: e.data, method: e.method, header: { 'content-type': e.type }, success: res => { if (res.statusCode == 200) { resolve(res.data) } else { reject(res.data) }; }, fail: error => { reject(error.errMsg) } }) }) } //判断输入是否为空 const matchNull = (e) => { return e ? e : false; } module.exports = { wx_rlxf: wx_rlxf, dev_baseUrl_wxrlxf: dev_baseUrl_wxrlxf, pro_baseUrl_wxrlxf: pro_baseUrl_wxrlxf, request_wxrlxf: request_wxrlxf, env: env, dev_baseUrl: dev_baseUrl, pro_baseUrl: pro_baseUrl, request: request, baseUrl:baseUrl, }