更新
This commit is contained in:
@@ -3,16 +3,16 @@ import utils from '@/utils/encode'
|
||||
// const env = process.env.NODE_ENV
|
||||
// const env = 'production'/* */
|
||||
// const env = 'test'
|
||||
const env = 'production'
|
||||
const env = 'test'
|
||||
// 45
|
||||
const testUrl = 'http://192.168.0.23:38080'
|
||||
const testUrl = 'http://192.168.110.230:38080'
|
||||
// const productUrl = 'https://www.xingoil.com/adminapi'
|
||||
|
||||
const productUrl = 'http://uat.xingoil.com/adminapi'
|
||||
// const productUrl = 'http://192.168.0.191:38080'
|
||||
// const productUrl = 'http://121.196.213.68/adminapi'
|
||||
const service = axios.create({
|
||||
baseURL: env == 'production' ? productUrl : testUrl,
|
||||
baseURL: env == 'production' ? productUrl : testUrl,,
|
||||
// baseURL: testUrl,
|
||||
timeout: 5000
|
||||
})
|
||||
@@ -22,7 +22,7 @@ service.interceptors.request.use(
|
||||
config => {
|
||||
// 拦截请求
|
||||
closeShowLoading = config?.closeShowLoading||false;
|
||||
console.log(closeShowLoading,'isLoadingisLoadingisLoading')
|
||||
// console.log(closeShowLoading,'isLoadingisLoadingisLoading')
|
||||
if(!closeShowLoading){
|
||||
//判断是否自动开始请求loading
|
||||
uni.showLoading({
|
||||
@@ -44,7 +44,7 @@ service.interceptors.request.use(
|
||||
config.headers['dataSources'] = 'MP'
|
||||
|
||||
if (env === 'production') {
|
||||
console.log("这里是生产")
|
||||
// console.log("这里是生产")
|
||||
// 生产环境,加密,不输出任何东西
|
||||
// 设置jsessionid和token
|
||||
const JSESSIONID = utils.uuid()
|
||||
@@ -58,13 +58,13 @@ service.interceptors.request.use(
|
||||
}
|
||||
// 要加密
|
||||
data.params = utils.encrypt(JSON.stringify(config.data))
|
||||
console.log('参数', config.url, '参数加密前', config.data, '加密:', data)
|
||||
// console.log('参数', config.url, '参数加密前', config.data, '加密:', data)
|
||||
config.data = data
|
||||
// }
|
||||
} else {
|
||||
console.log("这里是测试")
|
||||
console.log('\n\n-----------------------')
|
||||
console.log('参数', config.url, '参数加密前', config.data)
|
||||
// console.log("这里是测试")
|
||||
// console.log('\n\n-----------------------')
|
||||
// console.log('参数', config.url, '参数加密前', config.data)
|
||||
url = config.url
|
||||
}
|
||||
|
||||
@@ -91,11 +91,11 @@ service.interceptors.response.use(
|
||||
// 加密的数据,需要解密
|
||||
const dataParam = JSON.parse(utils.decrypt(res.data))
|
||||
res.data = JSON.stringify(dataParam) === '{}' ? null : dataParam
|
||||
console.log(res.data)
|
||||
// console.log(res.data)
|
||||
// console.log('返回', response.config.url, '返回结果',res)
|
||||
}
|
||||
} else {
|
||||
console.log('返回', response.config.url, '返回结果未加密', res)
|
||||
// console.log('返回', response.config.url, '返回结果未加密', res)
|
||||
// console.log('-------------------------------------------\n\n')
|
||||
}
|
||||
if(!closeShowLoading){
|
||||
@@ -104,7 +104,7 @@ service.interceptors.response.use(
|
||||
}
|
||||
if (response.config.url.indexOf('/oil-site/oilSiteOrderInfo/getOrderQrCode') === -1) {
|
||||
if (response.config.url.indexOf('/oil-site/oilSiteAppInfo/getSiteDetails') != -1) {
|
||||
console.log('这里是getSiteDetails 拦截处')
|
||||
// console.log('这里是getSiteDetails 拦截处')
|
||||
// if (res.code != 20000&&res.msg!='令牌为空,不允许操作'&&res.msg!='您的ip已经更改,请重新登录'&&res.msg!='登录与操作设备不同') {
|
||||
// uni.showToast({
|
||||
// title: res.msg,
|
||||
|
||||
Reference in New Issue
Block a user