|
|
@ -2,7 +2,6 @@ import Vue from 'vue' |
|
|
|
import Router from 'vue-router' |
|
|
|
import http from '../utils/request' |
|
|
|
import { isURL } from '@/utils/validate' |
|
|
|
import Cookies from 'js-cookie' |
|
|
|
|
|
|
|
Vue.use(Router) |
|
|
|
|
|
|
@ -167,25 +166,10 @@ router.beforeEach((to, from, next) => { |
|
|
|
loginByDocId(to.query.doctorId, next, to.fullPath) |
|
|
|
} else if (to.name === 'outpatientManagement' && to.query.userIdNumber) { |
|
|
|
loginByUserId(to.query.userIdNumber, next, to) |
|
|
|
} else if (to.name === 'outpatientManagement' && to.query.isSingle) { |
|
|
|
singleLogin(to.query, next, to) |
|
|
|
} else { |
|
|
|
if (to.name === 'detail') return |
|
|
|
// 获取字典列表, 添加并全局变量保存
|
|
|
|
// http.get('/sys/dict/type/all').then(({ data: res }) => {
|
|
|
|
// if (res.code !== 0) {
|
|
|
|
// return
|
|
|
|
// }
|
|
|
|
// window.SITE_CONFIG['dictList'] = res.data
|
|
|
|
// }).catch(() => {})
|
|
|
|
// 获取左侧菜单列表,添加并全局变量保存
|
|
|
|
http.get('/sys/menu/nav').then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|
Vue.prototype.$message.error(res.msg) |
|
|
|
return next({ name: 'login' }) |
|
|
|
} |
|
|
|
window.SITE_CONFIG['menuList'] = res.data |
|
|
|
}).catch(() => { |
|
|
|
return next({ name: 'login' }) |
|
|
|
}) |
|
|
|
// 获取菜单管理菜单列表,并添加动态路由
|
|
|
|
http.get('/sys/menu/nav', { |
|
|
|
params: { |
|
|
@ -196,7 +180,7 @@ router.beforeEach((to, from, next) => { |
|
|
|
Vue.prototype.$message.error(res.msg) |
|
|
|
return next({ name: 'login' }) |
|
|
|
} |
|
|
|
// window.SITE_CONFIG['menuList'] = res.data
|
|
|
|
window.SITE_CONFIG['menuList'] = res.data |
|
|
|
const menuListChild = res.data.filter(item => item.children.length > 0) |
|
|
|
fnAddDynamicMenuRoutes(JSON.parse(JSON.stringify(res.data)), menuListChild.length) |
|
|
|
next({ ...to, replace: true }) |
|
|
@ -205,6 +189,33 @@ router.beforeEach((to, from, next) => { |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
// 免登录
|
|
|
|
function singleLogin(query, next) { |
|
|
|
if (query.code) { |
|
|
|
http.get('/singleLogin', { |
|
|
|
params: { |
|
|
|
code: query.code |
|
|
|
} |
|
|
|
}).then(res => { |
|
|
|
if (res.data.code !== 0) { |
|
|
|
return Vue.prototype.$message.error(res.data.msg) |
|
|
|
} |
|
|
|
window.sessionStorage.setItem('xa-token', res.data.data.token) |
|
|
|
window.sessionStorage.setItem('qg-userData', JSON.stringify(res.data.data.currentUser)) |
|
|
|
getNavList(next) |
|
|
|
muneList(next) |
|
|
|
return next() |
|
|
|
}) |
|
|
|
} else { |
|
|
|
const client_id = '3y6H35013m7v' |
|
|
|
const redirect_uri = encodeURIComponent('http://10.80.5.32:8031/outpatientManagement') |
|
|
|
console.log(redirect_uri) |
|
|
|
const href = `${process.env.VUE_APP_SINGLE_URL}?response_type=code&client_id=${client_id}&scope=openid&redirect_uri=${redirect_uri}` |
|
|
|
window.location.href = href |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function getNavList(next) { |
|
|
|
http.get('/sys/menu/nav').then(({ data: res }) => { |
|
|
|
if (res.code !== 0) { |
|
|
|