Merge remote-tracking branch 'origin/develop'
Former-commit-id: 264b67ad157544264ee94ca817593ba5a186d62e [formerly 264b67ad157544264ee94ca817593ba5a186d62e [formerly 264b67ad157544264ee94ca817593ba5a186d62e [formerly 264b67ad157544264ee94ca817593ba5a186d62e [formerly e473190433cd7a17691fbd7e8e8e31cd663e8d14 [formerly 1b69c28fb22da52722695c2918d7bf685c518e1b]]]]] Former-commit-id: 886aeca9e97e6feac8762aaa05f1855d1adc64d8 Former-commit-id: 914ae10f3ba6fd7c93e48685edf226e2810c6d06 Former-commit-id: af8007fb8d6e01d8d6a7be0e02bee85b04f72dc7 [formerly cec61c9b1b2fd46681599c2c3e1c570d8c95fb1e] Former-commit-id: e4f450aaf9dd689c037d8f32d00d31ed5f6bacf3 Former-commit-id: 092773d0572e32f367d64e32d32c109e4d9af1c3 Former-commit-id: b878c86619eaff4fad3509f327fcf19429a7e00d Former-commit-id: 2318e5a0f9fc7bff8662c7826b44f9351f4ef385 Former-commit-id: a7c3174ad0e584d59bcaa57003d0d40880049fc6
This commit is contained in:
1
package-lock.json.REMOVED.git-id
Normal file
1
package-lock.json.REMOVED.git-id
Normal file
@@ -0,0 +1 @@
|
|||||||
|
0db501622270146313d905a0a5f39854fb2494ac
|
||||||
@@ -1 +1 @@
|
|||||||
76c08deda5f3f6bd81e91aeb695cae984eab131e
|
875522462ce00aa53ebb933ad8a70561bf30dfc5
|
||||||
58
src/layout/header-aside/components/header-size/index.vue
Normal file
58
src/layout/header-aside/components/header-size/index.vue
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<template>
|
||||||
|
<el-dropdown placement="bottom" size="small" @command="handleChange">
|
||||||
|
<el-button class="d2-mr btn-text can-hover" type="text">
|
||||||
|
<d2-icon name="font" style="font-size: 16px;"/>
|
||||||
|
</el-button>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
<el-dropdown-item command="">
|
||||||
|
<d2-icon :name="iconName('default')" class="d2-mr-5"/>默认
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="medium">
|
||||||
|
<d2-icon :name="iconName('medium')" class="d2-mr-5"/>中
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="small">
|
||||||
|
<d2-icon :name="iconName('small')" class="d2-mr-5"/>小
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item command="mini">
|
||||||
|
<d2-icon :name="iconName('mini')" class="d2-mr-5"/>最小
|
||||||
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapState, mapMutations } from 'vuex'
|
||||||
|
export default {
|
||||||
|
name: 'd2-header-size',
|
||||||
|
computed: {
|
||||||
|
...mapState('d2admin/size', [
|
||||||
|
'value'
|
||||||
|
])
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
// 注意 这里是关键
|
||||||
|
// 因为需要访问 this.$ELEMENT 所以只能在这里使用这种方式
|
||||||
|
value: {
|
||||||
|
handler (val) {
|
||||||
|
this.$ELEMENT.size = val
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapMutations('d2admin/size', [
|
||||||
|
'set'
|
||||||
|
]),
|
||||||
|
handleChange (value) {
|
||||||
|
this.set(value)
|
||||||
|
this.$message({
|
||||||
|
message: `设置尺寸成功 ${value}`,
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
iconName (name) {
|
||||||
|
return name === this.value ? 'dot-circle-o' : 'circle-o'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dropdown class="d2-mr">
|
<el-dropdown size="small" class="d2-mr">
|
||||||
<span class="btn-text">你好 {{info.name}}</span>
|
<span class="btn-text">你好 {{info.name}}</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item @click.native="logOff">
|
<el-dropdown-item @click.native="logOff">
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
class="d2-multiple-page-control-btn"
|
class="d2-multiple-page-control-btn"
|
||||||
flex-box="0">
|
flex-box="0">
|
||||||
<el-dropdown
|
<el-dropdown
|
||||||
|
size="default"
|
||||||
split-button
|
split-button
|
||||||
@click="handleControlBtnClick"
|
@click="handleControlBtnClick"
|
||||||
@command="command => handleControlItemClick(command)">
|
@command="command => handleControlItemClick(command)">
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
<d2-header-error-log/>
|
<d2-header-error-log/>
|
||||||
<d2-header-fullscreen/>
|
<d2-header-fullscreen/>
|
||||||
<d2-header-theme/>
|
<d2-header-theme/>
|
||||||
|
<d2-header-size/>
|
||||||
<d2-header-user/>
|
<d2-header-user/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -92,6 +93,7 @@ export default {
|
|||||||
'd2-tabs': () => import('./components/tabs'),
|
'd2-tabs': () => import('./components/tabs'),
|
||||||
'd2-header-fullscreen': () => import('./components/header-fullscreen'),
|
'd2-header-fullscreen': () => import('./components/header-fullscreen'),
|
||||||
'd2-header-search': () => import('./components/header-search'),
|
'd2-header-search': () => import('./components/header-search'),
|
||||||
|
'd2-header-size': () => import('./components/header-size'),
|
||||||
'd2-header-theme': () => import('./components/header-theme'),
|
'd2-header-theme': () => import('./components/header-theme'),
|
||||||
'd2-header-user': () => import('./components/header-user'),
|
'd2-header-user': () => import('./components/header-user'),
|
||||||
'd2-header-error-log': () => import('./components/header-error-log')
|
'd2-header-error-log': () => import('./components/header-error-log')
|
||||||
@@ -106,12 +108,12 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState('d2admin', {
|
...mapState('d2admin', {
|
||||||
|
keepAlive: state => state.page.keepAlive,
|
||||||
grayActive: state => state.gray.active,
|
grayActive: state => state.gray.active,
|
||||||
transitionActive: state => state.transition.active,
|
transitionActive: state => state.transition.active,
|
||||||
asideCollapse: state => state.menu.asideCollapse
|
asideCollapse: state => state.menu.asideCollapse
|
||||||
}),
|
}),
|
||||||
...mapGetters('d2admin', {
|
...mapGetters('d2admin', {
|
||||||
keepAlive: 'page/keepAlive',
|
|
||||||
themeActiveSetting: 'theme/activeSetting'
|
themeActiveSetting: 'theme/activeSetting'
|
||||||
}),
|
}),
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<!-- 表单部分 -->
|
<!-- 表单部分 -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<el-card>
|
<el-card>
|
||||||
<el-form ref="loginForm" label-position="top" :rules="rules" :model="formLogin">
|
<el-form ref="loginForm" label-position="top" :rules="rules" :model="formLogin" size="default">
|
||||||
<el-form-item prop="username">
|
<el-form-item prop="username">
|
||||||
<el-input type="text" v-model="formLogin.username" placeholder="用户名">
|
<el-input type="text" v-model="formLogin.username" placeholder="用户名">
|
||||||
<i slot="prepend" class="fa fa-user-circle-o"></i>
|
<i slot="prepend" class="fa fa-user-circle-o"></i>
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import ElementUI from 'element-ui'
|
|||||||
import 'element-ui/lib/theme-chalk/index.css'
|
import 'element-ui/lib/theme-chalk/index.css'
|
||||||
// flex 布局库
|
// flex 布局库
|
||||||
import 'flex.css'
|
import 'flex.css'
|
||||||
|
// store
|
||||||
|
import store from '@/store/index'
|
||||||
// 组件
|
// 组件
|
||||||
import '@/components'
|
import '@/components'
|
||||||
// svg 图标
|
// svg 图标
|
||||||
@@ -15,9 +17,19 @@ import pluginLog from '@/plugin/log'
|
|||||||
import pluginOpen from '@/plugin/open'
|
import pluginOpen from '@/plugin/open'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
install (Vue, options) {
|
async install (Vue, options) {
|
||||||
|
// 获得用户设置的全局尺寸
|
||||||
|
const size = await store.dispatch('d2admin/db/get', {
|
||||||
|
dbName: 'sys',
|
||||||
|
path: 'size.value',
|
||||||
|
defaultValue: '',
|
||||||
|
user: true
|
||||||
|
})
|
||||||
|
console.log('size: ', size)
|
||||||
// Element
|
// Element
|
||||||
Vue.use(ElementUI)
|
Vue.use(ElementUI, {
|
||||||
|
size
|
||||||
|
})
|
||||||
// 插件
|
// 插件
|
||||||
Vue.use(pluginError)
|
Vue.use(pluginError)
|
||||||
Vue.use(pluginExport)
|
Vue.use(pluginExport)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import gray from './modules/gray'
|
|||||||
import page from './modules/page'
|
import page from './modules/page'
|
||||||
import transition from './modules/transition'
|
import transition from './modules/transition'
|
||||||
import search from './modules/search'
|
import search from './modules/search'
|
||||||
|
import size from './modules/size'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
@@ -27,6 +28,7 @@ export default {
|
|||||||
gray,
|
gray,
|
||||||
page,
|
page,
|
||||||
transition,
|
transition,
|
||||||
search
|
search,
|
||||||
|
size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,8 +108,10 @@ export default {
|
|||||||
this.commit('d2admin/transition/load')
|
this.commit('d2admin/transition/load')
|
||||||
// DB -> store 持久化数据加载上次退出时的多页列表
|
// DB -> store 持久化数据加载上次退出时的多页列表
|
||||||
this.commit('d2admin/page/openedLoad')
|
this.commit('d2admin/page/openedLoad')
|
||||||
// DB -> store 持久化数据加载这个用户之前设置的侧边栏折叠状态
|
// DB -> store 持久化数据加载侧边栏折叠状态
|
||||||
this.commit('d2admin/menu/asideCollapseLoad')
|
this.commit('d2admin/menu/asideCollapseLoad')
|
||||||
|
// DB -> store 持久化数据加载全局尺寸
|
||||||
|
this.commit('d2admin/size/load')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,18 @@ export default {
|
|||||||
// 当前显示的多页面列表
|
// 当前显示的多页面列表
|
||||||
opened: setting.page.opened,
|
opened: setting.page.opened,
|
||||||
// 当前页面
|
// 当前页面
|
||||||
current: ''
|
current: '',
|
||||||
|
// 需要缓存的页面 name
|
||||||
|
keepAlive: []
|
||||||
},
|
},
|
||||||
getters: {
|
mutations: {
|
||||||
/**
|
/**
|
||||||
* @description 从当前所有打开的多标签页里返回需要缓存的页面 name
|
* @class keepAlive
|
||||||
* @param {*} state vuex state
|
* @description 从已经打开的页面记录中更新需要缓存的页面记录
|
||||||
|
* @param {Object} state vuex state
|
||||||
*/
|
*/
|
||||||
keepAlive (state) {
|
updateKeepAliveFromOpened (state) {
|
||||||
return state.opened.filter(item => {
|
state.keepAlive = state.opened.filter(item => {
|
||||||
if (item.meta) {
|
if (item.meta) {
|
||||||
if (item.meta.notCache) {
|
if (item.meta.notCache) {
|
||||||
return false
|
return false
|
||||||
@@ -25,9 +28,7 @@ export default {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}).map(e => e.name)
|
}).map(e => e.name)
|
||||||
}
|
},
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
/**
|
/**
|
||||||
* @class current
|
* @class current
|
||||||
* @description 打开一个新的页面
|
* @description 打开一个新的页面
|
||||||
|
|||||||
38
src/store/modules/d2admin/modules/size.js
Normal file
38
src/store/modules/d2admin/modules/size.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
export default {
|
||||||
|
namespaced: true,
|
||||||
|
state: {
|
||||||
|
// 尺寸
|
||||||
|
value: '' // medium small mini
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
/**
|
||||||
|
* @description 设置尺寸
|
||||||
|
* @param {Object} state vuex state
|
||||||
|
* @param {String} size 尺寸
|
||||||
|
*/
|
||||||
|
set (state, size) {
|
||||||
|
// store 赋值
|
||||||
|
state.value = size
|
||||||
|
// 持久化
|
||||||
|
this.dispatch('d2admin/db/set', {
|
||||||
|
dbName: 'sys',
|
||||||
|
path: 'size.value',
|
||||||
|
value: state.value,
|
||||||
|
user: true
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @description 从持久化数据读取尺寸设置
|
||||||
|
* @param {Object} state vuex state
|
||||||
|
*/
|
||||||
|
async load (state) {
|
||||||
|
// store 赋值
|
||||||
|
state.value = await this.dispatch('d2admin/db/get', {
|
||||||
|
dbName: 'sys',
|
||||||
|
path: 'size.value',
|
||||||
|
defaultValue: 'default',
|
||||||
|
user: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user