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() { goBack() {
// this.innerAudioContext.stop() // this.innerAudioContext.stop()
let scanningParams = uni.getStorageSync('scanningParams')
uni.switchTab({ scanningParams
url: '/pages/tabbar/home/home' ? uni.switchTab({url: '/pages/tabbar/home/home'})
}); : uni.navigateBack() ;
}, },
selectRadio() { selectRadio() {
this.radio === 'A' ? this.radio = '' : this.radio = 'A' this.radio === 'A' ? this.radio = '' : this.radio = 'A'

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

Loading…
Cancel
Save