Browse Source

免登录

master
bianyaqi 1 month ago
parent
commit
12d715e946
  1. 2
      .env.development
  2. 4
      .env.production
  3. 2
      package.json
  4. 1
      public/index.html
  5. 49
      src/page-subspecialty/router/index.js

2
.env.development

@ -2,6 +2,8 @@ NODE_ENV=development
VUE_APP_NODE_ENV=dev
VUE_APP_LOGIN_URL='http://47.110.224.240:8036/xiangan-crf'
# 免登录链接
VUE_APP_SINGLE_URL='https://10.80.3.194:8002/oauth/authorize'
# pacs浏览器
VUE_APP_PACS_URL='http://192.168.0.85:8001'

4
.env.production

@ -1,8 +1,10 @@
NODE_ENV=production
VUE_APP_NODE_ENV=prod
# 苏州正式环境
# 翔安正式环境
VUE_APP_LOGIN_URL='http://10.80.5.32:8031/xiangan-crf'
# 翔安免登录链接
VUE_APP_SINGLE_URL='https://10.80.3.194:8002/oauth/authorize'
# pacs浏览器
VUE_APP_PACS_URL='http://10.80.5.32:8026'

2
package.json

@ -33,7 +33,7 @@
"@types/clipboard": "^2.0.7",
"animejs": "^3.2.1",
"axios": "^0.21.1",
"clipboard": "^2.0.11",
"clipboard": "^2.0.6",
"core-js": "^3.31.1",
"cornerstone-core": "^2.3.0",
"cornerstone-math": "^0.1.10",

1
public/index.html

@ -5,7 +5,6 @@
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="shortcut icon" href="<%= BASE_URL %>favicon.ico">
<script type="text/javascript" src="./static/js/js-NSV.js"></script>
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script>
<!-- 站点配置 -->
<script>
window.SITE_CONFIG = {};

49
src/page-subspecialty/router/index.js

@ -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) {

Loading…
Cancel
Save