屏蔽登录

This commit is contained in:
Vergil
2020-04-14 09:03:39 +08:00
parent 958997fa36
commit 647d6c99cb

View File

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