12
This commit is contained in:
@@ -2,13 +2,13 @@ import axios from 'axios'
|
||||
import utils from '@/utils/encode'
|
||||
|
||||
// const env = process.env.NODE_ENV
|
||||
const env = 'production'/* */
|
||||
// const env = 'test'
|
||||
const testUrl = 'http://192.168.0.23:38080'
|
||||
// const env = 'production'/* */
|
||||
const env = 'test'
|
||||
const testUrl = 'http://192.168.0.20:38080'
|
||||
// const productUrl = 'http://121.196.213.68/adminapi' //预生产
|
||||
|
||||
// const productUrl = 'https://www.xingoil.com/adminapi' // 生产,加密 new
|
||||
const productUrl = 'http://uat.xingoil.com/adminapi' // 生产,加密 new
|
||||
const productUrl = 'https://www.xingoil.com/adminapi' // 生产,加密 new
|
||||
// const productUrl = 'http://uat.xingoil.com/adminapi' // 生产,加密 new
|
||||
const service = axios.create({
|
||||
baseURL: env == 'production' ? productUrl : testUrl,
|
||||
// baseURL: testUrl,
|
||||
@@ -19,22 +19,23 @@ var url = ''
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
// 拦截请求
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
})
|
||||
if(!config?.HIDELODING){
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
})
|
||||
}
|
||||
const token = uni.getStorageSync('Authorization')
|
||||
const unionId = uni.getStorageSync('unionid')
|
||||
console.log(unionId)
|
||||
const openId = uni.getStorageSync('openid')
|
||||
// const accountSources = 'WE_CHAT_PROGRAM'
|
||||
const accountSources = 'LOGIN_MP_WECHAT'
|
||||
// console.log('取出来缓存', token, openid)
|
||||
|
||||
config.headers['openId'] = openId
|
||||
config.headers['Authorization'] = token
|
||||
config.headers['accountSources'] = accountSources
|
||||
config.headers['imei'] = unionId
|
||||
config.headers['dataSources'] = 'MP'
|
||||
config.headers['loginDevice'] = 'LOGIN_MP_WECHAT'
|
||||
config.headers['loginSystem'] = 'OIL_MINI_ZP'
|
||||
|
||||
if (env === 'production') {
|
||||
// 生产环境,加密,不输出任何东西
|
||||
@@ -57,8 +58,7 @@ service.interceptors.request.use(
|
||||
console.log('\n\n-----------------------')
|
||||
console.log('参数', config.url, '参数加密前', config.data)
|
||||
url = config.url
|
||||
}
|
||||
|
||||
}
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
@@ -88,16 +88,15 @@ service.interceptors.response.use(
|
||||
console.log('-------------------------------------------\n\n')
|
||||
}
|
||||
|
||||
uni.hideLoading()
|
||||
if(response.config.url.indexOf('/oil-site/oilSiteOrderInfo/getOrderQrCode') === -1){
|
||||
uni.hideLoading();
|
||||
res.code==42011?uni.$emit('isOnline','offline'):uni.$emit('isOnline','online');
|
||||
if(response.config.url.indexOf('/xkhl-site/mobileOrderApi/getOrderQrCode') === -1){
|
||||
if (res.code != 20000 && res.msg != '令牌为空,不允许操作' && res.msg != '您的ip已经更改,请重新登录' && res.msg != '登录与操作设备不同') {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none"
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return res
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user