Former-commit-id: 553d22bc2ba6a095e0d1667e70db497816e102c2 [formerly 553d22bc2ba6a095e0d1667e70db497816e102c2 [formerly 553d22bc2ba6a095e0d1667e70db497816e102c2 [formerly 553d22bc2ba6a095e0d1667e70db497816e102c2 [formerly be58b4c910710a1067ee07bbf2fedd515d94dff8 [formerly 206041f166f2525d783041c2e5db14c37e5f6392]]]]]
Former-commit-id: 086628abb7a77b20f8e0d973d3ef09be9d392810
Former-commit-id: b67bf6ad83f4546de9fcbf455dd498ee73ffd8ec
Former-commit-id: 6f47fb5c2b7d1804fac39e8f0c7fba280964ac9c [formerly 344e5b1af573b8320a6a3881aab28e2ad412c6e6]
Former-commit-id: b2ab2bd7a19e5cde49e78431125bc2847fc9272c
Former-commit-id: 0cb0c74ef934a7d23cb8a710e98b4e58583a4713
Former-commit-id: 5a417644c344269ea2ec26929531f1f5464d2c26
Former-commit-id: d2cd0166b2796e29bdb54bbacdf2df5775eb2990
Former-commit-id: 2c800218a2dc22835b7e46b094349d92a925f823
This commit is contained in:
liyang
2018-08-09 15:49:39 +08:00
parent 2418411047
commit aa1fa7932f
6 changed files with 51 additions and 28 deletions

View File

@@ -2,7 +2,7 @@
<div <div
class="d2-layout-header-aside-group" class="d2-layout-header-aside-group"
:style="styleLayoutMainGroup" :style="styleLayoutMainGroup"
:class="{grayMode: isGrayMode}"> :class="{grayMode: grayActive}">
<!-- 半透明遮罩 --> <!-- 半透明遮罩 -->
<div class="d2-layout-header-aside-mask"></div> <div class="d2-layout-header-aside-mask"></div>
<!-- 主体内容 --> <!-- 主体内容 -->
@@ -78,13 +78,11 @@ export default {
} }
}, },
computed: { computed: {
...mapState('d2admin', [ ...mapState('d2admin', {
'isGrayMode', grayActive: state => state.gray.active,
'pageOpenedList' pageOpenedList: 'pageOpenedList',
]), asideCollapse: state => state.menu.asideCollapse
...mapState('d2admin/menu', [ }),
'asideCollapse'
]),
...mapGetters('d2admin', { ...mapGetters('d2admin', {
keepAliveInclude: 'keepAliveInclude', keepAliveInclude: 'keepAliveInclude',
themeActiveSetting: 'theme/activeSetting' themeActiveSetting: 'theme/activeSetting'

View File

@@ -1,12 +1,12 @@
<template> <template>
<d2-container type="card" class="page-demo-playground-gray"> <d2-container type="card" class="page-demo-playground-gray">
<template slot="header"> <template slot="header">
<div class="colorful">{{isGrayMode ? 'GRAY' : 'COLORFUL'}}</div> <div class="colorful">{{grayActive ? 'GRAY' : 'COLORFUL'}}</div>
</template> </template>
<el-button-group> <el-button-group>
<el-button @click="grayModeToggle">切换灰度模式</el-button> <el-button @click="grayToggle">切换灰度模式</el-button>
<el-button @click="grayModeSet(true)">打开灰度模式</el-button> <el-button @click="graySet(true)">打开灰度模式</el-button>
<el-button @click="grayModeSet(false)">关闭灰度模式</el-button> <el-button @click="graySet(false)">关闭灰度模式</el-button>
<el-button @click="dialogVisible = true">模拟报错提示框</el-button> <el-button @click="dialogVisible = true">模拟报错提示框</el-button>
</el-button-group> </el-button-group>
<el-dialog <el-dialog
@@ -47,20 +47,20 @@ export default {
} }
}, },
computed: { computed: {
...mapState('d2admin', [ ...mapState('d2admin/gray', {
'isGrayMode' grayActive: 'active'
]) })
}, },
methods: { methods: {
...mapMutations('d2admin', [ ...mapMutations('d2admin/gray', {
'grayModeToggle', grayToggle: 'toggle',
'grayModeSet' graySet: 'set'
]), }),
handleDialogOpen () { handleDialogOpen () {
this.grayModeSet(true) this.graySet(true)
}, },
handleDialogClosed () { handleDialogClosed () {
this.grayModeSet(false) this.graySet(false)
} }
} }
} }

View File

@@ -36,7 +36,7 @@
<el-col :span="8"> <el-col :span="8">
<el-card shadow="never" class="d2-card d2-mb"> <el-card shadow="never" class="d2-card d2-mb">
<template slot="header">灰度模式</template> <template slot="header">灰度模式</template>
<el-switch v-model="isGrayMode" active-text="打开" inactive-text="关闭" disabled/> <el-switch v-model="grayActive" active-text="打开" inactive-text="关闭" disabled/>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
@@ -147,10 +147,11 @@ export default {
themeList: state => state.theme.list, themeList: state => state.theme.list,
themeActiveName: state => state.theme.activeName, themeActiveName: state => state.theme.activeName,
// 全屏 // 全屏
fullscreenActive: state => state.fullscreen.active fullscreenActive: state => state.fullscreen.active,
// 灰度模式
grayActive: state => state.gray.active
}), }),
...mapState('d2admin', [ ...mapState('d2admin', [
'isGrayMode',
'pagePool', 'pagePool',
'pageOpenedList', 'pageOpenedList',
'pageCurrent' 'pageCurrent'

View File

@@ -1 +1 @@
33558b2365f6936e850cfc9012fbe3de139d35db 7b5d8397bdcecf19c6a41794af54b11186811d0e

View File

@@ -66,18 +66,18 @@ export default {
} }
// 判断是否需要确认 // 判断是否需要确认
if (confirm) { if (confirm) {
commit('d2admin/grayModeSet', true, { root: true }) commit('d2admin/gray/set', true, { root: true })
vm.$confirm('注销当前账户吗? 打开的标签页和用户设置将会被保存。', '确认操作', { vm.$confirm('注销当前账户吗? 打开的标签页和用户设置将会被保存。', '确认操作', {
confirmButtonText: '确定注销', confirmButtonText: '确定注销',
cancelButtonText: '放弃', cancelButtonText: '放弃',
type: 'warning' type: 'warning'
}) })
.then(() => { .then(() => {
commit('d2admin/grayModeSet', false, { root: true }) commit('d2admin/gray/set', false, { root: true })
logout() logout()
}) })
.catch(() => { .catch(() => {
commit('d2admin/grayModeSet', false, { root: true }) commit('d2admin/gray/set', false, { root: true })
vm.$message('放弃注销用户') vm.$message('放弃注销用户')
}) })
} else { } else {

View File

@@ -0,0 +1,24 @@
export default {
namespaced: true,
state: {
// 灰度
active: false
},
mutations: {
/**
* @description 切换灰度状态
* @param {Object} state vuex state
*/
toggle (state) {
state.active = !state.active
},
/**
* @description 设置灰度模式
* @param {Object} state vuex state
* @param {Boolean} value new value
*/
set (state, value) {
state.active = value
}
}
}