style:上报修改
Showing
2 changed files
with
29 additions
and
29 deletions
1 | <!-- | 1 | <!-- |
2 | * @Description: 引入配置文件 | 2 | * @Description: 引入配置文件 |
3 | * @Autor: renchao | 3 | * @Autor: renchao |
4 | * @LastEditTime: 2023-06-20 11:24:04 | 4 | * @LastEditTime: 2023-06-26 10:22:28 |
5 | --> | 5 | --> |
6 | <!DOCTYPE html> | 6 | <!DOCTYPE html> |
7 | <html> | 7 | <html> |
... | @@ -22,7 +22,7 @@ | ... | @@ -22,7 +22,7 @@ |
22 | // 是否微服务模式,业务系统根据需要读取 | 22 | // 是否微服务模式,业务系统根据需要读取 |
23 | cloudEnable: false, | 23 | cloudEnable: false, |
24 | baseUrl: location.origin || location.protocol + '//' + location.host, | 24 | baseUrl: location.origin || location.protocol + '//' + location.host, |
25 | // 是否启用单点登录 | 25 | // 是否启用cas登录页面 |
26 | casEnable: false, | 26 | casEnable: false, |
27 | // cas 基地址 | 27 | // cas 基地址 |
28 | casBaseURL: 'http://192.168.2.38/cas', | 28 | casBaseURL: 'http://192.168.2.38/cas', | ... | ... |
1 | /* | 1 | /* |
2 | * @Description: | 2 | * @Description: |
3 | * @Autor: renchao | 3 | * @Autor: renchao |
4 | * @LastEditTime: 2023-06-20 11:28:11 | 4 | * @LastEditTime: 2023-06-26 10:18:09 |
5 | */ | 5 | */ |
6 | import Vue from 'vue' | 6 | import Vue from 'vue' |
7 | import axios from 'axios' | 7 | import axios from 'axios' |
... | @@ -13,7 +13,7 @@ import "nprogress/nprogress.css"; // progress bar style | ... | @@ -13,7 +13,7 @@ import "nprogress/nprogress.css"; // progress bar style |
13 | import getPageTitle from "@/utils/get-page-title"; | 13 | import getPageTitle from "@/utils/get-page-title"; |
14 | import getTheme from "@/utils/theme"; | 14 | import getTheme from "@/utils/theme"; |
15 | import Cookies from "js-cookie"; | 15 | import Cookies from "js-cookie"; |
16 | import {getToken, getUrlParam, setToken} from "@/utils/util"; | 16 | import { getToken, getUrlParam, setToken } from "@/utils/util"; |
17 | 17 | ||
18 | NProgress.configure({ showSpinner: false }); | 18 | NProgress.configure({ showSpinner: false }); |
19 | 19 | ||
... | @@ -27,7 +27,7 @@ router.beforeEach(async (to, from, next) => { | ... | @@ -27,7 +27,7 @@ router.beforeEach(async (to, from, next) => { |
27 | // cas操作 | 27 | // cas操作 |
28 | const token = getToken() | 28 | const token = getToken() |
29 | let locationUrl = window.location.origin + window.location.pathname; | 29 | let locationUrl = window.location.origin + window.location.pathname; |
30 | function casValidate (ticket){ | 30 | function casValidate (ticket) { |
31 | axios.get(window._config.services.management + "/management/cas/validate", { | 31 | axios.get(window._config.services.management + "/management/cas/validate", { |
32 | params: { | 32 | params: { |
33 | ticket: ticket, | 33 | ticket: ticket, |
... | @@ -35,10 +35,10 @@ router.beforeEach(async (to, from, next) => { | ... | @@ -35,10 +35,10 @@ router.beforeEach(async (to, from, next) => { |
35 | }, | 35 | }, |
36 | }).then(async (res) => { | 36 | }).then(async (res) => { |
37 | if (res.data.status === 1) { | 37 | if (res.data.status === 1) { |
38 | setToken(res.data.content.accessToken) | 38 | setToken(res.data.content.accessToken) |
39 | window.location.href = localStorage.getItem('sjsb-location') + '#' + localStorage.getItem('hash') | 39 | window.location.href = localStorage.getItem('sjsb-location') + '#' + localStorage.getItem('hash') |
40 | } else { | 40 | } else { |
41 | alert(res.data.message) | 41 | alert(res.data.message) |
42 | } | 42 | } |
43 | }).catch((e) => { | 43 | }).catch((e) => { |
44 | console.log(e); | 44 | console.log(e); |
... | @@ -92,35 +92,35 @@ router.beforeEach(async (to, from, next) => { | ... | @@ -92,35 +92,35 @@ router.beforeEach(async (to, from, next) => { |
92 | if (ticket) { | 92 | if (ticket) { |
93 | casValidate(ticket) | 93 | casValidate(ticket) |
94 | } else { | 94 | } else { |
95 | if (to.path === '/login') { | 95 | if (to.path === '/login') { |
96 | if (getUrlParam('_flag') === '1') { | 96 | if (getUrlParam('_flag') === '1') { |
97 | next(); | 97 | next(); |
98 | return | 98 | return |
99 | } else { | 99 | } else { |
100 | //todo: loginUrl 需要业务系统根据登录页面路由地址获取,这里只是简写 | 100 | //todo: loginUrl 需要业务系统根据登录页面路由地址获取,这里只是简写 |
101 | localStorage.setItem('sjsb-location',locationUrl) | 101 | localStorage.setItem('sjsb-location', locationUrl) |
102 | localStorage.setItem('hash',to.fullPath) | 102 | localStorage.setItem('hash', to.fullPath) |
103 | window.location.href = window._config.services.management + `/management/cas/status?loginUrl=${window._config.baseUrl}/sjsb/&hash=/login&` | 103 | window.location.href = window._config.services.management + `/management/cas/status?loginUrl=${window._config.baseUrl}/sjsb/&hash=/login&` |
104 | return | 104 | return |
105 | } | ||
106 | } | 105 | } |
107 | localStorage.setItem('sjsb-location',locationUrl) | 106 | } |
108 | localStorage.setItem('hash',to.fullPath) | 107 | localStorage.setItem('sjsb-location', locationUrl) |
109 | //todo: loginUrl 需要业务系统根据登录页面路由地址获取,这里只是简写 | 108 | localStorage.setItem('hash', to.fullPath) |
110 | window.location.href = window._config.services.management + `/management/cas/status?loginUrl=${window._config.baseUrl}/sjsb/&hash=/login` | 109 | //todo: loginUrl 需要业务系统根据登录页面路由地址获取,这里只是简写 |
110 | window.location.href = window._config.services.management + `/management/cas/status?loginUrl=${window._config.baseUrl}/sjsb/&hash=/login` | ||
111 | } | 111 | } |
112 | }else{ | 112 | } else { |
113 | if (to.path === '/login') { | 113 | if (to.path === '/login') { |
114 | const redirectUrl = getUrlParam('redirectUrl'); | 114 | const redirectUrl = getUrlParam('redirectUrl'); |
115 | if (redirectUrl && redirectUrl !== '') { | 115 | if (redirectUrl && redirectUrl !== '') { |
116 | window.location.href = redirectUrl | 116 | window.location.href = redirectUrl |
117 | return | 117 | return |
118 | } else { | 118 | } else { |
119 | next('/'); | 119 | permission() |
120 | return | 120 | next('/'); |
121 | return | ||
121 | } | 122 | } |
122 | } | 123 | } |
123 | permission() | ||
124 | } | 124 | } |
125 | } | 125 | } |
126 | NProgress.done() | 126 | NProgress.done() | ... | ... |
-
Please register or sign in to post a comment