Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
bdc
/
bdcsjsb-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
a87b1930
authored
2023-07-27 10:38:54 +0800
by
yuanbo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加注释
1 parent
cc11442b
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
169 additions
and
0 deletions
src/directive/theme.js
src/layout/components/Breadcrumb/index.vue
src/layout/components/Navbar.vue
src/layout/components/Sidebar/FixiOSBug.js
src/layout/components/Sidebar/Link.vue
src/layout/components/Sidebar/SidebarItem.vue
src/layout/components/TagsView/ScrollPane.vue
src/layout/components/TagsView/index.vue
src/layout/mixin/ResizeHandler.js
src/directive/theme.js
View file @
a87b193
export
const
theme
=
{
/**
* @description: bind
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @author: renchao
*/
bind
:
function
(
el
,
binding
,
vnode
)
{
setEleStyleColorAttribute
(
el
,
binding
);
},
/**
* @description: update
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @author: renchao
*/
update
:
function
(
el
,
binding
,
vnode
)
{
setEleStyleColorAttribute
(
el
,
binding
);
},
/**
* @description: componentUpdated
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @author: renchao
*/
componentUpdated
:
function
(
el
,
binding
,
vnode
)
{
setEleStyleColorAttribute
(
el
,
binding
);
}
}
/**
* @description: setEleStyleColorAttribute
* @param {*} el
* @param {*} binding
* @author: renchao
*/
function
setEleStyleColorAttribute
(
el
,
binding
)
{
const
{
name
,
value
,
arg
,
expression
,
modifiers
}
=
binding
;
const
{
background
,
font
,
border
}
=
modifiers
;
...
...
src/layout/components/Breadcrumb/index.vue
View file @
a87b193
...
...
@@ -39,6 +39,10 @@
this
.
getBreadcrumb
()
},
methods
:
{
/**
* @description: getBreadcrumb
* @author: renchao
*/
getBreadcrumb
()
{
// only show routes with meta.title
let
matched
=
this
.
$route
.
matched
.
filter
(
item
=>
item
.
meta
&&
item
.
meta
.
title
)
...
...
@@ -50,6 +54,11 @@
this
.
levelList
=
matched
.
filter
(
item
=>
item
.
meta
&&
item
.
meta
.
title
&&
item
.
meta
.
breadcrumb
!==
false
)
},
/**
* @description: isDashboard
* @param {*} route
* @author: renchao
*/
isDashboard
(
route
)
{
const
name
=
route
&&
route
.
name
if
(
!
name
)
{
...
...
@@ -57,11 +66,21 @@
}
return
name
.
trim
().
toLocaleLowerCase
()
===
'Dashboard'
.
toLocaleLowerCase
()
},
/**
* @description: pathCompile
* @param {*} path
* @author: renchao
*/
pathCompile
(
path
)
{
const
{
params
}
=
this
.
$route
var
toPath
=
pathToRegexp
.
compile
(
path
)
return
toPath
(
params
)
},
/**
* @description: handleLink
* @param {*} item
* @author: renchao
*/
handleLink
(
item
)
{
const
{
redirect
,
path
}
=
item
if
(
redirect
)
{
...
...
src/layout/components/Navbar.vue
View file @
a87b193
...
...
@@ -32,13 +32,26 @@ export default {
},
},
methods
:
{
/**
* @description: handleDataView
* @author: renchao
*/
handleDataView
()
{
const
{
href
}
=
this
.
$router
.
resolve
(
"/dataView"
);
window
.
open
(
href
,
"_blank"
);
},
/**
* @description: themeChange
* @param {*} val
* @author: renchao
*/
themeChange
(
val
)
{
this
.
$store
.
dispatch
(
"app/updateTheme"
,
val
);
},
/**
* @description: onCancel
* @author: renchao
*/
onCancel
()
{
axios
.
post
(
window
.
_config
.
services
.
management
+
"/management/logout"
)
...
...
src/layout/components/Sidebar/FixiOSBug.js
View file @
a87b193
...
...
@@ -10,6 +10,10 @@ export default {
this
.
fixBugIniOS
()
},
methods
:
{
/**
* @description: fixBugIniOS
* @author: renchao
*/
fixBugIniOS
()
{
const
$subMenu
=
this
.
$refs
.
subMenu
if
(
$subMenu
)
{
...
...
src/layout/components/Sidebar/Link.vue
View file @
a87b193
...
...
@@ -26,6 +26,11 @@ export default {
}
},
methods
:
{
/**
* @description: linkProps
* @param {*} to
* @author: renchao
*/
linkProps
(
to
)
{
if
(
this
.
isExternal
)
{
return
{
...
...
src/layout/components/Sidebar/SidebarItem.vue
View file @
a87b193
...
...
@@ -58,6 +58,12 @@
return
{}
},
methods
:
{
/**
* @description: hasOneShowingChild
* @param {*} children
* @param {*} parent
* @author: renchao
*/
hasOneShowingChild
(
children
=
[],
parent
)
{
const
showingChildren
=
children
.
filter
(
item
=>
{
if
(
item
.
hidden
)
{
...
...
@@ -81,6 +87,11 @@
return
false
},
/**
* @description: resolvePath
* @param {*} routePath
* @author: renchao
*/
resolvePath
(
routePath
)
{
if
(
isExternal
(
routePath
))
{
return
routePath
...
...
src/layout/components/TagsView/ScrollPane.vue
View file @
a87b193
...
...
@@ -26,14 +26,28 @@ export default {
this
.
scrollWrapper
.
removeEventListener
(
'scroll'
,
this
.
emitScroll
)
},
methods
:
{
/**
* @description: handleScroll
* @param {*} e
* @author: renchao
*/
handleScroll
(
e
)
{
const
eventDelta
=
e
.
wheelDelta
||
-
e
.
deltaY
*
40
const
$scrollWrapper
=
this
.
scrollWrapper
$scrollWrapper
.
scrollLeft
=
$scrollWrapper
.
scrollLeft
+
eventDelta
/
4
},
/**
* @description: emitScroll
* @author: renchao
*/
emitScroll
()
{
this
.
$emit
(
'scroll'
)
},
/**
* @description: moveToTarget
* @param {*} currentTag
* @author: renchao
*/
moveToTarget
(
currentTag
)
{
const
$container
=
this
.
$refs
.
scrollContainer
.
$el
const
$containerWidth
=
$container
.
offsetWidth
...
...
src/layout/components/TagsView/index.vue
View file @
a87b193
...
...
@@ -58,12 +58,28 @@
this
.
addTags
()
},
methods
:
{
/**
* @description: isActive
* @param {*} route
* @author: renchao
*/
isActive
(
route
)
{
return
route
.
path
===
this
.
$route
.
path
},
/**
* @description: isAffix
* @param {*} tag
* @author: renchao
*/
isAffix
(
tag
)
{
return
tag
.
meta
&&
tag
.
meta
.
affix
},
/**
* @description: filterAffixTags
* @param {*} routes
* @param {*} basePath
* @author: renchao
*/
filterAffixTags
(
routes
,
basePath
=
'/'
)
{
let
tags
=
[]
routes
.
forEach
(
route
=>
{
...
...
@@ -85,6 +101,10 @@
})
return
tags
},
/**
* @description: initTags
* @author: renchao
*/
initTags
()
{
const
affixTags
=
this
.
affixTags
=
this
.
filterAffixTags
(
this
.
routes
)
for
(
const
tag
of
affixTags
)
{
...
...
@@ -94,6 +114,10 @@
}
}
},
/**
* @description: addTags
* @author: renchao
*/
addTags
()
{
const
{
name
}
=
this
.
$route
if
(
name
)
{
...
...
@@ -101,6 +125,10 @@
}
return
false
},
/**
* @description: moveToCurrentTag
* @author: renchao
*/
moveToCurrentTag
()
{
const
tags
=
this
.
$refs
.
tag
this
.
$nextTick
(()
=>
{
...
...
@@ -116,6 +144,11 @@
}
})
},
/**
* @description: refreshSelectedTag
* @param {*} view
* @author: renchao
*/
refreshSelectedTag
(
view
)
{
this
.
$store
.
dispatch
(
'tagsView/delCachedView'
,
view
).
then
(()
=>
{
const
{
fullPath
}
=
view
...
...
@@ -126,6 +159,11 @@
})
})
},
/**
* @description: closeSelectedTag
* @param {*} view
* @author: renchao
*/
closeSelectedTag
(
view
)
{
this
.
$store
.
dispatch
(
'tagsView/delView'
,
view
).
then
(({
visitedViews
})
=>
{
if
(
this
.
isActive
(
view
))
{
...
...
@@ -133,12 +171,21 @@
}
})
},
/**
* @description: closeOthersTags
* @author: renchao
*/
closeOthersTags
()
{
this
.
$router
.
push
(
this
.
selectedTag
)
this
.
$store
.
dispatch
(
'tagsView/delOthersViews'
,
this
.
selectedTag
).
then
(()
=>
{
this
.
moveToCurrentTag
()
})
},
/**
* @description: closeAllTags
* @param {*} view
* @author: renchao
*/
closeAllTags
(
view
)
{
this
.
$store
.
dispatch
(
'tagsView/delAllViews'
).
then
(({
visitedViews
})
=>
{
if
(
this
.
affixTags
.
some
(
tag
=>
tag
.
path
===
view
.
path
))
{
...
...
@@ -147,6 +194,12 @@
this
.
toLastView
(
visitedViews
,
view
)
})
},
/**
* @description: toLastView
* @param {*} visitedViews
* @param {*} view
* @author: renchao
*/
toLastView
(
visitedViews
,
view
)
{
const
latestView
=
visitedViews
.
slice
(
-
1
)[
0
]
if
(
latestView
)
{
...
...
@@ -162,6 +215,12 @@
}
}
},
/**
* @description: openMenu
* @param {*} tag
* @param {*} e
* @author: renchao
*/
openMenu
(
tag
,
e
)
{
const
menuMinWidth
=
105
const
offsetLeft
=
this
.
$el
.
getBoundingClientRect
().
left
-
210
// container margin left
...
...
@@ -179,9 +238,17 @@
this
.
visible
=
true
this
.
selectedTag
=
tag
},
/**
* @description: closeMenu
* @author: renchao
*/
closeMenu
()
{
this
.
visible
=
false
},
/**
* @description: handleScroll
* @author: renchao
*/
handleScroll
()
{
this
.
closeMenu
()
}
...
...
src/layout/mixin/ResizeHandler.js
View file @
a87b193
...
...
@@ -27,10 +27,19 @@ export default {
methods
:
{
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
/**
* @description: use $_ for mixins properties
* https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
* @author: renchao
*/
$_isMobile
()
{
const
rect
=
body
.
getBoundingClientRect
()
return
rect
.
width
-
1
<
WIDTH
},
/**
* @description: $_resizeHandler
* @author: renchao
*/
$_resizeHandler
()
{
if
(
!
document
.
hidden
)
{
const
isMobile
=
this
.
$_isMobile
()
...
...
Please
register
or
sign in
to post a comment