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
6dfc580c
Commit
6dfc580c
authored
Oct 24, 2018
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update setting drawer
parent
1b6c330d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
50 deletions
+120
-50
LayoutMain.vue
src/components/layout/LayoutMain.vue
+2
-1
SettingDrawer.vue
src/components/setting/SettingDrawer.vue
+33
-11
SettingItem.vue
src/components/setting/SettingItem.vue
+39
-0
setting.js
src/components/tools/setting.js
+29
-29
main.js
src/main.js
+2
-1
app.js
src/store/modules/app.js
+10
-2
mutation-types.js
src/store/mutation-types.js
+3
-2
Login.vue
src/views/Login.vue
+2
-4
No files found.
src/components/layout/LayoutMain.vue
View file @
6dfc580c
...
...
@@ -37,6 +37,7 @@
<a-layout-footer
style=
"padding: 0px"
>
<layout-footer/>
</a-layout-footer>
</a-layout>
<setting-drawer></setting-drawer>
...
...
@@ -47,7 +48,7 @@
import
SiderMenu
from
'@/components/menu/SiderMenu'
import
LayoutHeader
from
'./LayoutHeader'
import
LayoutFooter
from
'./LayoutFooter'
import
SettingDrawer
from
'@/components/
tools
/SettingDrawer'
import
SettingDrawer
from
'@/components/
setting
/SettingDrawer'
import
{
triggerResize
}
from
'@/utils/util'
import
{
mapState
,
mapActions
}
from
'vuex'
...
...
src/components/
tools
/SettingDrawer.vue
→
src/components/
setting
/SettingDrawer.vue
View file @
6dfc580c
...
...
@@ -55,6 +55,21 @@
</div>
</div>
<a-divider
/>
<div
:style=
"{ marginBottom: '24px' }"
>
<h3
class=
"setting-drawer-index-title"
>
其他设置
</h3>
<div>
<a-list
:split=
"false"
>
<a-list-item>
<a-switch
slot=
"actions"
size=
"small"
:defaultChecked=
"colorWeak"
@
change=
"onColorWeak"
/>
<a-list-item-meta>
<div
slot=
"title"
>
色弱模式
</div>
</a-list-item-meta>
</a-list-item>
</a-list>
</div>
</div>
<a-divider
/>
<div
:style=
"{ marginBottom: '24px' }"
>
<a-alert
type=
"warning"
>
...
...
@@ -75,13 +90,15 @@
<
script
>
import
DetailList
from
'@/components/tools/DetailList'
import
SettingItem
from
'@/components/setting/SettingItem'
import
config
from
'@/defaultConfig'
import
{
updateTheme
,
colorList
}
from
'@/components/tools/setting'
import
{
updateTheme
,
updateColorWeak
,
colorList
}
from
'@/components/tools/setting'
import
{
mapState
}
from
'vuex'
export
default
{
components
:
{
DetailList
DetailList
,
SettingItem
},
data
()
{
return
{
...
...
@@ -93,17 +110,24 @@
...
mapState
({
navTheme
:
state
=>
state
.
app
.
theme
,
primaryColor
:
state
=>
state
.
app
.
color
,
colorWeak
:
state
=>
state
.
app
.
weak
,
})
},
mounted
()
{
const
vm
=
this
/*this.$nextTick(() => {
vm.visible = false
})*/
setTimeout
(()
=>
{
vm
.
visible
=
false
},
1
)
},
1
6
)
// 当主题色不是默认色时,才进行主题编译
if
(
this
.
primaryColor
!==
config
.
primaryColor
)
{
updateTheme
(
this
.
primaryColor
)
}
if
(
this
.
colorWeak
!==
config
.
colorWeak
)
{
updateColorWeak
(
this
.
colorWeak
)
}
},
methods
:
{
showDrawer
()
{
...
...
@@ -115,10 +139,14 @@
toggle
()
{
this
.
visible
=
!
this
.
visible
},
changeMenuTheme
(
theme
)
{
onColorWeak
(
checked
)
{
this
.
$store
.
dispatch
(
'ToggleWeak'
,
checked
)
updateColorWeak
(
checked
)
},
changeMenuTheme
(
theme
)
{
this
.
$store
.
dispatch
(
'ToggleTheme'
,
theme
)
},
changeColor
(
color
)
{
changeColor
(
color
)
{
if
(
this
.
primaryColor
!==
color
)
{
this
.
$store
.
dispatch
(
'ToggleColor'
,
color
)
updateTheme
(
color
)
...
...
@@ -132,12 +160,6 @@
.setting-drawer-index-content
{
.setting-drawer-index-title
{
font-size
:
14px
;
color
:
rgba
(
0
,
0
,
0
,
.85
);
line-height
:
22px
;
margin-bottom
:
12px
;
}
.setting-drawer-index-blockChecbox
{
display
:
flex
;
...
...
src/components/setting/SettingItem.vue
0 → 100644
View file @
6dfc580c
<
template
>
<div
class=
"setting-drawer-index-item"
>
<h3
class=
"setting-drawer-index-title"
>
{{
title
}}
</h3>
<slot></slot>
<a-divider
v-if=
"divider"
/>
</div>
</
template
>
<
script
>
export
default
{
name
:
"SettingItem"
,
props
:
{
title
:
{
type
:
String
,
default
:
''
},
divider
:
{
type
:
Boolean
,
default
:
false
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.setting-drawer-index-item
{
margin-bottom
:
24px
;
.setting-drawer-index-title
{
font-size
:
14px
;
color
:
rgba
(
0
,
0
,
0
,
.85
);
line-height
:
22px
;
margin-bottom
:
12px
;
}
}
</
style
>
\ No newline at end of file
src/components/tools/setting.js
View file @
6dfc580c
...
...
@@ -3,6 +3,33 @@ import { message } from 'ant-design-vue/es';
let
lessNodesAppended
;
const
colorList
=
[
{
key
:
'薄暮'
,
color
:
'#F5222D'
,
},
{
key
:
'火山'
,
color
:
'#FA541C'
,
},
{
key
:
'日暮'
,
color
:
'#FAAD14'
,
},
{
key
:
'明青'
,
color
:
'#13C2C2'
,
},
{
key
:
'极光绿'
,
color
:
'#52C41A'
,
},
{
key
:
'拂晓蓝(默认)'
,
color
:
'#1890FF'
,
},
{
key
:
'极客蓝'
,
color
:
'#2F54EB'
,
},
{
key
:
'酱紫'
,
color
:
'#722ED1'
,
},
];
const
updateTheme
=
primaryColor
=>
{
// Don't compile less in production!
/* if (process.env.NODE_ENV === 'production') {
...
...
@@ -61,34 +88,8 @@ const updateTheme = primaryColor => {
};
const
updateColorWeak
=
colorWeak
=>
{
document
.
body
.
className
=
colorWeak
?
'colorWeak'
:
''
;
// document.body.className = colorWeak ? 'colorWeak' : '';
colorWeak
?
document
.
body
.
classList
.
add
(
'colorWeak'
)
:
document
.
body
.
classList
.
remove
(
'colorWeak'
)
};
const
colorList
=
[
{
key
:
'薄暮'
,
color
:
'#F5222D'
,
},
{
key
:
'火山'
,
color
:
'#FA541C'
,
},
{
key
:
'日暮'
,
color
:
'#FAAD14'
,
},
{
key
:
'明青'
,
color
:
'#13C2C2'
,
},
{
key
:
'极光绿'
,
color
:
'#52C41A'
,
},
{
key
:
'拂晓蓝(默认)'
,
color
:
'#1890FF'
,
},
{
key
:
'极客蓝'
,
color
:
'#2F54EB'
,
},
{
key
:
'酱紫'
,
color
:
'#722ED1'
,
},
];
export
{
updateTheme
,
colorList
,
updateColorWeak
}
\ No newline at end of file
src/main.js
View file @
6dfc580c
...
...
@@ -13,7 +13,7 @@ import 'ant-design-vue/dist/antd.less'; // or 'ant-design-vue/dist/antd.less'
import
'@/permission'
// permission control
import
'@/utils/filter'
// base filter
import
{
ACCESS_TOKEN
,
DEFAULT_COLOR
,
DEFAULT_THEME
,
SIDEBAR_TYPE
}
from
"@/store/mutation-types"
import
{
ACCESS_TOKEN
,
DEFAULT_COLOR
,
DEFAULT_THEME
,
DEFAULT_COLOR_WEAK
,
SIDEBAR_TYPE
}
from
"@/store/mutation-types"
import
config
from
'@/defaultConfig'
Vue
.
config
.
productionTip
=
false
...
...
@@ -29,6 +29,7 @@ new Vue({
mounted
()
{
store
.
commit
(
'SET_SIDEBAR_TYPE'
,
Vue
.
ls
.
get
(
SIDEBAR_TYPE
,
false
))
store
.
commit
(
'TOGGLE_THEME'
,
Vue
.
ls
.
get
(
DEFAULT_THEME
,
config
.
navTheme
))
store
.
commit
(
'TOGGLE_WEAK'
,
Vue
.
ls
.
get
(
DEFAULT_COLOR_WEAK
,
config
.
colorWeak
))
store
.
commit
(
'TOGGLE_COLOR'
,
Vue
.
ls
.
get
(
DEFAULT_COLOR
,
config
.
primaryColor
))
store
.
commit
(
'SET_TOKEN'
,
Vue
.
ls
.
get
(
ACCESS_TOKEN
))
},
...
...
src/store/modules/app.js
View file @
6dfc580c
import
Vue
from
'vue'
import
{
SIDEBAR_TYPE
,
DEFAULT_THEME
,
DEFAULT_COLOR
}
from
"@/store/mutation-types"
import
{
SIDEBAR_TYPE
,
DEFAULT_THEME
,
DEFAULT_COLOR
,
DEFAULT_COLOR_WEAK
}
from
"@/store/mutation-types"
const
app
=
{
state
:
{
...
...
@@ -9,7 +9,8 @@ const app = {
},
device
:
'desktop'
,
theme
:
''
,
color
:
null
color
:
null
,
weak
:
false
},
mutations
:
{
SET_SIDEBAR_TYPE
:
(
state
,
type
)
=>
{
...
...
@@ -32,6 +33,10 @@ const app = {
TOGGLE_COLOR
:
(
state
,
color
)
=>
{
Vue
.
ls
.
set
(
DEFAULT_COLOR
,
color
)
state
.
color
=
color
},
TOGGLE_WEAK
:
(
state
,
flag
)
=>
{
Vue
.
ls
.
set
(
DEFAULT_COLOR_WEAK
,
flag
)
state
.
weak
=
flag
}
},
actions
:
{
...
...
@@ -49,6 +54,9 @@ const app = {
},
ToggleColor
({
commit
},
color
)
{
commit
(
'TOGGLE_COLOR'
,
color
)
},
ToggleWeak
({
commit
},
weakFlag
)
{
commit
(
'TOGGLE_WEAK'
,
weakFlag
)
}
}
}
...
...
src/store/mutation-types.js
View file @
6dfc580c
export
const
ACCESS_TOKEN
=
'Access-Token'
export
const
SIDEBAR_TYPE
=
'SIDEBAR_TYPE'
export
const
DEFAULT_THEME
=
'DEFAULT_THEME'
export
const
DEFAULT_COLOR
=
'DEFAULT_COLOR'
\ No newline at end of file
export
const
DEFAULT_COLOR
=
'DEFAULT_COLOR'
export
const
DEFAULT_COLOR_WEAK
=
'DEFAULT_COLOR_WEAK'
\ No newline at end of file
src/views/Login.vue
View file @
6dfc580c
...
...
@@ -122,15 +122,13 @@
}
},
created
()
{
/*
this
.
$http
.
get
(
'/auth/2step-code'
)
.
then
(
res
=>
{
this.requiredTwoStepCaptcha = res.result
this
.
requiredTwoStepCaptcha
=
res
.
result
.
stepCode
}).
catch
(
err
=>
{
console
.
log
(
'2step-code:'
,
err
)
})
*/
this
.
requiredTwoStepCaptcha
=
true
// this.requiredTwoStepCaptcha = true
},
methods
:
{
...
...
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