Merge branch 'feature/store-module' into develop

# Conflicts:
#	src/pages/demo/playground/store/menu/index.vue


Former-commit-id: 77cb9e9175b35a94c8c5cbefb6981f75718bf282 [formerly 77cb9e9175b35a94c8c5cbefb6981f75718bf282 [formerly 77cb9e9175b35a94c8c5cbefb6981f75718bf282 [formerly 77cb9e9175b35a94c8c5cbefb6981f75718bf282 [formerly 6ebe5372a382d911bdbe82f5a1867f72ab58f286 [formerly f7811326ccd36bd64b92f6c3094060be390a2b76]]]]]
Former-commit-id: 1a0ec7498901cca64a7d12c2b2c8f13ae701ca21
Former-commit-id: 3531de0dd9e330312c5073676f4c3aa82d28dfb9
Former-commit-id: cc70c17a885ff8b72df8b799921e38fbcbedd3e9 [formerly 73282cfd24758da343bea77d413773d569606110]
Former-commit-id: fa461f51727fdfc67b8ae790e1f0df161f85ca8b
Former-commit-id: 10e2f2cfce4a446c01957229fe254e4c5ec211a6
Former-commit-id: 602f7a473458e6f5f0d5ec96388e608971daca34
Former-commit-id: bb4a69677e9c9a76c8f653fb2b7c714eff13fa67
Former-commit-id: 277ce50885de084a418ba885418c22e8978e3c22
This commit is contained in:
liyang
2018-08-12 08:07:35 +08:00
39 changed files with 1372 additions and 371 deletions

View File

