更新
This commit is contained in:
@@ -2,27 +2,27 @@ import axios from 'axios'
|
||||
import utils from '@/utils/encode'
|
||||
|
||||
// const env = process.env.NODE_ENV
|
||||
const env = 'production'/* */
|
||||
const env = 'production' /* */
|
||||
// const env = 'test'
|
||||
const testUrl = 'http://192.168.110.77: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,
|
||||
timeout: 5000
|
||||
})
|
||||
var url = ''
|
||||
|
||||
var url = ''
|
||||
|
||||
service.interceptors.request.use(
|
||||
config => {
|
||||
// 拦截请求
|
||||
uni.showLoading({
|
||||
title: '加载中...'
|
||||
})
|
||||
const token = uni.getStorageSync('Authorization')
|
||||
const token = uni.getStorageSync('Authorization') || " "
|
||||
const unionId = uni.getStorageSync('unionid')
|
||||
// console.log(unionId)
|
||||
const openId = uni.getStorageSync('openid')
|
||||
@@ -35,14 +35,17 @@ service.interceptors.request.use(
|
||||
config.headers['accountSources'] = accountSources
|
||||
config.headers['imei'] = unionId
|
||||
config.headers['dataSources'] = 'MP'
|
||||
|
||||
|
||||
console.log(config)
|
||||
|
||||
if(['/oil-site/oilSiteAppInfo/findKASiteInfoByPage','/oil-site/oilSiteAppInfo/getSiteDetailsByKA','/oil-site/oilSiteAppInfo/getSitePriceKAByBelong'].includes(config.url)) {
|
||||
let parentCompanyId = config.baseURL === 'https://www.xingoil.com/adminapi' ? '1812649739013771264' : '1810568376122056704'
|
||||
if(config.data.params) {
|
||||
|
||||
if (['/oil-site/oilSiteAppInfo/findKASiteInfoByPage', '/oil-site/oilSiteAppInfo/getSiteDetailsByKA',
|
||||
'/oil-site/oilSiteAppInfo/getSitePriceKAByBelong'
|
||||
].includes(config.url)) {
|
||||
let parentCompanyId = config.baseURL === 'https://www.xingoil.com/adminapi' ? '1812649739013771264' :
|
||||
'1810568376122056704'
|
||||
if (config.data.params) {
|
||||
config.data.params['parentCompanyId'] = parentCompanyId
|
||||
}else config.data['parentCompanyId'] = parentCompanyId
|
||||
} else config.data['parentCompanyId'] = parentCompanyId
|
||||
}
|
||||
|
||||
if (env === 'production') {
|
||||
@@ -82,11 +85,12 @@ service.interceptors.response.use(
|
||||
const dataParam = JSON.parse(utils.decrypt(res.data))
|
||||
res.data = JSON.stringify(dataParam) === '{}' ? null : dataParam
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uni.hideLoading()
|
||||
if(response.config.url.indexOf('/oil-site/oilSiteOrderInfo/getOrderQrCode') === -1){
|
||||
if (res.code != 20000 && res.msg != '令牌为空,不允许操作' && res.msg != '您的ip已经更改,请重新登录' && res.msg != '登录与操作设备不同' && res.msg != '用户未登录只可查询前两页油站信息') {
|
||||
if (response.config.url.indexOf('/oil-site/oilSiteOrderInfo/getOrderQrCode') === -1) {
|
||||
if (res.code != 20000 && res.msg != '令牌为空,不允许操作' && res.msg != '您的ip已经更改,请重新登录' && res.msg !=
|
||||
'登录与操作设备不同' && res.msg != '用户未登录只可查询前两页油站信息') {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none"
|
||||
@@ -147,4 +151,4 @@ service.defaults.adapter = function(config) {
|
||||
}
|
||||
// #endif
|
||||
|
||||
export default service
|
||||
export default service
|
||||
Reference in New Issue
Block a user