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
fb3fa909
authored
2023-07-27 10:39:22 +0800
by
yuanbo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加注释
1 parent
780282d0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
138 additions
and
2 deletions
src/directive/theme.js
src/layout/components/Navbar.vue
src/layout/components/Sidebar/FixiOSBug.js
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 @
fb3fa90
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
;
if
(
background
)
el
.
style
[
'background-color'
]
=
value
;
if
(
font
)
el
.
style
.
color
=
value
;
if
(
border
)
el
.
style
[
'border-color'
]
=
value
;
}
\ No newline at end of file
}
...
...
src/layout/components/Navbar.vue
View file @
fb3fa90
...
...
@@ -35,6 +35,10 @@
}
},
methods
:
{
/**
* @description: handleDataView
* @author: renchao
*/
onCancel
()
{
logout
()
.
then
((
res
)
=>
{
...
...
src/layout/components/Sidebar/FixiOSBug.js
View file @
fb3fa90
...
...
@@ -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/SidebarItem.vue
View file @
fb3fa90
...
...
@@ -53,6 +53,12 @@ export default {
return
{}
},
methods
:
{
/**
* @description: hasOneShowingChild
* @param {*} children
* @param {*} parent
* @author: renchao
*/
hasOneShowingChild
(
children
=
[],
parent
)
{
const
showingChildren
=
children
.
filter
(
item
=>
{
if
(
item
.
hidden
)
{
...
...
@@ -77,6 +83,11 @@ export default {
return
false
},
/**
* @description: resolvePath
* @param {*} routePath
* @author: renchao
*/
resolvePath
(
routePath
)
{
if
(
isExternal
(
routePath
))
{
return
routePath
...
...
@@ -88,4 +99,4 @@ export default {
}
}
}
</
script
>
\ No newline at end of file
</
script
>
...
...
src/layout/components/TagsView/ScrollPane.vue
View file @
fb3fa90
...
...
@@ -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 @
fb3fa90
...
...
@@ -59,12 +59,28 @@ export default {
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
=>
{
...
...
@@ -86,6 +102,10 @@ export default {
})
return
tags
},
/**
* @description: initTags
* @author: renchao
*/
initTags
()
{
const
affixTags
=
this
.
affixTags
=
this
.
filterAffixTags
(
this
.
routes
)
for
(
const
tag
of
affixTags
)
{
...
...
@@ -95,6 +115,10 @@ export default {
}
}
},
/**
* @description: addTags
* @author: renchao
*/
addTags
()
{
const
{
name
}
=
this
.
$route
if
(
name
)
{
...
...
@@ -102,6 +126,10 @@ export default {
}
return
false
},
/**
* @description: moveToCurrentTag
* @author: renchao
*/
moveToCurrentTag
()
{
const
tags
=
this
.
$refs
.
tag
this
.
$nextTick
(()
=>
{
...
...
@@ -117,6 +145,11 @@ export default {
}
})
},
/**
* @description: refreshSelectedTag
* @param {*} view
* @author: renchao
*/
refreshSelectedTag
(
view
)
{
this
.
$store
.
dispatch
(
'tagsView/delCachedView'
,
view
).
then
(()
=>
{
const
{
fullPath
}
=
view
...
...
@@ -127,6 +160,11 @@ export default {
})
})
},
/**
* @description: closeSelectedTag
* @param {*} view
* @author: renchao
*/
closeSelectedTag
(
view
)
{
this
.
$store
.
dispatch
(
'tagsView/delView'
,
view
).
then
(({
visitedViews
})
=>
{
if
(
this
.
isActive
(
view
))
{
...
...
@@ -134,12 +172,21 @@ export default {
}
})
},
/**
* @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
))
{
...
...
@@ -148,6 +195,12 @@ export default {
this
.
toLastView
(
visitedViews
,
view
)
})
},
/**
* @description: toLastView
* @param {*} visitedViews
* @param {*} view
* @author: renchao
*/
toLastView
(
visitedViews
,
view
)
{
const
latestView
=
visitedViews
.
slice
(
-
1
)[
0
]
if
(
latestView
)
{
...
...
@@ -163,6 +216,12 @@ export default {
}
}
},
/**
* @description: openMenu
* @param {*} tag
* @param {*} e
* @author: renchao
*/
openMenu
(
tag
,
e
)
{
const
menuMinWidth
=
105
const
offsetLeft
=
this
.
$el
.
getBoundingClientRect
().
left
// container margin left
...
...
@@ -180,9 +239,17 @@ export default {
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 @
fb3fa90
...
...
@@ -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