Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcdj-web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
6642bd08
authored
2023-05-31 15:58:03 +0800
by
renchao@pashanhoo.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
style:集成cas完成
1 parent
2fca351e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
54 additions
and
32 deletions
public/config.json
public/configBase.json
public/configT.json
public/index.html
src/layout/components/Navbar.vue
src/permission.js
src/utils/request.js
vue.config.js
public/config.json
View file @
6642bd0
{
"TITLE"
:
"不动产登记系统"
,
"SERVERAPI"
:
"/bdcdj"
"SERVERAPI"
:
"/bdcdj"
,
"ip"
:
"http://192.168.2.38"
}
\ No newline at end of file
...
...
public/configBase.json
View file @
6642bd0
{
"TITLE"
:
"不动产登记系统"
,
"SERVERAPI"
:
"/bdcdj"
"SERVERAPI"
:
"/bdcdj"
,
"ip"
:
"http://192.168.2.38"
}
\ No newline at end of file
...
...
public/configT.json
View file @
6642bd0
{
"TITLE"
:
"不动产登记系统"
,
"SERVERAPI"
:
"service-bdcdj-th"
"SERVERAPI"
:
"service-bdcdj-th"
,
"ip"
:
"http://192.168.2.38"
}
\ No newline at end of file
...
...
public/index.html
View file @
6642bd0
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-05-
26 16:57:47
* @LastEditTime: 2023-05-
31 15:33:18
-->
<!DOCTYPE html>
<html>
...
...
@@ -18,6 +18,7 @@
</title>
</head>
<script>
window
.
baseUrl
=
location
.
origin
||
location
.
protocol
+
'//'
+
location
.
host
window
.
_config
=
{
// 是否微服务模式,业务系统根据需要读取
cloudEnable
:
false
,
...
...
src/layout/components/Navbar.vue
View file @
6642bd0
...
...
@@ -27,6 +27,7 @@
</div>
</
template
>
<
script
>
import
axios
from
'axios'
import
{
mapGetters
}
from
'vuex'
import
NoticeBar
from
'@/components/NoticeBar/index'
import
{
...
...
@@ -72,9 +73,20 @@
})
},
logout
()
{
const
url
=
baseUrl
+
"/sso-logout?redirect_uri="
+
baseUrl
+
"/bdcdj"
;
window
.
open
(
url
,
"_self"
);
sessionStorage
.
removeItem
(
"navList"
);
axios
.
post
(
this
.
BASE_API
.
ip
+
"/management/logout"
).
then
(()
=>
{
localStorage
.
removeItem
(
'token'
)
if
(
window
.
_config
.
casEnable
)
{
window
.
location
.
href
=
window
.
_config
.
casBaseURL
+
'/logout?service='
+
encodeURIComponent
(
window
.
location
.
href
);
}
else
{
this
.
$router
.
push
({
path
:
'/login'
,
replace
:
true
,
query
:
{
redirect
:
router
.
currentRoute
.
value
.
fullPath
}
})
}
})
},
themeChange
(
val
)
{
...
...
src/permission.js
View file @
6642bd0
/*
* @Description: 项目权限
* @Autor: renchao
* @LastEditTime: 2023-05-3
0 16:27:26
* @LastEditTime: 2023-05-3
1 15:55:14
*/
import
Vue
from
'vue'
import
router
from
'./router'
...
...
@@ -36,7 +36,7 @@ router.beforeEach(async (to, from, next) => {
if
(
!
token
)
{
let
ticket
=
getUrlParam
(
'ticket'
);
if
(
ticket
)
{
axios
.
get
(
"http://192.168.2.38
/management/cas/validate"
,
{
axios
.
get
(
Vue
.
prototype
.
BASE_API
.
ip
+
"
/management/cas/validate"
,
{
params
:
{
'ticket'
:
ticket
,
'service'
:
locationUrl
...
...
@@ -44,26 +44,6 @@ router.beforeEach(async (to, from, next) => {
}).
then
(
async
(
res
)
=>
{
localStorage
.
setItem
(
'token'
,
res
.
data
.
content
.
accessToken
)
window
.
location
.
href
=
localStorage
.
getItem
(
'location'
)
// cas
if
(
!
hasAddDict
)
{
store
.
dispatch
(
'dict/generateDic'
)
}
if
(
hasAddRoute
)
{
next
()
// next({ ...to, replace: true })
}
else
{
const
{
result
:
getMenuData
}
=
await
getMenuInfo
()
const
accessRoutes
=
await
store
.
dispatch
(
'permission/generateRoutes'
,
getMenuData
)
// 获取用户信息
await
store
.
dispatch
(
'user/getUserInfo'
)
router
.
addRoutes
([...
accessRoutes
,
{
path
:
'*'
,
redirect
:
'/404'
,
hidden
:
true
}])
const
routeTo
=
Cookies
.
get
(
'routerTo'
)
if
(
routeTo
&&
routeTo
!==
'/'
)
{
next
({
...
to
,
replace
:
true
})
}
else
{
next
(
'/home'
)
}
}
}).
catch
(
e
=>
{
console
.
log
(
e
)
...
...
@@ -71,9 +51,31 @@ router.beforeEach(async (to, from, next) => {
}
else
{
localStorage
.
setItem
(
"location"
,
window
.
location
.
href
)
window
.
location
.
href
=
window
.
_config
.
casBaseURL
+
'/login?service='
+
encodeURIComponent
(
locationUrl
);
permission
()
}
}
else
{
next
()
permission
()
}
async
function
permission
()
{
if
(
!
hasAddDict
)
{
store
.
dispatch
(
'dict/generateDic'
)
}
if
(
hasAddRoute
)
{
next
()
// next({ ...to, replace: true })
}
else
{
const
{
result
:
getMenuData
}
=
await
getMenuInfo
()
const
accessRoutes
=
await
store
.
dispatch
(
'permission/generateRoutes'
,
getMenuData
)
// 获取用户信息
await
store
.
dispatch
(
'user/getUserInfo'
)
router
.
addRoutes
([...
accessRoutes
,
{
path
:
'*'
,
redirect
:
'/404'
,
hidden
:
true
}])
const
routeTo
=
Cookies
.
get
(
'routerTo'
)
if
(
routeTo
&&
routeTo
!==
'/'
)
{
next
({
...
to
,
replace
:
true
})
}
else
{
next
(
'/home'
)
}
}
}
}
else
{
if
(
!
token
)
{
...
...
src/utils/request.js
View file @
6642bd0
/*
* @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器
* @Autor: renchao
* @LastEditTime: 2023-05-
26 16:52:25
* @LastEditTime: 2023-05-
31 15:30:02
*/
import
axios
from
'axios'
import
{
Message
}
from
'element-ui'
...
...
@@ -9,6 +9,10 @@ import { endLoadingSubCount } from './requestLoading'
// create an axios instance
const
service
=
axios
.
create
({
baseURL
:
process
.
env
.
NODE_ENV
==
"development"
?
process
.
env
.
VUE_APP_BASE_API
:
window
.
baseUrl
+
"/"
,
withCredentials
:
true
,
//是否允许跨域
headers
:
{
'Content-Type'
:
'application/json; charset=utf-8'
...
...
vue.config.js
View file @
6642bd0
...
...
@@ -18,7 +18,7 @@ module.exports = {
* Detail: https://cli.vuejs.org/config/#publicpath
*/
// 加载资源的路径
publicPath
:
'/
bdc
dj/'
,
publicPath
:
'/dj/'
,
// 设置项目打包生成的文件的存储目录,可以是静态路径也可以是相对路径
outputDir
:
'dist'
,
// 设置放置打包生成的静态资源 (js、css、img、fonts) 的目录
...
...
Please
register
or
sign in
to post a comment