This commit is contained in:
Vergil
2020-04-13 15:13:24 +08:00
parent 37d1a82b07
commit af2f5c5e4e
4 changed files with 53 additions and 9 deletions

View File

@@ -1,4 +1,6 @@
import axios from 'axios'
import Cookies from 'js-cookie'
import store from '@/store'
export const wsuri = `ws://123.56.95.229:61101//WebMoudule//websocket`
export const name = `OP8888`
@@ -26,7 +28,44 @@ export const MESUploadFile = `http://123.56.95.229:8010/submit/MESUploadFile.ash
export const MESDownloadFile = `http://123.56.95.229:8010/submit/MESDownloadFile.ashx`
const service = axios.create({
baseURL: `http://123.56.95.229:8010/submit/MESCommonBase.ashx`,
// baseURL: `http://192.168.1.192:8045/submit/MESCommonBase.ashx`,
timeout: 1500000 // 请求超时时间
})
// && config.data.name !== '菜单系统模块_通知信息_查询数据' && config.data.name !== '菜单系统模块_首页信息_查询数据1' && config.data.name !== '菜单系统模块_首页信息_查询数据2'
service.interceptors.request.use(config => {
if (config.data.name !== '菜单系统模块_用户名密码_查询数据_new2' && config.data.name !== '菜单系统模块_获取角色模块_查询数据') {
getSession_id().then(res => {
if (res === 0) {
store.dispatch('FedLogOut').then(() => {
location.reload() // 为了重新实例化vue-router对象 避免bug
alert('此账号已异地登录,请查重新登录')
})
}
})
}
return config
}, error => {
Promise.reject(error)
})
export default service
async function getSession_id() {
const id = Cookies.get('id')
const session_id = Cookies.get('session_id')
const param = {
url: url,
method: 'post',
data: {
type: '1',
name: '菜单系统模块_用户sessionID_查询数据',
param: '人员编号=' + id
}
}
const res = await axios(param)
if (session_id !== res.data[0].session_id) {
return 0
} else {
return 1
}
}