Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
周远喜
Admin
Commits
fd2a45c6
Commit
fd2a45c6
authored
Mar 23, 2020
by
周远喜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
路由菜单修改
parent
af2e874e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
83 deletions
+28
-83
index.vue
layouts/basic-layout/index.vue
+1
-1
default.vue
layouts/default.vue
+0
-5
sider.js
menu/sider.js
+21
-2
iview.js
plugins/iview.js
+0
-2
index.js
plugins/request/index.js
+1
-2
index.js
router/index.js
+0
-65
db.js
store/admin/db.js
+5
-6
No files found.
layouts/basic-layout/index.vue
View file @
fd2a45c6
...
...
@@ -36,7 +36,7 @@
</keep-alive>
</div>
</Content>
<
i-copyright
/
>
<
!--
<i-copyright
/>
--
>
</Layout>
<div
v-if=
"isMobile && !hideSider"
>
<Drawer
v-model=
"showDrawer"
placement=
"left"
:closable=
"false"
:class-name=
"drawerClasses"
>
...
...
layouts/default.vue
View file @
fd2a45c6
...
...
@@ -9,7 +9,6 @@ import Setting from "@/setting";
import
{
getHeaderName
,
getMenuSider
,
getSiderSubmenu
}
from
"@/libs/system"
;
// 菜单和路由
import
router
from
'@/router'
;
import
menuHeader
from
'@/menu/header'
;
import
menuSider
from
'@/menu/sider'
;
import
{
frameInRoutes
}
from
'@/router/routes'
;
...
...
@@ -17,9 +16,6 @@ import { frameInRoutes } from '@/router/routes';
export
default
{
components
:
{
MainLayout
},
created
()
{
// const filterMenuSider = getMenuSider(menuSider, "home");
// this.$store.commit("admin/menu/setSider", filterMenuSider);
console
.
warn
(
"menu"
,
menuSider
,
frameInRoutes
,
menuHeader
);
// 处理路由 得到每一级的路由设置
this
.
$store
.
commit
(
"admin/page/init"
,
frameInRoutes
);
// 设置顶栏菜单
...
...
@@ -35,7 +31,6 @@ export default {
console
.
warn
(
"to,from"
,
to
,
from
,
menuSider
);
let
path
=
to
.
matched
[
to
.
matched
.
length
-
1
].
path
;
if
(
!
Setting
.
dynamicSiderMenu
)
{
debugger
let
headerName
=
getHeaderName
(
path
,
menuSider
);
if
(
headerName
===
null
)
{
path
=
to
.
path
;
...
...
menu/sider.js
View file @
fd2a45c6
...
...
@@ -5,6 +5,25 @@ import dashboard from './modules/dashboard';
import
log
from
'./modules/log'
;
export
default
[
dashboard
,
log
dashboard
,
log
,
{
path
:
''
,
title
:
'前端'
,
header
:
'home'
,
icon
:
'md-person'
,
children
:
[{
path
:
'/hello'
,
title
:
'前端1日志'
,
header
:
'home'
,
icon
:
'md-person'
},
{
path
:
'/hello2'
,
title
:
'前端2日志'
,
header
:
'home'
,
icon
:
'md-person'
}
]
}
];
plugins/iview.js
View file @
fd2a45c6
...
...
@@ -7,9 +7,7 @@ import Languages from '@/i18n/locale';
// import '@/libs/iViewPro/iview-pro.css';
import
iViewPro
from
'../iview-pro/src/index.js'
;
import
'@/libs/iview-pro/iview-pro.css'
;
import
'@/styles/index.less'
;
// import '@/libs/iview-pro/iview-pro.css';
// 内置组件
import
iLink
from
'@/components/link'
;
Vue
.
component
(
"iLink"
,
iLink
)
...
...
plugins/request/index.js
View file @
fd2a45c6
import
store
from
'@/store'
;
import
axios
from
'axios'
;
import
util
from
'@/libs/util'
;
import
Setting
from
'@/setting'
;
...
...
@@ -15,7 +14,7 @@ function errorCreate (msg) {
// 记录和显示错误
function
errorLog
(
err
)
{
// 添加到日志
store
.
dispatch
(
'admin/log/push'
,
{
$nuxt
.
$
store
.
dispatch
(
'admin/log/push'
,
{
message
:
'数据请求异常'
,
type
:
'error'
,
meta
:
{
...
...
router/index.js
deleted
100644 → 0
View file @
af2e874e
import
Vue
from
'vue'
;
import
VueRouter
from
'vue-router'
;
import
iView
from
'view-design'
;
import
util
from
'@/libs/util'
import
Setting
from
'@/setting'
;
import
store
from
'@/store/index'
;
// 路由数据
import
routes
from
'./routes'
;
Vue
.
use
(
VueRouter
);
// 导出路由 在 main.js 里使用
const
router
=
new
VueRouter
({
routes
,
mode
:
Setting
.
routerMode
,
base
:
Setting
.
routerBase
});
/**
* 路由拦截
* 权限验证
*/
router
.
beforeEach
((
to
,
from
,
next
)
=>
{
if
(
Setting
.
showProgressBar
)
iView
.
LoadingBar
.
start
();
// 判断是否需要登录才可以进入
if
(
to
.
matched
.
some
(
_
=>
_
.
meta
.
auth
))
{
// 这里依据 token 判断是否登录,可视情况修改
const
token
=
util
.
cookies
.
get
(
'token'
);
if
(
token
&&
token
!==
'undefined'
)
{
next
();
}
else
{
// 没有登录的时候跳转到登录界面
// 携带上登陆成功之后需要跳转的页面完整路径
next
({
name
:
'login'
,
query
:
{
redirect
:
to
.
fullPath
}
});
}
}
else
{
// 不需要身份校验 直接通过
next
();
}
});
router
.
afterEach
(
to
=>
{
if
(
Setting
.
showProgressBar
)
iView
.
LoadingBar
.
finish
();
// 多页控制 打开新的页面
store
.
dispatch
(
'admin/page/open'
,
to
);
// 更改标题
util
.
title
({
title
:
to
.
meta
.
title
});
// 返回页面顶端
window
.
scrollTo
(
0
,
0
);
});
export
default
router
;
store/admin/db.js
View file @
fd2a45c6
...
...
@@ -3,7 +3,6 @@
* 一般情况下,您无需修改此文件
* */
import
util
from
'@/libs/util'
;
import
router
from
'@/router'
;
import
{
cloneDeep
}
from
'lodash'
;
/**
...
...
@@ -128,7 +127,7 @@ export const actions={
return
new
Promise
(
resolve
=>
{
resolve
(
util
.
db
.
get
(
pathInit
({
dbName
:
'database'
,
path
:
`$page.
${
router
.
app
.
$route
[
basis
]}
`
,
path
:
`$page.
${
$nuxt
.
$router
[
basis
]}
`
,
user
,
defaultValue
:
{}
})))
...
...
@@ -147,7 +146,7 @@ export const actions={
return
new
Promise
(
resolve
=>
{
resolve
(
util
.
db
.
get
(
pathInit
({
dbName
:
'database'
,
path
:
`$page.
${
router
.
app
.
$route
[
basis
]}
`
,
path
:
`$page.
${
$nuxt
.
$router
[
basis
]}
`
,
user
,
validator
:
()
=>
false
,
defaultValue
:
{}
...
...
@@ -169,7 +168,7 @@ export const actions={
return
new
Promise
(
resolve
=>
{
resolve
(
util
.
db
.
get
(
pathInit
({
dbName
:
'database'
,
path
:
`$page.
${
router
.
app
.
$route
[
basis
]}
.$data`
,
path
:
`$page.
${
$nuxt
.
$router
[
basis
]}
.$data`
,
user
,
validator
:
()
=>
false
,
defaultValue
:
cloneDeep
(
instance
.
$data
)
...
...
@@ -191,7 +190,7 @@ export const actions={
return
new
Promise
(
resolve
=>
{
resolve
(
cloneDeep
(
util
.
db
.
get
(
pathInit
({
dbName
:
'database'
,
path
:
`$page.
${
router
.
app
.
$route
[
basis
]}
.$data`
,
path
:
`$page.
${
$nuxt
.
$router
[
basis
]}
.$data`
,
user
,
defaultValue
:
cloneDeep
(
instance
.
$data
)
})).
value
()))
...
...
@@ -210,7 +209,7 @@ export const actions={
return
new
Promise
(
resolve
=>
{
resolve
(
util
.
db
.
get
(
pathInit
({
dbName
:
'database'
,
path
:
`$page.
${
router
.
app
.
$route
[
basis
]}
.$data`
,
path
:
`$page.
${
$nuxt
.
$router
[
basis
]}
.$data`
,
user
,
validator
:
()
=>
false
,
defaultValue
:
{}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment