no message

Former-commit-id: 1f5fb4a5ab475fe7dd56856584fb707a4d3e592c [formerly 42022ffdfb79f64e99138580e2beed163901c564] [formerly 1f5fb4a5ab475fe7dd56856584fb707a4d3e592c [formerly 42022ffdfb79f64e99138580e2beed163901c564] [formerly 1f5fb4a5ab475fe7dd56856584fb707a4d3e592c [formerly 42022ffdfb79f64e99138580e2beed163901c564] [formerly 42022ffdfb79f64e99138580e2beed163901c564 [formerly e91f0f80d6ae8812daafccb9894d16802b4ec84a [formerly ad0ac5553bc253c6ca0c2fdd56763c41780c08b5]]]]]
Former-commit-id: 0f71add838f001bb9577585ec13fb587e3b1f8c7
Former-commit-id: 3b78c5f0e9802244e08acaffe53bafb8560bed0a
Former-commit-id: 3177c463b7500a1369f5bafb33407d3b9f0aceec [formerly 6f766445766d6a3f90a483d94385e853a70e7c26]
Former-commit-id: 359167b65e9ee6ae60c8e0c4a24cc763d6e61405
Former-commit-id: bb02e75c6ca35089ddf5fc5fa2ee3ccfb28162a8
Former-commit-id: 1586321951fb1f2ad9052f52557e45fbdf75a3fa
Former-commit-id: 5738fcbf97f9f50c5e12c576a9719873fbc44cb0
Former-commit-id: 032247d5689d80e0d7c16ae75b2e16e0dea6b73b
This commit is contained in:
liyang
2018-07-02 15:52:24 +08:00
parent 508721d809
commit cd4797fe28
2 changed files with 33 additions and 13 deletions

View File

@@ -18,7 +18,7 @@
:type="updateNotify ? 'primary' : 'default'" :type="updateNotify ? 'primary' : 'default'"
size="mini" size="mini"
@click="d2adminUpdateNotifySet(!updateNotify)"> @click="d2adminUpdateNotifySet(!updateNotify)">
{{updateNotify ? '关闭更新提醒' : '打开更新提醒'}} {{updateNotify ? '关闭更新提醒 (当前:打开)' : '打开更新提醒 (当前:关闭)'}}
</el-button> </el-button>
</template> </template>
</d2-container> </d2-container>

View File

@@ -49,13 +49,14 @@ export default {
mutations: { mutations: {
/** /**
* @class 通用工具 * @class 通用工具
* @description 将 state 中某一项存储到数据库 * @description 将 state 中某一项存储到数据库 需要 uuid
* @param {state} state vuex state * @param {state} state vuex state
* @param {string} key key name
*/ */
d2adminVuex2DbByUuid (state, key) { d2adminVuex2DbByUuid (state, key) {
const setting = db.get(key).find({uuid: util.uuid()}) const row = db.get(key).find({uuid: util.uuid()})
if (setting.value()) { if (row.value()) {
setting.assign({value: state[key]}).write() row.assign({value: state[key]}).write()
} else { } else {
db.get(key).push({ db.get(key).push({
uuid: util.uuid(), uuid: util.uuid(),
@@ -63,6 +64,21 @@ export default {
}).write() }).write()
} }
}, },
/**
* @class 通用工具
* @description 将数据库中的某项数据拿到 vuex 需要 uuid
* @param {state} state vuex state
* @param {string} key key name
* @param {*} defaultValue default value
*/
d2adminDb2VuexByUuid (state, key, defaultValue) {
const row = db.get(key).find({uuid: util.uuid()}).value()
if (row) {
state[key] = row.value
} else {
state[key] = defaultValue
}
},
/** /**
* @description 更新远端的版本信息 * @description 更新远端的版本信息
* @class releases * @class releases
@@ -267,23 +283,27 @@ export default {
// 设置为列表第一个主题 // 设置为列表第一个主题
state.themeActiveName = state.themeList[0].name state.themeActiveName = state.themeList[0].name
} }
// 设置 dom // 将 vuex 中的主题应用到 dom
document.body.className = `theme-${state.themeActiveName}` this.commit('d2adminTheme2dom')
// 保存到数据库 // 保存到数据库
this.commit('d2adminVuex2DbByUuid', 'themeActiveName') this.commit('d2adminVuex2DbByUuid', 'themeActiveName')
}, },
/**
* @class themeActiveName
* @description 将 vuex 中的主题应用到 dom
* @param {state} state vuex state
*/
d2adminTheme2dom (state) {
document.body.className = `theme-${state.themeActiveName}`
},
/** /**
* @class themeActiveName * @class themeActiveName
* @description 从数据库加载主题设置 * @description 从数据库加载主题设置
* @param {state} state vuex state * @param {state} state vuex state
*/ */
d2adminThemeLoad (state) { d2adminThemeLoad (state) {
const themeActiveName = db.get('themeActiveName').find({uuid: util.uuid()}).value() this.commit('d2adminDb2VuexByUuid', 'themeActiveName', state.themeList[0].name)
if (themeActiveName) { this.commit('d2adminTheme2dom')
this.commit('d2adminThemeSet', themeActiveName.value)
} else {
this.commit('d2adminThemeSet', state.themeList[0].name)
}
} }
} }
} }