添加命名空间

Former-commit-id: 63fcb6e8af280eb6aa1847600c096fb48cf53ea1 [formerly 63fcb6e8af280eb6aa1847600c096fb48cf53ea1 [formerly 63fcb6e8af280eb6aa1847600c096fb48cf53ea1 [formerly 63fcb6e8af280eb6aa1847600c096fb48cf53ea1 [formerly 632d40c9d0643c6a24abfb7b58b999d829d4f4e5 [formerly 57132b61c7b2f326d08dbe138fda1fac4cb83c62]]]]]
Former-commit-id: c0cb71135408e03add94e219759ae37cfb75f31b
Former-commit-id: 7f8209eae78f59e644c204712c31dff787899384
Former-commit-id: b08fbd31671e552da8012eb3ee901edf4f89c0e9 [formerly bb7abe3cc56f2f376a59413c370032d896b50c38]
Former-commit-id: 0872ac8e17b45829eee426dc5f80f25e37c85ea3
Former-commit-id: 373b0874ce730b26f256600de55a39b2e40d5f9f
Former-commit-id: 472309b468a04d5e57a1a917a6472061668cc7f0
Former-commit-id: 88ad7d087a7382d66523f481b7e1476c21f2830d
Former-commit-id: 6557698b7db15cc1b62cf9c3976521de6cc194cd
This commit is contained in:
liyang
2018-08-08 09:19:11 +08:00
parent 129732558f
commit b1459f100d
24 changed files with 170 additions and 170 deletions

View File

@@ -136,9 +136,9 @@ export default {
ExpandItem ExpandItem
}, },
computed: { computed: {
...mapState({ ...mapState('d2admin', [
log: state => state.d2admin.log 'log'
}), ]),
logReverse () { logReverse () {
// 直接 reverse 的话有点问题 // 直接 reverse 的话有点问题
const res = [] const res = []

View File

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

View File

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

View File

@@ -30,17 +30,17 @@ export default {
} }
}, },
computed: { computed: {
...mapState({ ...mapState('d2admin', [
themeList: state => state.d2admin.themeList, 'themeList',
themeActiveName: state => state.d2admin.themeActiveName 'themeActiveName'
}) ])
}, },
methods: { methods: {
...mapMutations([ ...mapMutations('d2admin', [
'd2adminThemeSet' 'themeSet'
]), ]),
handleSelectTheme (name) { handleSelectTheme (name) {
this.d2adminThemeSet(name) this.themeSet(name)
} }
} }
} }

View File

