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
b95b5bf4
authored
2023-05-30 16:32:57 +0800
by
renchao@pashanhoo.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
style:cas完成
1 parent
5770ee1d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
34 deletions
public/config.json
src/main.js
src/permission.js
src/utils/operation.js
public/config.json
View file @
b95b5bf
{
"TITLE"
:
"不动产登记系统"
,
"SERVERAPI"
:
"/
bdc
dj"
"SERVERAPI"
:
"/dj"
}
\ No newline at end of file
...
...
src/main.js
View file @
b95b5bf
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-05-
06 09:14:47
* @LastEditTime: 2023-05-
30 15:28:52
*/
import
Vue
from
'vue'
import
App
from
'./App'
...
...
@@ -60,7 +60,7 @@ Object.keys(filters).forEach(key => {
})
Vue
.
config
.
productionTip
=
false
axios
.
get
(
"/
bdcdj/
config.json"
)
axios
.
get
(
"/config.json"
)
.
then
((
res
)
=>
{
Vue
.
prototype
.
BASE_API
=
res
.
data
localStorage
.
setItem
(
'ApiUrl'
,
JSON
.
stringify
(
res
.
data
));
...
...
src/permission.js
View file @
b95b5bf
/*
* @Description: 项目权限
* @Autor: renchao
* @LastEditTime: 2023-05-
26 17:17:34
* @LastEditTime: 2023-05-
30 16:27:26
*/
import
Vue
from
'vue'
import
router
from
'./router'
...
...
@@ -16,8 +16,13 @@ import Cookies from 'js-cookie'
NProgress
.
configure
({
showSpinner
:
false
})
// NProgress Configuration
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
Vue
.
prototype
.
$currentRoute
=
to
NProgress
.
start
()
document
.
title
=
getPageTitle
(
to
.
meta
.
title
)
let
hasAddDict
=
store
.
state
.
dict
.
addDict
let
hasAddRoute
=
store
.
state
.
permission
.
addRoutes
// cas操作
const
token
=
localStorage
.
getItem
(
"token"
)
debugger
if
(
to
.
path
===
'/login'
)
{
if
(
token
)
{
next
(
'/'
)
...
...
@@ -36,9 +41,30 @@ router.beforeEach(async (to, from, next) => {
'ticket'
:
ticket
,
'service'
:
locationUrl
}
}).
then
((
res
)
=>
{
localStorage
.
setItem
(
'token'
,
res
.
data
.
content
.
id
)
}).
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
)
})
...
...
@@ -66,32 +92,7 @@ router.beforeEach(async (to, from, next) => {
}
next
()
}
// Vue.prototype.$currentRoute = to
// NProgress.start()
// document.title = getPageTitle(to.meta.title)
// let hasAddDict = store.state.dict.addDict
// let hasAddRoute = store.state.permission.addRoutes
// 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')
// }
// }
// NProgress.done()
NProgress
.
done
()
})
router
.
afterEach
(
to
=>
{
// 解决刷新页面报404问题
...
...
src/utils/operation.js
View file @
b95b5bf
...
...
@@ -124,7 +124,8 @@ export function getUrlParam (paraName) {
arr
=
arrPara
[
i
].
split
(
'='
);
if
(
arr
!=
null
&&
arr
[
0
]
===
paraName
)
{
return
arr
[
1
];
const
index
=
arr
[
1
].
indexOf
(
"#"
);
return
arr
[
1
].
substring
(
0
,
index
);
}
}
return
''
;
...
...
Please
register
or
sign in
to post a comment