pull/3/head
xiaozhiyong 2 years ago
parent 176e09a530
commit 21fca7a4b7
  1. 8
      BagStation/pages/stationDetail/stationDetail.vue
  2. 35
      utils/request.js

@ -316,10 +316,10 @@
},
goBack() {
// this.innerAudioContext.stop()
uni.switchTab({
url: '/pages/tabbar/home/home'
});
let scanningParams = uni.getStorageSync('scanningParams')
scanningParams
? uni.switchTab({url: '/pages/tabbar/home/home'})
: uni.navigateBack() ;
},
selectRadio() {
this.radio === 'A' ? this.radio = '' : this.radio = 'A'

@ -1,17 +1,13 @@
import axios from 'axios'
import utils from '@/utils/encode'
// const env = process.env.NODE_ENV
// const env = 'production'/* */
const env = 'test'
const env = 'production'
const testUrl = 'http://192.168.110.230: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' // 生产
const productUrl = 'http://uat.xingoil.com/adminapi' // uat
const service = axios.create({
baseURL: env == 'production' ? productUrl : testUrl,
// baseURL: testUrl,
timeout: 5000
})
var url = ''
@ -24,11 +20,8 @@ service.interceptors.request.use(
})
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
@ -37,25 +30,16 @@ service.interceptors.request.use(
config.headers['dataSources'] = 'MP'
if (env === 'production') {
// 生产环境,加密,不输出任何东西
// 设置jsessionid和token
// 生产环境加密
const JSESSIONID = utils.uuid()
config.headers['JSESSIONID'] = JSESSIONID
config.headers['token'] = utils.md5Salt(JSESSIONID)
// if ( encryptWhite.indexOf(config.url) < 0) {
// if (!notEncrypt && encryptWhite.indexOf(config.url) < 0) {
// 这是定义在哪的
const data = { // 用于存储加密
params: '' // 加密后的密文
const data = {
params: ''
}
// 要加密
data.params = utils.encrypt(JSON.stringify(config.data))
// console.log('参数', config.url, '参数加密前',config.data)
config.data = data
// }
} else {
// console.log('\n\n-----------------------')
// console.log('参数', config.url, '参数加密前', config.data)
url = config.url
}
@ -76,16 +60,11 @@ service.interceptors.response.use(
const res = response.data
if (env === 'production') {
// 生产环境,进行加密解密,不输出日志
// 生产环境解密
if (res.encrypt == 1) {
// 加密的数据,需要解密
const dataParam = JSON.parse(utils.decrypt(res.data))
res.data = JSON.stringify(dataParam) === '{}' ? null : dataParam
// console.log('返回', response.config.url, '返回结果',res)
}
} else {
// console.log('返回', response.config.url, '返回结果未加密', res)
// console.log('-------------------------------------------\n\n')
}
uni.hideLoading()

Loading…
Cancel
Save