老登陆,经营分析,被挤掉提示

This commit is contained in:
xk_guohonglei
2020-09-05 11:53:19 +08:00
parent 395ebd432d
commit a5fe20c721
14 changed files with 1065 additions and 329 deletions

View File

@@ -58,10 +58,10 @@ export default {
md5Salt(str) {
// console.log('hahahahaha',str, str + "Do&9hY%l8e", md5(str + 'Do&9hY%l8e'))
// str ='fd3fc615-3554-4ff5-8848-364577e8687d'
console.log('hahahahaha', str, str + "kdq*&qflbn1gga?aDq", md5(str + 'kdq*&qflbn1gga?aDq'))
console.log('\n\n------ begin: ------')
console.log("md5(str + 'kdq*&qflbn1gga?aDq')", md5(str + 'kdq*&qflbn1gga?aDq'))
console.log('------ end: ------\n\n')
// console.log('hahahahaha', str, str + "kdq*&qflbn1gga?aDq", md5(str + 'kdq*&qflbn1gga?aDq'))
// console.log('\n\n------ begin: ------')
// console.log("md5(str + 'kdq*&qflbn1gga?aDq')", md5(str + 'kdq*&qflbn1gga?aDq'))
// console.log('------ end: ------\n\n')
return md5(str + 'kdq*&qflbn1gga?aDq')
},
md5NoSalt(str) {

View File

@@ -16,20 +16,20 @@ service.interceptors.request.use(
})
const token = uni.getStorageSync('Authorization')
const openid = uni.getStorageSync('device')
console.log('取出来缓存' ,token,openid)
console.log('取出来缓存', token, openid)
config.headers['Authorization'] = token
config.headers['device'] = openid
config.headers['dataSources'] = 'MP'
// if (env === 'production') {
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) {
if (!notEncrypt && encryptWhite.indexOf(config.url) < 0) {
// 这是定义在哪的
const data = { // 用于存储加密
params: '' // 加密后的密文
@@ -38,10 +38,10 @@ service.interceptors.request.use(
data.params = utils.encrypt(JSON.stringify(config.data))
console.log(data.params)
config.data = data
// }
// } else {
}
} else {
console.log('请求路径', config.url, '参数加密前', config.data)
// }
}
return config
},
@@ -60,17 +60,17 @@ service.interceptors.response.use(
const res = response.data
const env = process.env.NODE_ENV
// if (env === 'production') {
if (env === 'production') {
// 生产环境,进行加密解密,不输出日志
if (res.encrypt === 1) {
if (res.encrypt == 1) {
// 加密的数据,需要解密
const dataParam = JSON.parse(utils.decrypt(res.data))
res.data = JSON.stringify(dataParam) === '{}' ? null : dataParam
}
// } else {
} else {
console.log('请求路径', response.config.url, '返回结果未加密', res)
console.log('-------------------------------------------')
// }
}
uni.hideLoading()
if (res.code != 20000) {
@@ -78,7 +78,7 @@ service.interceptors.response.use(
title: res.msg,
icon: "none"
})
if(res.code===42011){
if (res.code === 42011) {
console.log(res.code)
// uni.navigateTo({
// url:'/pages/login/login',
@@ -90,6 +90,37 @@ service.interceptors.response.use(
// }
// })
}
if (res.msg === '您已被迫下线') {
uni.showModal({
title: '下线提醒',
confirmText: '重新登录',
cancelText: "退出",
content: '您的账号在另一微信下登录了星油云站,请确认是否本加油站工作人员操作',
success: function(res) {
if (res.confirm) {
uni.reLaunch({
url: '/pages/startPage/startPage',
success: () => {
console.log('跳转成功')
},
fail: (err) => {
console.log(err)
}
})
} else if (res.cancel) {
uni.reLaunch({
url: '/pages/login/boforeLogin/boforeLogin',
success: () => {
console.log('跳转成功')
},
fail: (err) => {
console.log(err)
}
})
}
}
});
}
}
return res
},