@@ -9,12 +9,12 @@
type="text"
@click="handleClick">
<el-badge
v-if="d2adminLogLength > 0"
v-if="logLength > 0"
:max="99"
:value="d2adminLogErrorLength"
:is-dot="d2adminLogErrorLength === 0">
:value="logLengthError"
:is-dot="logLengthError === 0">
<d2-icon
:name="d2adminLogErrorLength === 0 ? 'dot-circle-o' : 'bug'"
:name="logLengthError === 0 ? 'dot-circle-o' : 'bug'"
style="font-size: 20px"/>
</el-badge>
<d2-icon
@@ -49,30 +49,30 @@ export default {
}
},
computed: {
...mapGetters([
'd2adminLogLength',
'd2adminLogErrorLength'
]),
...mapGetters('d2admin', {
logLength: 'log/length',
logLengthError: 'log/lengthError'
}),
tooltipContent () {
return this.d2adminLogLength === 0
return this.logLength === 0
? '没有日志或异常'
: `${this.d2adminLogLength} 条日志${this.d2adminLogErrorLength > 0
? ` | 包含 ${this.d2adminLogErrorLength} 个异常`
: `${this.logLength} 条日志${this.logLengthError > 0
? ` | 包含 ${this.logLengthError} 个异常`
: ''}`
}
},
methods: {
...mapMutations([
'd2adminLogClean'
...mapMutations('d2admin/log', [
'clean'
]),
handleClick () {
if (this.d2adminLogLength > 0) {
if (this.logLength > 0) {
this.dialogVisible = true
}
},
handleLogClean () {
this.dialogVisible = false
this.d2adminLogClean()
this.clean()
}
}
}

View File

@@ -1,10 +1,10 @@
<template>
<el-tooltip
effect="dark"
:content="isFullScreen ? '退出全屏' : '全屏'"
:content="active ? '退出全屏' : '全屏'"
placement="bottom">
<el-button class="d2-mr btn-text can-hover" type="text" @click="d2adminFullScreenToggle">
<d2-icon v-if="isFullScreen" name="compress"/>
<el-button class="d2-mr btn-text can-hover" type="text" @click="toggle">
<d2-icon v-if="active" name="compress"/>
<d2-icon v-else name="arrows-alt" style="font-size: 16px"/>
</el-button>
</el-tooltip>
@@ -14,13 +14,13 @@
import { mapState, mapMutations } from 'vuex'
export default {
computed: {
...mapState({
isFullScreen: state => state.d2admin.isFullScreen
})
...mapState('d2admin/fullscreen', [
'active'
])
},
methods: {
...mapMutations([
'd2adminFullScreenToggle'
...mapMutations('d2admin/fullscreen', [
'toggle'
])
}
}

View File

@@ -1,5 +1,5 @@
<template>
<el-table :data="themeList" v-bind="table">
<el-table :data="list" v-bind="table">
<el-table-column prop="title" align="center" width="160"/>
<el-table-column label="预览" width="120">
<div
@@ -10,7 +10,7 @@
</el-table-column>
<el-table-column prop="address" align="center">
<template slot-scope="scope">
<el-button v-if="themeActiveName === scope.row.name" type="success" icon="el-icon-check" round>已激活</el-button>
<el-button v-if="activeName === scope.row.name" type="success" icon="el-icon-check" round>已激活</el-button>
<el-button v-else round @click="handleSelectTheme(scope.row.name)">使用</el-button>
</template>
</el-table-column>
@@ -30,17 +30,17 @@ export default {
}
},
computed: {
...mapState({
themeList: state => state.d2admin.themeList,
themeActiveName: state => state.d2admin.themeActiveName
})
...mapState('d2admin/theme', [
'list',
'activeName'
])
},
methods: {
...mapMutations([
'd2adminThemeSet'
...mapMutations('d2admin/theme', [
'set'
]),
handleSelectTheme (name) {
this.d2adminThemeSet(name)
this.set(name)
}
}
}

View File

@@ -1,6 +1,6 @@
<template>
<el-dropdown class="d2-mr">
<span class="btn-text">你好 {{userInfo.name}}</span>
<span class="btn-text">你好 {{info.name}}</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="logOff">
<d2-icon name="power-off" class="d2-mr-5"/>
@@ -14,19 +14,19 @@
import { mapState, mapActions } from 'vuex'
export default {
computed: {
...mapState({
userInfo: state => state.d2admin.userInfo
})
...mapState('d2admin/user', [
'info'
])
},
methods: {
...mapActions([
'd2adminLogout'
...mapActions('d2admin/account', [
'logout'
]),
/**
* @description 登出
*/
logOff () {
this.d2adminLogout({
this.logout({
vm: this,
confirm: true
})

View File

@@ -1,6 +1,6 @@
<template>
<el-menu mode="horizontal" @select="handleMenuSelect">
<template v-for="(menu, menuIndex) in menuHeader">
<template v-for="(menu, menuIndex) in header">
<d2-layout-header-aside-menu-item v-if="menu.children === undefined" :menu="menu" :key="menuIndex"/>
<d2-layout-header-aside-menu-sub v-else :menu="menu" :key="menuIndex"/>
</template>
@@ -22,9 +22,9 @@ export default {
'd2-layout-header-aside-menu-sub': d2LayoutMainMenuSub
},
computed: {
...mapState({
menuHeader: state => state.d2admin.menuHeader
})
...mapState('d2admin/menu', [
'header'
])
}
}
</script>

View File

@@ -1,17 +1,17 @@
<template>
<div class="d2-layout-header-aside-menu-side">
<el-menu
:collapse="isMenuAsideCollapse"
:collapse="asideCollapse"
:unique-opened="true"
:default-active="active"
ref="menu"
@select="handleMenuSelect">
<template v-for="(menu, menuIndex) in menuAside">
<template v-for="(menu, menuIndex) in aside">
<d2-layout-header-aside-menu-item v-if="menu.children === undefined" :menu="menu" :key="menuIndex"/>
<d2-layout-header-aside-menu-sub v-else :menu="menu" :key="menuIndex"/>
</template>
</el-menu>
<div v-if="menuAside.length === 0 && !isMenuAsideCollapse" class="d2-layout-header-aside-menu-empty" flex="dir:top main:center cross:center">
<div v-if="aside.length === 0 && !asideCollapse" class="d2-layout-header-aside-menu-empty" flex="dir:top main:center cross:center">
<d2-icon name="inbox"/>
<span>没有侧栏菜单</span>
</div>
@@ -41,14 +41,14 @@ export default {
}
},
computed: {
...mapState({
menuAside: state => state.d2admin.menuAside,
isMenuAsideCollapse: state => state.d2admin.isMenuAsideCollapse
})
...mapState('d2admin/menu', [
'aside',
'asideCollapse'
])
},
watch: {
// 折叠和展开菜单的时候销毁 better scroll
isMenuAsideCollapse (val) {
asideCollapse (val) {
this.scrollDestroy()
setTimeout(() => {
this.scrollInit()
@@ -59,7 +59,7 @@ export default {
handler (val) {
this.active = val[val.length - 1].path
this.$nextTick(() => {
if (this.menuAside.length > 0) {
if (this.aside.length > 0) {
this.$refs.menu.activeIndex = this.active
}
})

View File

@@ -12,14 +12,14 @@
</d2-contextmenu>
<el-tabs
class="d2-multiple-page-control"
:value="pageCurrent"
:value="current"
type="card"
:closable="true"
@tab-click="handleClick"
@edit="handleTabsEdit"
@contextmenu.native="handleContextmenu">
<el-tab-pane
v-for="(page, index) in pageOpenedList"
v-for="(page, index) in opened"
:key="index"
:label="page.meta.title || '未命名'"
:name="page.name"/>
@@ -82,17 +82,18 @@ export default {
}
},
computed: {
...mapState({
pageOpenedList: state => state.d2admin.pageOpenedList,
pageCurrent: state => state.d2admin.pageCurrent
})
...mapState('d2admin/page', [
'opened',
'current'
])
},
methods: {
...mapMutations([
'd2adminTagCloseLeft',
'd2adminTagCloseRight',
'd2adminTagCloseOther',
'd2adminTagCloseAll'
...mapMutations('d2admin/page', [
'close',
'closeLeft',
'closeRight',
'closeOther',
'closeAll'
]),
/**
* @description 右键菜单功能点击
@@ -136,16 +137,16 @@ export default {
}
switch (command) {
case 'left':
this.d2adminTagCloseLeft(params)
this.closeLeft(params)
break
case 'right':
this.d2adminTagCloseRight(params)
this.closeRight(params)
break
case 'other':
this.d2adminTagCloseOther(params)
this.closeOther(params)
break
case 'all':
this.d2adminTagCloseAll(this)
this.closeAll(this)
break
default:
this.$message.error('无效的操作')
@@ -156,14 +157,14 @@ export default {
* @description 接收点击关闭控制上按钮的事件
*/
handleControlBtnClick () {
this.d2adminTagCloseAll(this)
this.closeAll(this)
},
/**
* @description 接收点击 tab 标签的事件
*/
handleClick (tab, event) {
// 找到点击的页面在 tag 列表里是哪个
const page = this.pageOpenedList.find(page => page.name === tab.name)
const page = this.opened.find(page => page.name === tab.name)
const { name, params, query } = page
if (page) {
this.$router.push({ name, params, query })
@@ -174,7 +175,7 @@ export default {
*/
handleTabsEdit (tagName, action) {
if (action === 'remove') {
this.$store.commit('d2adminTagClose', {
this.close({
tagName,
vm: this
})

View File

@@ -2,16 +2,16 @@
<div
class="d2-layout-header-aside-group"
:style="styleLayoutMainGroup"
:class="{grayMode: isGrayMode}">
:class="{grayMode: grayActive}">
<!-- 半透明遮罩 -->
<div class="d2-layout-header-aside-mask"></div>
<!-- 主体内容 -->
<div class="d2-layout-header-aside-content" flex="dir:top">
<!-- 顶栏 -->
<div class="d2-theme-header" flex-box="0">
<div class="logo-group" :style="{width: isMenuAsideCollapse ? asideWidthCollapse : asideWidth}">
<img v-if="isMenuAsideCollapse" :src="`${$baseUrl}image/theme/${d2adminThemeActiveSetting.name}/logo/icon-only.png`">
<img v-else :src="`${$baseUrl}image/theme/${d2adminThemeActiveSetting.name}/logo/all.png`">
<div class="logo-group" :style="{width: asideCollapse ? asideWidthCollapse : asideWidth}">
<img v-if="asideCollapse" :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/icon-only.png`">
<img v-else :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/all.png`">
</div>
<div class="toggle-aside-btn" @click="handleToggleAside">
<d2-icon name="bars"/>
@@ -34,7 +34,7 @@
flex-box="0"
ref="aside"
class="d2-theme-container-aside"
:style="{width: isMenuAsideCollapse ? asideWidthCollapse : asideWidth}">
:style="{width: asideCollapse ? asideWidthCollapse : asideWidth}">
<d2-menu-side/>
</div>
<!-- 主体 -->
@@ -44,7 +44,7 @@
</div>
<div class="d2-theme-container-main-body" flex-box="1">
<transition name="fade-transverse">
<keep-alive :include="d2adminKeepAliveInclude">
<keep-alive :include="keepAlive">
<router-view/>
</keep-alive>
</transition>
@@ -78,35 +78,34 @@ export default {
}
},
computed: {
...mapState({
isGrayMode: state => state.d2admin.isGrayMode,
pageOpenedList: state => state.d2admin.pageOpenedList,
isMenuAsideCollapse: state => state.d2admin.isMenuAsideCollapse
...mapState('d2admin', {
grayActive: state => state.gray.active,
asideCollapse: state => state.menu.asideCollapse
}),
...mapGetters('d2admin', {
keepAlive: 'page/keepAlive',
themeActiveSetting: 'theme/activeSetting'
}),
...mapGetters([
'd2adminThemeActiveSetting',
'd2adminKeepAliveInclude'
]),
/**
* @description 最外层容器的背景图片样式
*/
styleLayoutMainGroup () {
return {
...this.d2adminThemeActiveSetting.backgroundImage ? {
backgroundImage: `url('${this.$baseUrl}${this.d2adminThemeActiveSetting.backgroundImage}')`
...this.themeActiveSetting.backgroundImage ? {
backgroundImage: `url('${this.$baseUrl}${this.themeActiveSetting.backgroundImage}')`
} : {}
}
}
},
methods: {
...mapMutations([
'd2adminMenuAsideCollapseToggle'
...mapMutations('d2admin/menu', [
'asideCollapseToggle'
]),
/**
* 接收点击切换侧边栏的按钮
*/
handleToggleAside () {
this.d2adminMenuAsideCollapseToggle()
this.asideCollapseToggle()
}
}
}