@@ -14,19 +14,19 @@
import { mapState, mapActions } from 'vuex' import { mapState, mapActions } from 'vuex'
export default { export default {
computed: { computed: {
...mapState({ ...mapState('d2admin', [
userInfo: state => state.d2admin.userInfo 'userInfo'
}) ])
}, },
methods: { methods: {
...mapActions([ ...mapActions('d2admin', [
'd2adminLogout' 'logout'
]), ]),
/** /**
* @description 登出 * @description 登出
*/ */
logOff () { logOff () {
this.d2adminLogout({ this.logout({
vm: this, vm: this,
confirm: true confirm: true
}) })

View File

@@ -22,9 +22,9 @@ export default {
'd2-layout-header-aside-menu-sub': d2LayoutMainMenuSub 'd2-layout-header-aside-menu-sub': d2LayoutMainMenuSub
}, },
computed: { computed: {
...mapState({ ...mapState('d2admin', [
menuHeader: state => state.d2admin.menuHeader 'menuHeader'
}) ])
} }
} }
</script> </script>

View File

@@ -41,10 +41,10 @@ export default {
} }
}, },
computed: { computed: {
...mapState({ ...mapState('d2admin', [
menuAside: state => state.d2admin.menuAside, 'menuAside',
isMenuAsideCollapse: state => state.d2admin.isMenuAsideCollapse 'isMenuAsideCollapse'
}) ])
}, },
watch: { watch: {
// 折叠和展开菜单的时候销毁 better scroll // 折叠和展开菜单的时候销毁 better scroll

View File

@@ -82,17 +82,17 @@ export default {
} }
}, },
computed: { computed: {
...mapState({ ...mapState('d2admin', [
pageOpenedList: state => state.d2admin.pageOpenedList, 'pageOpenedList',
pageCurrent: state => state.d2admin.pageCurrent 'pageCurrent'
}) ])
}, },
methods: { methods: {
...mapMutations([ ...mapMutations('d2admin', [
'd2adminTagCloseLeft', 'tagCloseLeft',
'd2adminTagCloseRight', 'tagCloseRight',
'd2adminTagCloseOther', 'tagCloseOther',
'd2adminTagCloseAll' 'tagCloseAll'
]), ]),
/** /**
* @description 右键菜单功能点击 * @description 右键菜单功能点击
@@ -136,16 +136,16 @@ export default {
} }
switch (command) { switch (command) {
case 'left': case 'left':
this.d2adminTagCloseLeft(params) this.tagCloseLeft(params)
break break
case 'right': case 'right':
this.d2adminTagCloseRight(params) this.tagCloseRight(params)
break break
case 'other': case 'other':
this.d2adminTagCloseOther(params) this.tagCloseOther(params)
break break
case 'all': case 'all':
this.d2adminTagCloseAll(this) this.tagCloseAll(this)
break break
default: default:
this.$message.error('无效的操作') this.$message.error('无效的操作')
@@ -156,7 +156,7 @@ export default {
* @description 接收点击关闭控制上按钮的事件 * @description 接收点击关闭控制上按钮的事件
*/ */
handleControlBtnClick () { handleControlBtnClick () {
this.d2adminTagCloseAll(this) this.tagCloseAll(this)
}, },
/** /**
* @description 接收点击 tab 标签的事件 * @description 接收点击 tab 标签的事件
@@ -174,7 +174,7 @@ export default {
*/ */
handleTabsEdit (tagName, action) { handleTabsEdit (tagName, action) {
if (action === 'remove') { if (action === 'remove') {
this.$store.commit('d2adminTagClose', { this.$store.commit('d2admin/tagClose', {
tagName, tagName,
vm: this vm: this
}) })

View File

@@ -10,8 +10,8 @@
<!-- 顶栏 --> <!-- 顶栏 -->
<div class="d2-theme-header" flex-box="0"> <div class="d2-theme-header" flex-box="0">
<div class="logo-group" :style="{width: isMenuAsideCollapse ? asideWidthCollapse : asideWidth}"> <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-if="isMenuAsideCollapse" :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/icon-only.png`">
<img v-else :src="`${$baseUrl}image/theme/${d2adminThemeActiveSetting.name}/logo/all.png`"> <img v-else :src="`${$baseUrl}image/theme/${themeActiveSetting.name}/logo/all.png`">
</div> </div>
<div class="toggle-aside-btn" @click="handleToggleAside"> <div class="toggle-aside-btn" @click="handleToggleAside">
<d2-icon name="bars"/> <d2-icon name="bars"/>
@@ -44,7 +44,7 @@
</div> </div>
<div class="d2-theme-container-main-body" flex-box="1"> <div class="d2-theme-container-main-body" flex-box="1">
<transition name="fade-transverse"> <transition name="fade-transverse">
<keep-alive :include="d2adminKeepAliveInclude"> <keep-alive :include="keepAliveInclude">
<router-view/> <router-view/>
</keep-alive> </keep-alive>
</transition> </transition>
@@ -78,35 +78,35 @@ export default {
} }
}, },
computed: { computed: {
...mapState({ ...mapState('d2admin', [
isGrayMode: state => state.d2admin.isGrayMode, 'isGrayMode',
pageOpenedList: state => state.d2admin.pageOpenedList, 'pageOpenedList',
isMenuAsideCollapse: state => state.d2admin.isMenuAsideCollapse 'isMenuAsideCollapse'
}), ]),
...mapGetters([ ...mapGetters('d2admin', [
'd2adminThemeActiveSetting', 'themeActiveSetting',
'd2adminKeepAliveInclude' 'keepAliveInclude'
]), ]),
/** /**
* @description 最外层容器的背景图片样式 * @description 最外层容器的背景图片样式
*/ */
styleLayoutMainGroup () { styleLayoutMainGroup () {
return { return {
...this.d2adminThemeActiveSetting.backgroundImage ? { ...this.themeActiveSetting.backgroundImage ? {
backgroundImage: `url('${this.$baseUrl}${this.d2adminThemeActiveSetting.backgroundImage}')` backgroundImage: `url('${this.$baseUrl}${this.themeActiveSetting.backgroundImage}')`
} : {} } : {}
} }
} }
}, },
methods: { methods: {
...mapMutations([ ...mapMutations('d2admin', [
'd2adminMenuAsideCollapseToggle' 'menuAsideCollapseToggle'
]), ]),
/** /**
* 接收点击切换侧边栏的按钮 * 接收点击切换侧边栏的按钮
*/ */
handleToggleAside () { handleToggleAside () {
this.d2adminMenuAsideCollapseToggle() this.menuAsideCollapseToggle()
} }
} }
} }

View File

@@ -159,9 +159,9 @@ util.checkUpdate = function (vm) {
if (update) { if (update) {
util.log.capsule('D2Admin', `New version ${res.name}`) util.log.capsule('D2Admin', `New version ${res.name}`)
console.log(`版本号: ${res.tag_name} | 详情${res.html_url}`) console.log(`版本号: ${res.tag_name} | 详情${res.html_url}`)
vm.$store.commit('d2adminReleasesUpdateSet', true) vm.$store.commit('d2admin/releasesUpdateSet', true)
} }
vm.$store.commit('d2adminReleasesLatestSet', res) vm.$store.commit('d2admin/releasesLatestSet', res)
}) })
.catch(err => { .catch(err => {
console.log('checkUpdate error', err) console.log('checkUpdate error', err)

View File

@@ -52,17 +52,17 @@ new Vue({
// 处理路由 得到每一级的路由设置 // 处理路由 得到每一级的路由设置
this.getAllPageFromRoutes() this.getAllPageFromRoutes()
// 设置顶栏菜单 // 设置顶栏菜单
this.$store.commit('d2adminMenuHeaderSet', menuHeader) this.$store.commit('d2admin/menuHeaderSet', menuHeader)
}, },
mounted () { mounted () {
// D2Admin 开发环境检查更新 // D2Admin 开发环境检查更新
util.checkUpdate(this) util.checkUpdate(this)
// 获取并记录用户 UA // 获取并记录用户 UA
this.$store.commit('d2adminUaGet') this.$store.commit('d2admin/uaGet')
// 展示系统信息 // 展示系统信息
util.showInfo() util.showInfo()
// 用户登陆后从数据库加载一系列的设置 // 用户登陆后从数据库加载一系列的设置
this.$store.commit('d2adminLoginSuccessLoad') this.$store.commit('d2admin/loginSuccessLoad')
// 初始化全屏监听 // 初始化全屏监听
this.fullscreenListenerInit() this.fullscreenListenerInit()
}, },
@@ -70,7 +70,7 @@ new Vue({
// 监听路由 控制侧边栏显示 // 监听路由 控制侧边栏显示
'$route.matched' (val) { '$route.matched' (val) {
const _side = menuAside.filter(menu => menu.path === val[0].path) const _side = menuAside.filter(menu => menu.path === val[0].path)
this.$store.commit('d2adminMenuAsideSet', _side.length > 0 ? _side[0].children : []) this.$store.commit('d2admin/menuAsideSet', _side.length > 0 ? _side[0].children : [])
} }
}, },
methods: { methods: {
@@ -81,7 +81,7 @@ new Vue({
if (screenfull.enabled) { if (screenfull.enabled) {
screenfull.on('change', () => { screenfull.on('change', () => {
if (!screenfull.isFullscreen) { if (!screenfull.isFullscreen) {
this.$store.commit('d2adminFullScreenSet', false) this.$store.commit('d2admin/fullScreenSet', false)
} }
}) })
} }
@@ -102,7 +102,7 @@ new Vue({
}) })
} }
push(frameInRoutes) push(frameInRoutes)
this.$store.commit('d2adminPagePoolSet', pool) this.$store.commit('d2admin/pagePoolSet', pool)
} }
} }
}).$mount('#app') }).$mount('#app')

View File

@@ -54,15 +54,15 @@ export default {
this.load() this.load()
}, },
methods: { methods: {
...mapMutations([ ...mapMutations('d2admin', [
'd2adminUtilDatabase', 'utilDatabase',
'd2adminUtilDatabaseClear' 'utilDatabaseClear'
]), ]),
/** /**
* 加载本地数据 * 加载本地数据
*/ */
load () { load () {
this.d2adminUtilDatabase(database => { this.utilDatabase(database => {
this.dataDisplay = JSON.stringify(database.value(), null, 2) this.dataDisplay = JSON.stringify(database.value(), null, 2)
this.keyNameList = Object.keys(database.value()).map(k => ({ this.keyNameList = Object.keys(database.value()).map(k => ({
value: k, value: k,
@@ -74,7 +74,7 @@ export default {
* 删除一个字段 * 删除一个字段
*/ */
handleDelete (name) { handleDelete (name) {
this.d2adminUtilDatabase(database => { this.utilDatabase(database => {
database database
.unset(name) .unset(name)
.write() .write()
@@ -86,7 +86,7 @@ export default {
* 清空当前用户的数据 * 清空当前用户的数据
*/ */
handleClear () { handleClear () {
this.d2adminUtilDatabaseClear() this.utilDatabaseClear()
this.load() this.load()
}, },
/** /**
@@ -97,7 +97,7 @@ export default {
this.$message.error('字段名不能为空') this.$message.error('字段名不能为空')
return return
} }
this.d2adminUtilDatabase(database => { this.utilDatabase(database => {
database database
.set(this.keyNameToSet, this.valueToSet) .set(this.keyNameToSet, this.valueToSet)
.write() .write()
@@ -108,7 +108,7 @@ export default {
* 添加一个随机数据 * 添加一个随机数据
*/ */
handleSetRandom () { handleSetRandom () {
this.d2adminUtilDatabase(database => { this.utilDatabase(database => {
const id = day().valueOf() const id = day().valueOf()
database database
.set(id, Math.round(id * Math.random())) .set(id, Math.round(id * Math.random()))

View File

@@ -54,15 +54,15 @@ export default {
this.load() this.load()
}, },
methods: { methods: {
...mapMutations([ ...mapMutations('d2admin', [
'd2adminUtilDatabaseUser', 'utilDatabaseUser',
'd2adminUtilDatabaseUserClear' 'utilDatabaseUserClear'
]), ]),
/** /**
* 加载本地数据 * 加载本地数据
*/ */
load () { load () {
this.d2adminUtilDatabaseUser(database => { this.utilDatabaseUser(database => {
this.dataDisplay = JSON.stringify(database.value(), null, 2) this.dataDisplay = JSON.stringify(database.value(), null, 2)
this.keyNameList = Object.keys(database.value()).map(k => ({ this.keyNameList = Object.keys(database.value()).map(k => ({
value: k, value: k,
@@ -74,7 +74,7 @@ export default {
* 删除一个字段 * 删除一个字段
*/ */
handleDelete (name) { handleDelete (name) {
this.d2adminUtilDatabaseUser(database => { this.utilDatabaseUser(database => {
database database
.unset(name) .unset(name)
.write() .write()
@@ -86,7 +86,7 @@ export default {
* 清空当前用户的数据 * 清空当前用户的数据
*/ */
handleClear () { handleClear () {
this.d2adminUtilDatabaseUserClear() this.utilDatabaseUserClear()
this.load() this.load()
}, },
/** /**
@@ -97,7 +97,7 @@ export default {
this.$message.error('字段名不能为空') this.$message.error('字段名不能为空')
return return
} }
this.d2adminUtilDatabaseUser(database => { this.utilDatabaseUser(database => {
database database
.set(this.keyNameToSet, this.valueToSet) .set(this.keyNameToSet, this.valueToSet)
.write() .write()
@@ -108,7 +108,7 @@ export default {
* 添加一个随机数据 * 添加一个随机数据
*/ */
handleSetRandom () { handleSetRandom () {
this.d2adminUtilDatabaseUser(database => { this.utilDatabaseUser(database => {
const id = day().valueOf() const id = day().valueOf()
database database
.set(id, Math.round(id * Math.random())) .set(id, Math.round(id * Math.random()))

View File

@@ -1,8 +1,8 @@
<template> <template>
<d2-container type="card" class="page-demo-playground-fullscreen"> <d2-container type="card" class="page-demo-playground-fullscreen">
<template slot="header">全屏</template> <template slot="header">全屏</template>
<el-button type="primary" @click="d2adminFullScreenToggle"> <el-button type="primary" @click="fullScreenToggle">
d2adminFullScreenToggle 切换全屏 fullScreenToggle 切换全屏
</el-button> </el-button>
</d2-container> </d2-container>
</template> </template>
@@ -11,13 +11,13 @@
import { mapState, mapMutations } from 'vuex' import { mapState, mapMutations } from 'vuex'
export default { export default {
computed: { computed: {
...mapState({ ...mapState('d2admin', [
isFullScreen: state => state.d2admin.isFullScreen 'isFullScreen'
}) ])
}, },
methods: { methods: {
...mapMutations([ ...mapMutations('d2admin', [
'd2adminFullScreenToggle' 'fullScreenToggle'
]) ])
} }
} }

View File

@@ -4,9 +4,9 @@
<div class="colorful">{{isGrayMode ? 'GRAY' : 'COLORFUL'}}</div> <div class="colorful">{{isGrayMode ? 'GRAY' : 'COLORFUL'}}</div>
</template> </template>
<el-button-group> <el-button-group>
<el-button @click="d2adminGrayModeToggle">切换灰度模式</el-button> <el-button @click="grayModeToggle">切换灰度模式</el-button>
<el-button @click="d2adminGrayModeSet(true)">打开灰度模式</el-button> <el-button @click="grayModeSet(true)">打开灰度模式</el-button>
<el-button @click="d2adminGrayModeSet(false)">关闭灰度模式</el-button> <el-button @click="grayModeSet(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({ ...mapState('d2admin', [
isGrayMode: state => state.d2admin.isGrayMode 'isGrayMode'
}) ])
}, },
methods: { methods: {
...mapMutations([ ...mapMutations('d2admin', [
'd2adminGrayModeToggle', 'grayModeToggle',
'd2adminGrayModeSet' 'grayModeSet'
]), ]),
handleDialogOpen () { handleDialogOpen () {
this.d2adminGrayModeSet(true) this.grayModeSet(true)
}, },
handleDialogClosed () { handleDialogClosed () {
this.d2adminGrayModeSet(false) this.grayModeSet(false)
} }
} }
} }

View File

@@ -74,10 +74,10 @@ export default {
} }
}, },
computed: { computed: {
...mapState({ ...mapState('d2admin', [
menuHeader: state => state.d2admin.menuHeader, 'menuHeader',
menuAside: state => state.d2admin.menuAside 'menuAside'
}) ])
}, },
created () { created () {
this.menuHeaderBak = clonedeep(this.menuHeader) this.menuHeaderBak = clonedeep(this.menuHeader)
@@ -85,8 +85,8 @@ export default {
}, },
beforeDestroy () { beforeDestroy () {
if (this.menuHeaderChanged && this.menuAsideChanged) { if (this.menuHeaderChanged && this.menuAsideChanged) {
this.d2adminMenuHeaderSet(this.menuHeaderBak) this.menuHeaderSet(this.menuHeaderBak)
this.d2adminMenuAsideSet(this.menuAsideBak) this.menuAsideSet(this.menuAsideBak)
this.$notify({ this.$notify({
title: '菜单恢复', title: '菜单恢复',
message: '对侧边栏和顶栏菜单的修改已经复原', message: '对侧边栏和顶栏菜单的修改已经复原',
@@ -95,7 +95,7 @@ export default {
return return
} }
if (this.menuHeaderChanged) { if (this.menuHeaderChanged) {
this.d2adminMenuHeaderSet(this.menuHeaderBak) this.menuHeaderSet(this.menuHeaderBak)
this.$notify({ this.$notify({
title: '菜单恢复', title: '菜单恢复',
message: '对顶栏菜单的修改已经复原', message: '对顶栏菜单的修改已经复原',
@@ -104,7 +104,7 @@ export default {
return return
} }
if (this.menuAsideChanged) { if (this.menuAsideChanged) {
this.d2adminMenuAsideSet(this.menuAsideBak) this.menuAsideSet(this.menuAsideBak)
this.$notify({ this.$notify({
title: '菜单恢复', title: '菜单恢复',
message: '对侧边栏菜单的修改已经复原', message: '对侧边栏菜单的修改已经复原',
@@ -113,16 +113,16 @@ export default {
} }
}, },
methods: { methods: {
...mapMutations([ ...mapMutations('d2admin', [
'd2adminMenuHeaderSet', 'menuHeaderSet',
'd2adminMenuAsideSet' 'menuAsideSet'
]), ]),
/** /**
* 修改顶栏菜单 * 修改顶栏菜单
*/ */
handleMenuHeaderSet () { handleMenuHeaderSet () {
this.menuHeaderChanged = true this.menuHeaderChanged = true
this.d2adminMenuHeaderSet(this.menuEmpty) this.menuHeaderSet(this.menuEmpty)
this.$notify({ this.$notify({
title: '菜单修改', title: '菜单修改',
message: '对顶栏菜单的修改已经生效', message: '对顶栏菜单的修改已经生效',
@@ -134,7 +134,7 @@ export default {
*/ */
handleMenuAsideSet () { handleMenuAsideSet () {
this.menuAsideChanged = true this.menuAsideChanged = true
this.d2adminMenuAsideSet(this.menuEmpty) this.menuAsideSet(this.menuEmpty)
this.$notify({ this.$notify({
title: '菜单修改', title: '菜单修改',
message: '对侧边栏菜单的修改已经生效', message: '对侧边栏菜单的修改已经生效',
@@ -145,7 +145,7 @@ export default {
* 恢复顶栏菜单 * 恢复顶栏菜单
*/ */
menuHeaderReset () { menuHeaderReset () {
this.d2adminMenuHeaderSet(this.menuHeaderBak) this.menuHeaderSet(this.menuHeaderBak)
this.$notify({ this.$notify({
title: '菜单恢复', title: '菜单恢复',
message: '对顶栏菜单的修改已经复原', message: '对顶栏菜单的修改已经复原',
@@ -156,7 +156,7 @@ export default {
* 恢复侧边栏菜单 * 恢复侧边栏菜单
*/ */
menuAsideReset () { menuAsideReset () {
this.d2adminMenuAsideSet(this.menuAsideBak) this.menuAsideSet(this.menuAsideBak)
this.$notify({ this.$notify({
title: '菜单恢复', title: '菜单恢复',
message: '对侧边栏菜单的修改已经复原', message: '对侧边栏菜单的修改已经复原',

View File

@@ -61,7 +61,7 @@
<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>
<div style="height: 300px; overflow: auto;"> <div style="height: 300px; overflow: auto;">
<tree-view class="tree-view-small" :data="d2adminThemeActiveSetting" :options="{ rootObjectKey: 'd2adminThemeActiveSetting', maxDepth: 1 }"/> <tree-view class="tree-view-small" :data="themeActiveSetting" :options="{ rootObjectKey: 'themeActiveSetting', maxDepth: 1 }"/>
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
@@ -91,7 +91,7 @@
<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>
<div style="height: 300px; overflow: auto;"> <div style="height: 300px; overflow: auto;">
<tree-view class="tree-view-small" :data="d2adminKeepAliveInclude" :options="{ rootObjectKey: 'd2adminKeepAliveInclude', maxDepth: 1 }"/> <tree-view class="tree-view-small" :data="keepAliveInclude" :options="{ rootObjectKey: 'keepAliveInclude', maxDepth: 1 }"/>
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
@@ -108,26 +108,26 @@
import { mapState, mapGetters } from 'vuex' import { mapState, mapGetters } from 'vuex'
export default { export default {
computed: { computed: {
...mapState({ ...mapState('d2admin', [
userInfo: state => state.d2admin.userInfo, 'userInfo',
version: state => state.d2admin.version, 'version',
releasesLatest: state => state.d2admin.releasesLatest, 'releasesLatest',
releasesUpdate: state => state.d2admin.releasesUpdate, 'releasesUpdate',
menuHeader: state => state.d2admin.menuHeader, 'menuHeader',
menuAside: state => state.d2admin.menuAside, 'menuAside',
isFullScreen: state => state.d2admin.isFullScreen, 'isFullScreen',
isGrayMode: state => state.d2admin.isGrayMode, 'isGrayMode',
isMenuAsideCollapse: state => state.d2admin.isMenuAsideCollapse, 'isMenuAsideCollapse',
themeList: state => state.d2admin.themeList, 'themeList',
themeActiveName: state => state.d2admin.themeActiveName, 'themeActiveName',
pagePool: state => state.d2admin.pagePool, 'pagePool',
pageOpenedList: state => state.d2admin.pageOpenedList, 'pageOpenedList',
pageCurrent: state => state.d2admin.pageCurrent, 'pageCurrent',
ua: state => state.d2admin.ua 'ua'
}), ]),
...mapGetters([ ...mapGetters('d2admin', [
'd2adminThemeActiveSetting', 'themeActiveSetting',
'd2adminKeepAliveInclude' 'keepAliveInclude'
]) ])
} }
} }

View File

@@ -42,17 +42,17 @@ export default {
} }
}, },
computed: { computed: {
...mapState({ ...mapState('d2admin', [
themeList: state => state.d2admin.themeList, 'themeList',
themeActiveName: state => state.d2admin.themeActiveName 'themeActiveName'
}) ])
}, },
methods: { methods: {
...mapMutations([ ...mapMutations('d2admin', [
'd2adminThemeSet' 'themeSet'
]), ]),
handleSelectTheme (name) { handleSelectTheme (name) {
this.d2adminThemeSet(name) this.themeSet(name)
} }
} }
} }

View File

@@ -11,9 +11,9 @@
import { mapState } from 'vuex' import { mapState } from 'vuex'
export default { export default {
computed: { computed: {
...mapState({ ...mapState('d2admin', [
ua: state => state.d2admin.ua 'ua'
}), ]),
uaStr () { uaStr () {
const { browser, engine, os, device, cpu } = this.ua const { browser, engine, os, device, cpu } = this.ua
return JSON.stringify({ browser, engine, os, device, cpu }, null, 2) return JSON.stringify({ browser, engine, os, device, cpu }, null, 2)

View File

@@ -105,8 +105,8 @@ export default {
particlesJS('login', config) particlesJS('login', config)
}, },
methods: { methods: {
...mapActions([ ...mapActions('d2admin', [
'd2adminLogin' 'login'
]), ]),
/** /**
* @description 接收选择一个用户快速登陆的事件 * @description 接收选择一个用户快速登陆的事件
@@ -127,7 +127,7 @@ export default {
// 登陆 // 登陆
// 注意 这里的演示没有传验证码 // 注意 这里的演示没有传验证码
// 具体需要传递的数据请自行修改代码 // 具体需要传递的数据请自行修改代码
this.d2adminLogin({ this.login({
vm: this, vm: this,
username: this.formLogin.username, username: this.formLogin.username,
password: this.formLogin.password password: this.formLogin.password

View File

@@ -5,7 +5,7 @@ export default {
install (Vue, options) { install (Vue, options) {
Vue.config.errorHandler = function (err, vm, info) { Vue.config.errorHandler = function (err, vm, info) {
Vue.nextTick(() => { Vue.nextTick(() => {
store.commit('d2adminLogAdd', { store.commit('d2admin/logAdd', {
type: 'error', type: 'error',
err, err,
vm, vm,

View File

@@ -7,7 +7,7 @@ export default {
Vue.prototype.$log = util.log Vue.prototype.$log = util.log
// 快速记录日志 // 快速记录日志
Vue.prototype.$logAdd = function (info) { Vue.prototype.$logAdd = function (info) {
store.commit('d2adminLogAdd', { store.commit('d2admin/logAdd', {
type: 'log', type: 'log',
info info
}) })

View File

@@ -42,7 +42,7 @@ router.afterEach(to => {
const app = router.app const app = router.app
const { name, params, query } = to const { name, params, query } = to
// 多页控制 打开新的页面 // 多页控制 打开新的页面
app.$store.commit('d2adminPageOpenNew', { name, params, query }) app.$store.commit('d2admin/pageOpenNew', { name, params, query })
// 更改标题 // 更改标题
util.title(to.meta.title) util.title(to.meta.title)
}) })

View File

@@ -1 +1 @@
b8a23a986004dadbc5824f16111da212f777bb27 ce01ef3f8c328fa113c7dfbe78187ce4220af214