http请求 域名修改

This commit is contained in:
姚亚男
2021-10-21 15:58:16 +08:00
parent 1993bfecf2
commit 8a819d829e
4 changed files with 17 additions and 11 deletions
+2 -6
View File
@@ -1,10 +1,6 @@
import http from './http.js'
// let baseUrl = 'https://share.hzwlsoft.com'
// let baseUrl = 'http://localhost:8080'
let baseUrl = 'http://10.0.1.16:8080'
let URL_CONFIG = '/jero-boot/'
// let baseUrl = 'http://192.168.1.110:8080'
let baseUrl = http.baseUrl
let URL_CONFIG = http.URL_CONFIG
/* 配置路径 */
+6 -2
View File
@@ -6,8 +6,9 @@ let headerDefault1 = {
'content-type': 'application/x-www-form-urlencoded'
}
let TokenKey = 'X-Access-Token'
let baseUrl = 'http://10.0.1.9:8080'
// let baseUrl = 'http://localhost:8080'
let baseUrl = 'http://bxxt.hzwlsoft.com:1015'
let URL_CONFIG = '/jero-boot/'
const http = (method, url, data, header= headerDefault) => {
let Authorization = wx.getStorageSync(TokenKey) ? wx.getStorageSync(TokenKey) : '';
header[TokenKey] = Authorization == '' ? '' : Authorization
@@ -28,6 +29,7 @@ const http = (method, url, data, header= headerDefault) => {
}
},
fail: err => {
console.log(err)
reject(err);
wx.hideLoading();
},
@@ -37,6 +39,8 @@ const http = (method, url, data, header= headerDefault) => {
}
module.exports = {
baseUrl,
URL_CONFIG,
get: (url, data, header) => http('GET', url, data, header),
post: (url, data, header) => http('POST', url, data, header),
post1: (url, data, header) => http('POST', url, data, headerDefault1),