no message

Former-commit-id: 46934d9d1fe3020fcd10c258fbf26f147814135f [formerly 46934d9d1fe3020fcd10c258fbf26f147814135f [formerly 46934d9d1fe3020fcd10c258fbf26f147814135f [formerly 46934d9d1fe3020fcd10c258fbf26f147814135f [formerly b3e1461b6ea8591de714a33a9e52e4bb07d48d7d [formerly cab5ddc409113a23eae6291df46a37555238fb9f]]]]]
Former-commit-id: bb8e64aff5482c16aa96756b5966c00fe52be385
Former-commit-id: 45c0ee9b74bca8b1e885c19c5dc76d9801769781
Former-commit-id: 762189b20cd613e7740c0970d6274e4ded2c8efd [formerly a89e56287c0e00f74d851ee11713431c0162f507]
Former-commit-id: d6798c3d563d835f7f3a7fee25975622f8e8da3d
Former-commit-id: d660229504595bd39635f5b0ae66db593db5ca58
Former-commit-id: 73ce237bb3e34b7d864ea53d3176865bac7641fc
Former-commit-id: 123703b4b2a5bc6ae6088e9d9adfa4cda8d1020d
Former-commit-id: 9dd7e11ea0687ef14e9335b34f7312aa3f84ff55
This commit is contained in:
liyang
2018-07-01 09:41:16 +08:00
parent 75406e3d31
commit bf786d9788
3 changed files with 30 additions and 40 deletions

View File

@@ -208,6 +208,12 @@
border-left-color: $theme-multiple-page-control-border-color;
&:first-child {
border-left: none;
&:hover {
padding: 0px 20px;
}
.el-icon-close {
display: none;
}
}
}
.el-tabs__item.is-active {

View File

@@ -42,7 +42,9 @@ export default {
},
handleTabsEdit(tagName, action) {
if (action === 'remove') {
this.closeTag(tagName)
if (tagName !== 'index') {
this.closeTag(tagName)
}
}
},
/**

View File

@@ -21,6 +21,21 @@ export default {
pageCurrent: ''
},
mutations: {
/**
* 将 state 中某一项存储到数据库
* @param {state} state vuex state
*/
d2adminVuex2Db (state, key) {
const setting = db.get(key).find({uuid: util.uuid()})
if (setting.value()) {
setting.assign({value: state[key]}).write()
} else {
db.get(key).push({
uuid: util.uuid(),
value: state[key]
}).write()
}
},
/**
* 设置当前激活的页面 name
* @param {state} state vuex state
@@ -41,15 +56,7 @@ export default {
page.query = query || page.query
state.pageOpenedList.splice(index, 1, page)
// 更新设置到数据库
const setting = db.get('pageOpenedList').find({uuid: util.uuid()})
if (setting.value()) {
setting.assign({value: state.pageOpenedList}).write()
} else {
db.get('pageOpenedList').push({
uuid: util.uuid(),
value: state.pageOpenedList
}).write()
}
this.commit('d2adminVuex2Db', 'pageOpenedList')
},
/**
* 保存 tagPool (候选池)
@@ -72,15 +79,7 @@ export default {
// 添加进当前显示的页面数组
state.pageOpenedList.push(newTag)
// 更新设置到数据库
const setting = db.get('pageOpenedList').find({uuid: util.uuid()})
if (setting.value()) {
setting.assign({value: state.pageOpenedList}).write()
} else {
db.get('pageOpenedList').push({
uuid: util.uuid(),
value: state.pageOpenedList
}).write()
}
this.commit('d2adminVuex2Db', 'pageOpenedList')
},
/**
* 关闭一个 tag (关闭一个页面)
@@ -125,17 +124,17 @@ export default {
/**
* 激活一个主题应用到dom上
* @param {state} state vuex state
* @param {string} themeActiveValue 需要激活的主题名称
* @param {string} themeValue 需要激活的主题名称
*/
d2adminThemeSet (state, themeActiveValue) {
d2adminThemeSet (state, themeValue) {
// 从列表里找到需要激活的主题的数据
const theme = state.themeList.find(e => e.value === themeActiveValue) || state.themeList[0]
const theme = state.themeList.find(e => e.value === themeValue) || state.themeList[0]
// 设置 state
state.themeActive = theme
// 设置 dom
document.body.className = `theme-${state.themeActive.value}`
// 保存到数据库
this.commit('d2adminThemeSave', themeActiveValue)
this.commit('d2adminVuex2Db', 'themeActive')
},
/**
* 从数据库加载主题设置
@@ -144,23 +143,6 @@ export default {
d2adminThemeLoad (state) {
const themeActive = db.get('themeActive').find({uuid: util.uuid()}).value()
this.commit('d2adminThemeSet', themeActive ? themeActive.value : state.themeList[0].value)
},
/**
* 向数据保存一个主题
* @param {state} state vuex state
* @param {string} themeActiveValue 需要保存的主题名称
*/
d2adminThemeSave (state, themeActiveValue) {
// 检查这个用户是否有主题设置
const setting = db.get('themeActive').find({uuid: util.uuid()})
if (setting.value()) {
setting.assign({value: themeActiveValue}).write()
} else {
db.get('themeActive').push({
uuid: util.uuid(),
value: themeActiveValue
}).write()
}
}
}
}