Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Smart_School
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
张伯涛
Smart_School
Commits
c4a5c024
Commit
c4a5c024
authored
Mar 03, 2023
by
YangAo
🇨🇳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
路由配置 信息整合 样式小修改
parent
9a30bec5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
29 deletions
+69
-29
Item.vue
src/layout/Second/Sidebar/Item.vue
+4
-0
index.vue
src/layout/Second/Sidebar/index.vue
+2
-23
index.js
src/router/index.js
+7
-3
menu.js
src/utils/menu.js
+36
-2
index.vue
src/views/ProductIntroduction/index.vue
+1
-1
index.vue
src/views/index/index.vue
+19
-0
No files found.
src/layout/Second/Sidebar/Item.vue
View file @
c4a5c024
...
@@ -49,6 +49,10 @@ export default {
...
@@ -49,6 +49,10 @@ export default {
&
:hover
{
&
:hover
{
background
:
transparent
!
important
;
background
:
transparent
!
important
;
color
:
#387DF7
!
important
;
.el-submenu__icon-arrow
{
color
:
#387DF7
;
}
}
}
&
>
.svg-icon
{
&
>
.svg-icon
{
...
...
src/layout/Second/Sidebar/index.vue
View file @
c4a5c024
...
@@ -19,9 +19,8 @@
...
@@ -19,9 +19,8 @@
<
script
>
<
script
>
import
{
join
}
from
"path"
;
import
Item
from
"@/layout/Second/Sidebar/Item"
;
import
Item
from
"@/layout/Second/Sidebar/Item"
;
import
clone
from
"clone
"
;
import
{
initMenuItemList
}
from
"@/utils/menu
"
;
export
default
{
export
default
{
name
:
"Sidebar"
,
name
:
"Sidebar"
,
...
@@ -58,27 +57,7 @@ export default {
...
@@ -58,27 +57,7 @@ export default {
}
}
},
},
methods
:
{
methods
:
{
/**
initMenuItemList
* 对菜单列表进行初始化, 对路径进行处理, 非斜杠开头的路径将会与父路径进行拼接, 第一层的父路径为斜杠.
* @param menuItemList 原始菜单列表
* @param basePath 前缀路径
*/
initMenuItemList
(
menuItemList
,
basePath
=
"/"
)
{
return
menuItemList
.
map
(
item
=>
{
item
=
clone
(
item
);
// 判断是否以basePath开头
if
(
!
new
RegExp
(
`^(
${
basePath
}
|/)`
).
test
(
item
.
path
))
{
// 非法开头则对基于basePath进行拼接
item
.
path
=
join
(
basePath
,
item
.
path
);
}
// 如果有子菜单递归进行处理
if
(
Array
.
isArray
(
item
.
children
)
&&
item
.
children
.
length
>
0
)
{
item
.
children
=
this
.
initMenuItemList
(
item
.
children
,
item
.
path
);
}
// 返回处理结果
return
item
;
});
}
}
}
};
};
</
script
>
</
script
>
...
...
src/router/index.js
View file @
c4a5c024
import
Vue
from
"vue"
;
import
Vue
from
"vue"
;
import
VueRouter
from
"vue-router"
;
import
VueRouter
from
"vue-router"
;
import
{
menuItemList
,
prefixBasePath
}
from
"@/
views/ProductIntroduction/menuInfo
"
;
import
{
menuItemList
,
prefixBasePath
}
from
"@/
utils/menu
"
;
Vue
.
use
(
VueRouter
);
Vue
.
use
(
VueRouter
);
...
@@ -16,9 +16,13 @@ export default new VueRouter({
...
@@ -16,9 +16,13 @@ export default new VueRouter({
component
:
_
=>
import
(
"@/views/ProductIntroduction"
)
component
:
_
=>
import
(
"@/views/ProductIntroduction"
)
},
},
{
{
path
:
"/second
/index
"
,
path
:
"/second"
,
component
:
_
=>
import
(
"@/layout/Second"
),
component
:
_
=>
import
(
"@/layout/Second"
),
props
:
{
route
:
true
,
menuItemList
,
basePath
:
prefixBasePath
}
props
:
{
route
:
true
,
menuItemList
,
basePath
:
prefixBasePath
},
children
:
[{
path
:
'index'
,
component
:
_
=>
import
(
"@/views/index"
)
}]
},
},
{
{
path
:
"/"
,
// 程序启动默认路由
path
:
"/"
,
// 程序启动默认路由
...
...
src/
views/ProductIntroduction/menuInfo
.js
→
src/
utils/menu
.js
View file @
c4a5c024
import
clone
from
"clone"
;
import
{
join
}
from
"path"
;
/**
* 对菜单列表进行初始化, 对路径进行处理, 非斜杠开头的路径将会与父路径进行拼接, 第一层的父路径为斜杠.
* @param menuItemList 原始菜单列表
* @param basePath 前缀路径
*/
export
function
initMenuItemList
(
menuItemList
,
basePath
=
"/"
)
{
return
menuItemList
.
map
(
item
=>
{
item
=
clone
(
item
);
// 判断是否以basePath开头
if
(
!
new
RegExp
(
`^(
${
basePath
}
|/)`
).
test
(
item
.
path
))
{
// 非法开头则对基于basePath进行拼接
item
.
path
=
join
(
basePath
,
item
.
path
);
}
// 如果有子菜单递归进行处理
if
(
Array
.
isArray
(
item
.
children
)
&&
item
.
children
.
length
>
0
)
{
item
.
children
=
initMenuItemList
(
item
.
children
,
item
.
path
);
}
// 返回处理结果
return
item
;
});
}
// 菜单列表
// 菜单列表
export
const
menuItemList
=
[{
export
const
menuItemList
=
[{
path
:
"/second/index"
,
path
:
"/second/index"
,
meta
:
{
meta
:
{
icon
:
"icon_home"
,
icon
:
"icon_home"
,
title
:
"首页"
,
title
:
"首页"
}
}
},
{
},
{
path
:
"it-facilities-management"
,
path
:
"it-facilities-management"
,
meta
:
{
meta
:
{
icon
:
"icon_dashuju"
,
icon
:
"icon_dashuju"
,
title
:
"IT设施管理"
,
title
:
"IT设施管理"
,
titleColor
:
"#387DF7"
,
englishTitle
:
"IT Facilities Management"
,
englishTitleColor
:
"#9BBDFB"
,
url
:
""
,
url
:
""
,
content
:
""
,
content
:
""
,
image
:
""
,
image
:
""
,
...
@@ -59,6 +87,9 @@ export const menuItemList = [{
...
@@ -59,6 +87,9 @@ export const menuItemList = [{
meta
:
{
meta
:
{
icon
:
"icon_jiaoxue"
,
icon
:
"icon_jiaoxue"
,
title
:
"教学与教务"
,
title
:
"教学与教务"
,
titleColor
:
"#E66A6E"
,
englishTitle
:
"Teaching and Academic Affairs"
,
englishTitleColor
:
"#F2B4B6"
,
url
:
""
,
url
:
""
,
content
:
""
,
content
:
""
,
image
:
""
,
image
:
""
,
...
@@ -145,6 +176,9 @@ export const menuItemList = [{
...
@@ -145,6 +176,9 @@ export const menuItemList = [{
meta
:
{
meta
:
{
icon
:
"icon_xuesheng"
,
icon
:
"icon_xuesheng"
,
title
:
"学生工作"
,
title
:
"学生工作"
,
titleColor
:
"#E89C69"
,
englishTitle
:
"Student Work"
,
englishTitleColor
:
"#F3CDB3"
,
url
:
""
,
url
:
""
,
content
:
""
,
content
:
""
,
image
:
""
,
image
:
""
,
...
@@ -295,4 +329,4 @@ export const menuItemList = [{
...
@@ -295,4 +329,4 @@ export const menuItemList = [{
}];
}];
// 前缀路径
// 前缀路径
export
const
prefixBasePath
=
"/product-introduction"
export
const
prefixBasePath
=
"/product-introduction"
;
src/views/ProductIntroduction/index.vue
View file @
c4a5c024
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
import
Second
from
"@/layout/Second"
;
import
Second
from
"@/layout/Second"
;
import
{
empty
}
from
"@/utils/validate"
;
import
{
empty
}
from
"@/utils/validate"
;
import
Single
from
"@/views/ProductIntroduction/Single.vue"
;
import
Single
from
"@/views/ProductIntroduction/Single.vue"
;
import
{
menuItemList
,
prefixBasePath
}
from
"@/
views/ProductIntroduction/menuInfo
"
;
import
{
menuItemList
,
prefixBasePath
}
from
"@/
utils/menu
"
;
export
default
{
export
default
{
...
...
src/views/index/index.vue
0 → 100644
View file @
c4a5c024
<
template
>
<div
class=
"index"
>
<h1>
Index
</h1>
<p>
This is the index page. You can find the source code for this page in
<code>
src/views/index/index.vue
</code>
</p>
</div>
</
template
>
<
script
>
export
default
{
name
:
"index"
};
</
script
>
<
style
scoped
>
</
style
>
\ No newline at end of file
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