Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcjg-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
202aa77a
authored
2023-03-23 16:39:16 +0800
by
任超
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' into dev
2 parents
7db45342
72c5f279
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
108 additions
and
82 deletions
src/layout/components/Sidebar/sidebarLeft.vue
src/layout/components/Sidebar/sidebarRight.vue
src/layout1/components/Navbar.vue
src/layout1/components/Sidebar/index.vue
src/layout1/components/TagsView/index.vue
src/mixins/login.js
src/permission.js
src/router/index.js
src/store/modules/tagsView.js
src/views/loginsb/index.vue
src/layout/components/Sidebar/sidebarLeft.vue
View file @
202aa77
<!--
* @Description: log
* @Autor: renchao
* @LastEditTime: 2023-03-23 1
4:40:06
* @LastEditTime: 2023-03-23 1
6:29:12
-->
<
template
>
<el-menu
router
:default-active=
"activeMenu"
mode=
"horizontal"
>
<!-- 权限菜单 -->
<sidebar-item
v-for=
"route in permission_routes.slice(
3, 6
)"
:key=
"route.path"
:item=
"route"
<sidebar-item
v-for=
"route in permission_routes.slice(
4, 7
)"
:key=
"route.path"
:item=
"route"
:base-path=
"route.path"
/>
<!-- 菜单全部展示 -->
<!--
<sidebar-item
v-for=
"route in asyncRoutes"
:key=
"route.path"
:item=
"route"
:base-path=
"route.path"
/>
-->
...
...
src/layout/components/Sidebar/sidebarRight.vue
View file @
202aa77
...
...
@@ -2,14 +2,14 @@
* @Author: xiaomiao 1158771342@qq.com
* @Date: 2023-01-10 09:03:06
* @LastEditors: Please set LastEditors
* @LastEditTime: 2023-03-2
2 10:43:26
* @LastEditTime: 2023-03-2
3 16:29:24
* @FilePath: \监管系统\js-web-jianguan\src\layout\components\Sidebar\sidebarRight.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<
template
>
<el-menu
router
:default-active=
"activeMenu"
mode=
"horizontal"
>
<!-- 权限菜单 -->
<sidebar-item
v-for=
"route in permission_routes.slice(
6, 9
)"
:key=
"route.path"
:item=
"route"
<sidebar-item
v-for=
"route in permission_routes.slice(
7, 10
)"
:key=
"route.path"
:item=
"route"
:base-path=
"route.path"
/>
<!-- 菜单全部展示 -->
<!--
<sidebar-item
v-for=
"route in asyncRoutes"
:key=
"route.path"
:item=
"route"
:base-path=
"route.path"
/>
-->
...
...
src/layout1/components/Navbar.vue
View file @
202aa77
...
...
@@ -6,7 +6,7 @@
<h4>
不动产登记上报系统
</h4>
</div>
<div
class=
"right-menu"
>
<el-dropdown
class=
"avatar-container right-menu-item hover-effect"
trigger=
"hover"
@
command=
"handleCommand"
>
<el-dropdown
class=
"avatar-container right-menu-item hover-effect"
trigger=
"hover"
>
<div
class=
"user"
>
{{
userName
}}
<span
@
click=
"onCancel"
>
...
...
src/layout1/components/Sidebar/index.vue
View file @
202aa77
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-
06 16:18:21
* @LastEditTime: 2023-03-
23 16:17:42
-->
<
template
>
<div>
...
...
@@ -19,41 +19,38 @@
</
template
>
<
script
>
import
{
mapGetters
}
from
'vuex'
import
Logo
from
'./Logo'
import
defaultSettings
from
'@/settings'
import
SidebarItem
from
'./SidebarItem'
import
variables
from
'@/styles/variables.scss'
import
{
asyncRoutes
}
from
'@/router'
export
default
{
components
:
{
SidebarItem
,
Logo
},
data
()
{
return
{
title
:
defaultSettings
.
title
import
{
mapGetters
}
from
'vuex'
import
Logo
from
'./Logo'
import
defaultSettings
from
'@/settings'
import
SidebarItem
from
'./SidebarItem'
import
variables
from
'@/styles/variables.scss'
import
{
asyncRoutes
}
from
'@/router'
export
default
{
components
:
{
SidebarItem
,
Logo
},
data
()
{
return
{
title
:
defaultSettings
.
title
}
},
computed
:
{
...
mapGetters
([
'permission_routes'
,
'sidebar'
]),
activeMenu
()
{
const
route
=
this
.
$route
const
{
meta
,
path
}
=
route
if
(
meta
.
activeMenu
)
{
return
meta
.
activeMenu
}
return
path
},
created
()
{
console
.
log
(
this
.
permission_routes
);
},
computed
:
{
...
mapGetters
([
'permission_routes'
,
'sidebar'
]),
activeMenu
()
{
const
route
=
this
.
$route
const
{
meta
,
path
}
=
route
if
(
meta
.
activeMenu
)
{
return
meta
.
activeMenu
}
return
path
},
variables
()
{
return
variables
},
asyncRoutes
()
{
return
asyncRoutes
}
variables
()
{
return
variables
},
mounted
()
{
asyncRoutes
()
{
return
asyncRoutes
}
},
mounted
()
{
console
.
log
(
this
.
permission_routes
,
'permission_routespermission_routes'
);
}
}
</
script
>
...
...
src/layout1/components/TagsView/index.vue
View file @
202aa77
<
template
>
<div
id=
"tags-view-container"
class=
"tags-view-container"
>
<scroll-pane
ref=
"scrollPane"
class=
"tags-view-wrapper"
@
scroll=
"handleScroll"
>
<router-link
v-for=
"tag in visitedViews"
ref=
"tag"
:key=
"tag.path"
:class=
"isActive(tag)
?'active':
''"
<router-link
v-for=
"tag in visitedViews"
ref=
"tag"
:key=
"tag.path"
:class=
"isActive(tag)
? 'active' :
''"
:to=
"
{ path: tag.path, query: tag.query, fullPath: tag.fullPath }" tag="span" class="tags-view-item"
@click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''"
@contextmenu.prevent.native="openMenu(tag,$event)">
@click.middle.native="!isAffix(tag) ? closeSelectedTag(tag) : ''" @contextmenu.prevent.native="openMenu(tag, $event)">
{{
tag
.
title
}}
<span
v-if=
"!isAffix(tag)"
class=
"el-icon-close"
@
click
.
prevent
.
stop=
"closeSelectedTag(tag)"
/>
</router-link>
</scroll-pane>
<ul
v-show=
"visible"
:style=
"
{
left:left+'px',top:top+'px'
}" class="contextmenu">
<ul
v-show=
"visible"
:style=
"
{
left: left + 'px', top: top + 'px'
}" class="contextmenu">
<li
@
click=
"refreshSelectedTag(selectedTag)"
>
Refresh
</li>
<li
v-if=
"!isAffix(selectedTag)"
@
click=
"closeSelectedTag(selectedTag)"
>
Close
</li>
<li
@
click=
"closeOthersTags"
>
Close Others
</li>
...
...
@@ -200,6 +199,7 @@ export default {
padding-top
:
3px
;
box-shadow
:
0
1px
3px
0
rgba
(
0
,
0
,
0
,
.12
),
0
0
3px
0
rgba
(
0
,
0
,
0
,
.04
);
margin-bottom
:
5px
;
.tags-view-wrapper
{
.tags-view-item
{
display
:
inline-block
;
...
...
src/mixins/login.js
0 → 100644
View file @
202aa77
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-23 14:47:38
*/
let
mixin
=
{
methods
:
{
}
}
export
default
mixin
\ No newline at end of file
src/permission.js
View file @
202aa77
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-03-23 1
5:17:36
* @LastEditTime: 2023-03-23 1
6:37:20
*/
import
Vue
from
'vue'
import
router
from
"./router"
;
...
...
@@ -26,36 +26,46 @@ router.beforeEach(async (to, from, next) => {
next
();
}
else
{
let
code
=
Vue
.
prototype
.
BASE_API
.
THEME
==
"sb"
?
"BDCSBPT"
:
"BDCJGPT"
//请求用户信息
if
(
!
hasUser
)
{
store
.
dispatch
(
"user/getUserInfo"
);
}
if
(
hasAddRoute
)
{
next
();
}
else
{
//请求菜单
const
{
result
:
getMenuData
}
=
(
await
getMenuInfo
(
code
))
||
[];
const
accessRoutes
=
await
store
.
dispatch
(
"permission/generateRoutes"
,
getMenuData
);
router
.
addRoutes
([
...
accessRoutes
,
{
path
:
"*"
,
redirect
:
"/404"
,
hidden
:
true
}
]);
const
routeTo
=
Cookies
.
get
(
"routerTo"
);
if
(
!
hasAddDict
)
{
await
store
.
dispatch
(
"dict/generateDic"
);
//判断token是否存在
const
hasToken
=
localStorage
.
getItem
(
"token"
);
if
(
hasToken
)
{
//请求用户信息
if
(
!
hasUser
)
{
store
.
dispatch
(
"user/getUserInfo"
);
}
if
(
routeTo
&&
routeTo
!==
"/"
&&
routeTo
!==
"/sb"
&&
routeTo
!==
"/jg"
)
{
next
({
...
to
,
replace
:
true
});
}
else
{
if
(
hasAddRoute
)
{
next
();
}
else
{
//请求菜单
const
{
result
:
getMenuData
}
=
(
await
getMenuInfo
(
code
))
||
[];
const
accessRoutes
=
await
store
.
dispatch
(
"permission/generateRoutes"
,
getMenuData
);
router
.
addRoutes
([
...
accessRoutes
,
{
path
:
"*"
,
redirect
:
"/404"
,
hidden
:
true
},
]);
const
routeTo
=
Cookies
.
get
(
"routerTo"
);
if
(
!
hasAddDict
)
{
await
store
.
dispatch
(
"dict/generateDic"
);
}
if
(
routeTo
&&
routeTo
!==
"/"
&&
routeTo
!==
"/sb"
&&
routeTo
!==
"/jg"
)
{
next
({
...
to
,
replace
:
true
});
}
else
{
next
();
}
}
}
else
{
if
(
code
==
'BDCSBPT'
)
{
next
(
'/sb'
);
}
else
{
next
(
'/jg'
);
}
}
}
NProgress
.
done
()
})
NProgress
.
done
()
;
})
;
router
.
afterEach
((
to
)
=>
{
// 解决刷新页面报404问题
Cookies
.
set
(
"routerTo"
,
to
.
fullPath
);
...
...
src/router/index.js
View file @
202aa77
...
...
@@ -29,15 +29,24 @@ export const constantRoutes = [
name
:
"loginsb"
,
component
:
()
=>
import
(
"@/views/loginsb/index.vue"
),
},
// 监管首页
{
path
:
'/'
,
redirect
:
to
=>
{
if
(
Vue
.
prototype
.
BASE_API
.
THEME
==
'jg'
)
{
return
{
path
:
'/jg'
}
}
else
{
return
{
path
:
'/sb'
}
}
},
},
// 监管首页
{
path
:
'/home'
,
component
:
Layout
,
redirect
:
'/sb'
,
meta
:
{
title
:
'首页'
},
children
:
[
{
path
:
'
home
'
,
path
:
''
,
component
:
()
=>
import
(
'@/views/home/index'
),
name
:
'home'
,
meta
:
{
title
:
'工作台'
,
icon
:
'workbench'
,
affix
:
true
}
...
...
src/store/modules/tagsView.js
View file @
202aa77
const
state
=
{
visitedViews
:
[{
'fullPath'
:
"/home"
,
'meta'
:
{
affix
:
true
},
'name'
:
"Dashboard"
,
'path'
:
"/home"
,
'title'
:
"工作台"
}]
visitedViews
:
[]
}
const
mutations
=
{
ADD_VISITED_VIEW
:
(
state
,
view
)
=>
{
if
(
state
.
visitedViews
.
some
(
v
=>
v
.
path
===
view
.
path
))
return
...
...
src/views/loginsb/index.vue
View file @
202aa77
...
...
@@ -39,7 +39,6 @@
<
script
>
import
{
getMenuInfo
}
from
"@/api/user"
;
import
{
loginIn
}
from
"@/api/login.js"
;
import
{
api
,
getAction
}
from
"@/api/manageApi"
;
export
default
{
name
:
"sbLogin"
,
data
()
{
...
...
@@ -114,6 +113,14 @@ export default {
const
{
result
:
getMenuData
}
=
(
await
getMenuInfo
(
code
))
||
[];
let
path1
=
JSON
.
parse
(
getMenuData
[
0
].
metadata
)?.
path
+
'/'
+
JSON
.
parse
(
getMenuData
[
0
].
children
[
0
].
metadata
)?.
path
//登录成功后需判断有无重定向,没有重定向则跳转首页
const
accessRoutes
=
await
this
.
$store
.
dispatch
(
"permission/generateRoutes"
,
getMenuData
);
this
.
$router
.
addRoutes
([
...
accessRoutes
,
{
path
:
"*"
,
redirect
:
"/404"
,
hidden
:
true
},
]);
this
.
$router
.
replace
(
this
.
$route
.
query
.
redirect
||
path1
);
}
}
...
...
Please
register
or
sign in
to post a comment