Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ant-design-pro-vue
Overview
Overview
Details
Activity
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
tianzhuanghu
ant-design-pro-vue
Commits
1fdaca01
Commit
1fdaca01
authored
Dec 01, 2018
by
sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: merge mixin, fix user-layout 320px css
parent
e8e2426a
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
113 additions
and
108 deletions
+113
-108
UserLayout.vue
src/components/layouts/UserLayout.vue
+13
-1
SideMenu.vue
src/components/menu/SideMenu.vue
+3
-11
GlobalHeader.vue
src/components/page/GlobalHeader.vue
+7
-14
GlobalLayout.vue
src/components/page/GlobalLayout.vue
+22
-23
SettingDrawer.vue
src/components/setting/SettingDrawer.vue
+3
-17
defaultSettings.js
src/defaultSettings.js
+1
-1
mixin.js
src/utils/mixin.js
+40
-0
util.js
src/utils/util.js
+1
-1
Custom.vue
src/views/account/settings/Custom.vue
+4
-9
Index.vue
src/views/account/settings/Index.vue
+5
-9
Advanced.vue
src/views/profile/advanced/Advanced.vue
+4
-8
Success.vue
src/views/result/Success.vue
+3
-7
Register.vue
src/views/user/Register.vue
+3
-5
vue.config.js
vue.config.js
+4
-2
No files found.
src/components/layouts/UserLayout.vue
View file @
1fdaca01
<
template
>
<div
id=
"userLayout"
class=
"user-layout-wrapper
"
>
<div
id=
"userLayout"
:class=
"['user-layout-wrapper', device]
"
>
<div
class=
"container"
>
<div
class=
"top"
>
<div
class=
"header"
>
...
...
@@ -31,10 +31,12 @@
<
script
>
import
RouteView
from
"@/components/layouts/RouteView"
import
{
mixinDevice
}
from
'@/utils/mixin.js'
export
default
{
name
:
"UserLayout"
,
components
:
{
RouteView
},
mixins
:
[
mixinDevice
],
data
()
{
return
{}
},
...
...
@@ -51,6 +53,15 @@
#userLayout
.user-layout-wrapper
{
height
:
100%
;
&.mobile
{
.container
{
.main
{
max-width
:
368px
;
width
:
98%
;
}
}
}
.container
{
width
:
100%
;
min-height
:
100%
;
...
...
@@ -105,6 +116,7 @@
}
.main
{
min-width
:
260px
;
width
:
368px
;
margin
:
0
auto
;
}
...
...
src/components/menu/SideMenu.vue
View file @
1fdaca01
<
template
>
<a-layout-sider
:class=
"['sider',
device === 'desktop'
? null : 'shadow', theme, fixSiderbar ? 'ant-fixed-sidemenu' : null ]"
:class=
"['sider',
isDesktop()
? null : 'shadow', theme, fixSiderbar ? 'ant-fixed-sidemenu' : null ]"
width=
"256px"
:collapsible=
"collapsible"
v-model=
"collapsed"
...
...
@@ -21,11 +21,12 @@
import
ALayoutSider
from
"ant-design-vue/es/layout/Sider"
import
Logo
from
'../tools/Logo'
import
SMenu
from
'./index'
import
{
m
apState
}
from
'vuex
'
import
{
m
ixin
,
mixinDevice
}
from
'@/utils/mixin.js
'
export
default
{
name
:
"SideMenu"
,
components
:
{
ALayoutSider
,
Logo
,
SMenu
},
mixins
:
[
mixin
,
mixinDevice
],
props
:
{
mode
:
{
type
:
String
,
...
...
@@ -52,15 +53,6 @@
required
:
true
}
},
created
()
{
},
computed
:
{
...
mapState
({
device
:
state
=>
state
.
app
.
device
,
fixSiderbar
:
state
=>
state
.
app
.
fixSiderbar
,
})
},
methods
:
{
onSelect
(
obj
)
{
this
.
$emit
(
'menuSelect'
,
obj
)
...
...
src/components/page/GlobalHeader.vue
View file @
1fdaca01
...
...
@@ -43,21 +43,26 @@
import
SMenu
from
'../menu/'
import
Logo
from
'../tools/Logo'
import
{
m
apState
}
from
'vuex
'
import
{
m
ixin
}
from
'@/utils/mixin.js
'
export
default
{
name
:
"
Layout
Header"
,
name
:
"
Global
Header"
,
components
:
{
UserMenu
,
SMenu
,
Logo
},
mixins
:
[
mixin
],
props
:
{
mode
:
{
type
:
String
,
// sidemenu, topmenu
default
:
'sidemenu'
},
menus
:
{
type
:
Array
,
required
:
true
},
theme
:
{
type
:
String
,
required
:
false
,
...
...
@@ -76,24 +81,12 @@
},
data
()
{
return
{
menus
:
[],
headerBarFixed
:
false
,
}
},
mounted
()
{
window
.
addEventListener
(
'scroll'
,
this
.
handleScroll
)
},
created
()
{
this
.
menus
=
this
.
mainMenu
.
find
((
item
)
=>
item
.
path
===
'/'
).
children
},
computed
:
{
...
mapState
({
mainMenu
:
state
=>
state
.
permission
.
addRouters
,
sidebarOpened
:
state
=>
state
.
app
.
sidebar
.
opened
,
fixedHeader
:
state
=>
state
.
app
.
fixedHeader
,
autoHideHeader
:
state
=>
state
.
app
.
autoHideHeader
,
}),
},
methods
:
{
handleScroll
()
{
if
(
this
.
autoHideHeader
)
{
...
...
src/components/page/GlobalLayout.vue
View file @
1fdaca01
...
...
@@ -4,7 +4,7 @@
<template
v-if=
"layoutMode === 'sidemenu'"
>
<a-drawer
v-if=
"device === 'mobile'"
:wrapClassName=
"'drawer-sider ' +
t
heme"
:wrapClassName=
"'drawer-sider ' +
navT
heme"
placement=
"left"
@
close=
"() => this.collapsed = false"
:closable=
"false"
...
...
@@ -14,16 +14,16 @@
mode=
"inline"
:menus=
"menus"
@
menuSelect=
"menuSelect"
:theme=
"
t
heme"
:theme=
"
navT
heme"
:collapsed=
"false"
:collapsible=
"true"
></side-menu>
</a-drawer>
<side-menu
v-else
mode=
"inline"
:menus=
"menus"
:theme=
"theme"
:mode=
"menuMode"
:theme=
"navTheme"
:collapsed=
"collapsed"
:collapsible=
"true"
></side-menu>
</
template
>
...
...
@@ -31,7 +31,7 @@
<
template
v-else
>
<a-drawer
v-if=
"device === 'mobile'"
:wrapClassName=
"'drawer-sider ' +
t
heme"
:wrapClassName=
"'drawer-sider ' +
navT
heme"
placement=
"left"
@
close=
"() => this.collapsed = false"
:closable=
"false"
...
...
@@ -41,7 +41,7 @@
mode=
"inline"
:menus=
"menus"
@
menuSelect=
"menuSelect"
:theme=
"
t
heme"
:theme=
"
navT
heme"
:collapsed=
"false"
:collapsible=
"true"
></side-menu>
</a-drawer>
...
...
@@ -49,7 +49,14 @@
<a-layout
:class=
"[layoutMode, `content-width-${contentWidth}`]"
:style=
"{ paddingLeft: fixSiderbar && device === 'desktop' ? `${sidebarOpened ? 256 : 80}px` : '0' }"
>
<!-- layout header -->
<global-header
:mode=
"layoutMode"
:theme=
"theme"
:collapsed=
"collapsed"
:device=
"device"
@
toggle=
"toggle"
/>
<global-header
:mode=
"layoutMode"
:menus=
"menus"
:theme=
"navTheme"
:collapsed=
"collapsed"
:device=
"device"
@
toggle=
"toggle"
/>
<!-- layout content -->
<a-layout-content
:style=
"{ margin: '24px 24px 0', height: '100%', paddingTop: fixedHeader ? '64px' : '0' }"
>
...
...
@@ -71,41 +78,33 @@
import
GlobalHeader
from
'@/components/page/GlobalHeader'
import
GlobalFooter
from
'@/components/page/GlobalFooter'
import
SettingDrawer
from
'@/components/setting/SettingDrawer'
import
{
trigger
Resize
}
from
'@/utils/util'
import
{
trigger
WindowResizeEvent
}
from
'@/utils/util'
import
{
mapState
,
mapActions
}
from
'vuex'
import
{
mixin
,
mixinDevice
}
from
'@/utils/mixin.js'
export
default
{
name
:
"
Basic
Layout"
,
name
:
"
Global
Layout"
,
components
:
{
SideMenu
,
GlobalHeader
,
GlobalFooter
,
SettingDrawer
},
mixins
:
[
mixin
,
mixinDevice
],
data
()
{
return
{
// light, dark
menuTheme
:
'light'
,
// inline, horizontal
menuMode
:
'inline'
,
collapsed
:
false
,
menus
:
[]
}
},
computed
:
{
...
mapState
({
// 主路由
mainMenu
:
state
=>
state
.
permission
.
addRouters
,
layoutMode
:
state
=>
state
.
app
.
layout
,
sidebarOpened
:
state
=>
state
.
app
.
sidebar
.
opened
,
fixedHeader
:
state
=>
state
.
app
.
fixedHeader
,
fixSiderbar
:
state
=>
state
.
app
.
fixSiderbar
,
contentWidth
:
state
=>
state
.
app
.
contentWidth
,
theme
:
state
=>
state
.
app
.
theme
,
device
:
state
=>
state
.
app
.
device
,
})
},
watch
:
{
sidebarOpened
(
val
)
{
console
.
log
(
'watch'
,
val
)
this
.
collapsed
=
!
val
},
},
...
...
@@ -116,11 +115,11 @@
...
mapActions
([
'setSidebar'
]),
toggle
()
{
this
.
collapsed
=
!
this
.
collapsed
triggerResize
()
this
.
setSidebar
(
!
this
.
collapsed
)
triggerWindowResizeEvent
()
},
menuSelect
()
{
if
(
this
.
device
!==
'desktop'
)
{
if
(
!
this
.
isDesktop
()
)
{
this
.
collapsed
=
false
}
}
...
...
src/components/setting/SettingDrawer.vue
View file @
1fdaca01
...
...
@@ -92,7 +92,7 @@
<
template
slot=
'title'
>
该设定仅 [顶部栏导航] 时有效
</
template
>
<a-select
size=
"small"
style=
"width: 80px;"
:defaultValue=
"contentWidth"
@
change=
"handleContentWidthChange"
>
<a-select
size=
"small"
style=
"width: 80px;"
:defaultValue=
"contentWidth"
@
change=
"handleContentWidthChange"
>
<a-select-option
value=
"Fixed"
>
固定
</a-select-option>
<a-select-option
value=
"Fluid"
v-if=
"layoutMode !== 'sidemenu'"
>
流式
</a-select-option>
</a-select>
...
...
@@ -160,39 +160,25 @@
import
SettingItem
from
'@/components/setting/SettingItem'
import
config
from
'@/defaultSettings'
import
{
updateTheme
,
updateColorWeak
,
colorList
}
from
'@/components/tools/setting'
import
{
m
apState
}
from
'vuex
'
import
{
m
ixin
,
mixinDevice
}
from
'@/utils/mixin.js
'
export
default
{
components
:
{
DetailList
,
SettingItem
},
mixins
:
[
mixin
,
mixinDevice
],
data
()
{
return
{
visible
:
true
,
colorList
,
}
},
computed
:
{
...
mapState
({
navTheme
:
state
=>
state
.
app
.
theme
,
layoutMode
:
state
=>
state
.
app
.
layout
,
primaryColor
:
state
=>
state
.
app
.
color
,
colorWeak
:
state
=>
state
.
app
.
weak
,
fixedHeader
:
state
=>
state
.
app
.
fixedHeader
,
fixSiderbar
:
state
=>
state
.
app
.
fixSiderbar
,
autoHideHeader
:
state
=>
state
.
app
.
autoHideHeader
,
contentWidth
:
state
=>
state
.
app
.
contentWidth
,
}),
},
watch
:
{
},
mounted
()
{
const
vm
=
this
/*this.$nextTick(() => {
vm.visible = false
})*/
setTimeout
(()
=>
{
vm
.
visible
=
false
},
16
)
...
...
src/defaultSettings.js
View file @
1fdaca01
...
...
@@ -17,7 +17,7 @@ export default {
primaryColor
:
'#1890FF'
,
// primary color of ant design
navTheme
:
'dark'
,
// theme for nav menu
layout
:
'sidemenu'
,
// nav menu position: sidemenu or topmenu
contentWidth
:
'F
lui
d'
,
// layout of content: Fluid or Fixed, only works when layout is topmenu
contentWidth
:
'F
ixe
d'
,
// layout of content: Fluid or Fixed, only works when layout is topmenu
fixedHeader
:
false
,
// sticky header
fixSiderbar
:
false
,
// sticky siderbar
autoHideHeader
:
false
,
// auto hide header
...
...
src/utils/mixin.js
0 → 100644
View file @
1fdaca01
// import Vue from 'vue'
import
{
mapState
}
from
"vuex"
;
// const mixinsComputed = Vue.config.optionMergeStrategies.computed
// const mixinsMethods = Vue.config.optionMergeStrategies.methods
const
mixin
=
{
computed
:
{
...
mapState
({
layoutMode
:
state
=>
state
.
app
.
layout
,
navTheme
:
state
=>
state
.
app
.
theme
,
primaryColor
:
state
=>
state
.
app
.
color
,
colorWeak
:
state
=>
state
.
app
.
weak
,
fixedHeader
:
state
=>
state
.
app
.
fixedHeader
,
fixSiderbar
:
state
=>
state
.
app
.
fixSiderbar
,
contentWidth
:
state
=>
state
.
app
.
contentWidth
,
autoHideHeader
:
state
=>
state
.
app
.
autoHideHeader
,
sidebarOpened
:
state
=>
state
.
app
.
sidebarOpened
})
}
}
const
mixinDevice
=
{
computed
:
{
...
mapState
({
device
:
state
=>
state
.
app
.
device
,
})
},
methods
:
{
isMobile
()
{
return
this
.
device
===
'mobile'
},
isDesktop
()
{
return
this
.
device
===
'desktop'
}
}
}
export
{
mixin
,
mixinDevice
}
\ No newline at end of file
src/utils/util.js
View file @
1fdaca01
...
...
@@ -13,7 +13,7 @@ export function welcome() {
/**
* 触发 window.resize
*/
export
function
trigger
Resize
()
{
export
function
trigger
WindowResizeEvent
()
{
let
event
=
document
.
createEvent
(
'HTMLEvents'
)
event
.
initEvent
(
'resize'
,
true
,
true
)
event
.
eventType
=
'message'
...
...
src/views/account/settings/Custom.vue
View file @
1fdaca01
<
script
>
import
{
mapState
}
from
"vuex"
import
{
colorList
}
from
'@/components/tools/setting'
import
ASwitch
from
'ant-design-vue/es/switch'
import
AList
from
"ant-design-vue/es/list"
import
AListItem
from
"ant-design-vue/es/list/Item"
import
{
mixin
}
from
'@/utils/mixin.js'
const
Meta
=
AListItem
.
Meta
...
...
@@ -14,16 +14,11 @@
ASwitch
,
Meta
},
mixins
:
[
mixin
],
data
()
{
return
{
}
},
computed
:
{
...
mapState
({
theme
:
state
=>
state
.
app
.
theme
,
color
:
state
=>
state
.
app
.
color
})
},
filters
:
{
themeFilter
(
theme
)
{
const
themeMap
=
{
...
...
@@ -58,14 +53,14 @@
<
/span
>
<
/Meta
>
<
div
slot
=
"actions"
>
<
ASwitch
checkedChildren
=
"暗色"
unCheckedChildren
=
"白色"
defaultChecked
=
{
this
.
t
heme
===
'dark'
&&
true
||
false
}
onChange
=
{
this
.
onChange
}
/
>
<
ASwitch
checkedChildren
=
"暗色"
unCheckedChildren
=
"白色"
defaultChecked
=
{
this
.
navT
heme
===
'dark'
&&
true
||
false
}
onChange
=
{
this
.
onChange
}
/
>
<
/div
>
<
/AListItem
>
<
AListItem
>
<
Meta
>
<
a
slot
=
"title"
>
主题色
<
/a
>
<
span
slot
=
"description"
>
页面风格配色:
<
a
domPropsInnerHTML
=
{
this
.
colorFilter
(
this
.
c
olor
)
}
/
>
页面风格配色:
<
a
domPropsInnerHTML
=
{
this
.
colorFilter
(
this
.
primaryC
olor
)
}
/
>
<
/span
>
<
/Meta
>
<
/AListItem
>
...
...
src/views/account/settings/Index.vue
View file @
1fdaca01
...
...
@@ -51,13 +51,14 @@
<
script
>
import
PageLayout
from
'@/components/page/PageLayout'
import
RouteView
from
"@/components/layouts/RouteView"
import
{
m
apState
}
from
'vuex
'
import
{
m
ixinDevice
}
from
'@/utils/mixin.js
'
export
default
{
components
:
{
RouteView
,
PageLayout
},
mixins
:
[
mixinDevice
],
data
()
{
return
{
// horizontal inline
...
...
@@ -87,11 +88,6 @@
pageTitle
:
''
}
},
computed
:
{
...
mapState
({
device
:
state
=>
state
.
app
.
device
,
})
},
created
()
{
this
.
updateMenu
()
},
...
...
@@ -121,9 +117,9 @@
border-right
:
unset
;
border-bottom
:
1px
solid
#e8e8e8
;
width
:
100%
;
height
:
48
px
;
overflow-x
:
hidden
;
overflow-y
:
auto
;
height
:
50
px
;
overflow-x
:
auto
;
overflow-y
:
scroll
;
}
.account-settings-info-right
{
padding
:
20px
40px
;
...
...
src/views/profile/advanced/Advanced.vue
View file @
1fdaca01
...
...
@@ -30,7 +30,7 @@
</
template
>
<a-card
:bordered=
"false"
title=
"流程进度"
>
<a-steps
:direction=
"
device==='mobile'
&& 'vertical' || 'horizontal'"
:current=
"1"
progressDot
>
<a-steps
:direction=
"
isMobile()
&& 'vertical' || 'horizontal'"
:current=
"1"
progressDot
>
<a-step
title=
"创建项目"
>
</a-step>
<a-step
title=
"部门初审"
>
...
...
@@ -133,7 +133,7 @@
</template>
<
script
>
import
{
m
apState
}
from
'vuex
'
import
{
m
ixinDevice
}
from
'@/utils/mixin.js
'
import
PageLayout
from
'@/components/page/PageLayout'
import
DetailList
from
'@/components/tools/DetailList'
...
...
@@ -146,6 +146,7 @@
DetailList
,
DetailListItem
},
mixins
:
[
mixinDevice
],
data
()
{
return
{
tabList
:
[
...
...
@@ -295,12 +296,7 @@
}
return
statusTypeMap
[
type
]
}
},
computed
:
{
...
mapState
({
device
:
state
=>
state
.
app
.
device
,
})
},
}
}
</
script
>
...
...
src/views/result/Success.vue
View file @
1fdaca01
...
...
@@ -22,7 +22,7 @@
2016-12-12 ~ 2017-12-12
</a-col>
</a-row>
<a-steps
:current=
"1"
:direction=
"
device === 'mobile'
&& directionType.vertical || directionType.horizontal"
progressDot
>
<a-steps
:current=
"1"
:direction=
"
isMobile()
&& directionType.vertical || directionType.horizontal"
progressDot
>
<a-step
>
<span
style=
"font-size: 14px"
slot=
"title"
>
创建项目
</span>
<
template
slot=
"description"
>
...
...
@@ -61,7 +61,7 @@
<
script
>
import
Result
from
'./Result'
import
{
m
apState
}
from
'vuex
'
import
{
m
ixinDevice
}
from
'@/utils/mixin.js
'
const
directionType
=
{
horizontal
:
'horizontal'
,
...
...
@@ -73,6 +73,7 @@
components
:
{
Result
},
mixins
:
[
mixinDevice
],
data
()
{
return
{
title
:
'提交成功'
,
...
...
@@ -82,11 +83,6 @@
' “单据”的需求,下面这个灰色区域可以呈现比较复杂的内容。'
,
directionType
}
},
computed
:
{
...
mapState
({
device
:
state
=>
state
.
app
.
device
,
})
}
}
</
script
>
...
...
src/views/user/Register.vue
View file @
1fdaca01
...
...
@@ -90,7 +90,7 @@
</template>
<
script
>
import
{
m
apState
}
from
'vuex
'
import
{
m
ixinDevice
}
from
'@/utils/mixin.js
'
import
{
getSmsCaptcha
}
from
'@/api/login'
const
levelNames
=
{
...
...
@@ -115,6 +115,7 @@
name
:
"Register"
,
components
:
{
},
mixins
:
[
mixinDevice
],
data
()
{
return
{
form
:
null
,
...
...
@@ -131,9 +132,6 @@
}
},
computed
:
{
...
mapState
({
isMobile
:
state
=>
state
.
app
.
device
===
'mobile'
,
}),
passwordLevelClass
()
{
return
levelClass
[
this
.
state
.
passwordLevel
]
},
...
...
@@ -198,7 +196,7 @@
},
handlePasswordInputClick
()
{
if
(
!
this
.
isMobile
)
{
if
(
!
this
.
isMobile
()
)
{
this
.
state
.
passwordLevelChecked
=
true
return
;
}
...
...
vue.config.js
View file @
1fdaca01
...
...
@@ -52,12 +52,14 @@ module.exports = {
devServer
:
{
proxy
:
{
'/api'
:
{
target
:
'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro'
,
// target: 'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro',
target
:
'https://www.easy-mock.com/mock/5b7bce071f130e5b7fe8cd7d/antd-pro'
,
ws
:
false
,
changeOrigin
:
true
},
'/gateway'
:
{
target
:
'https://mock.ihx.me/mock/5baf3052f7da7e07e04a5116/antd-pro'
,
target
:
'https://www.easy-mock.com/mock/5b7bce071f130e5b7fe8cd7d/antd-pro'
,
ws
:
false
,
changeOrigin
:
true
,
pathRewrite
:
{
'^/gateway'
:
'/api'
...
...
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