From 2e13a54ceb549d2516496ce7724a152bc5b934f9 Mon Sep 17 00:00:00 2001 From: mlogclub Date: Thu, 10 Nov 2022 19:51:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=96=E6=8C=89=E9=92=AE=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E9=85=8D=E7=BD=AE=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site/components/CreateTopicBtn.vue | 47 ++++++++++++++++++++++++------ site/store/config.js | 24 +++++++++++++++ 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/site/components/CreateTopicBtn.vue b/site/components/CreateTopicBtn.vue index 44e20f03a..62057bafd 100644 --- a/site/components/CreateTopicBtn.vue +++ b/site/components/CreateTopicBtn.vue @@ -19,14 +19,12 @@ - 发动态 - 发帖子 - 发文章{{ item.name }} @@ -37,7 +35,38 @@ export default { data() { return {} }, - computed: {}, + computed: { + config() { + return this.$store.state.config.config + }, + modules() { + const modules = [] + for (let i = 0; i < this.config.modules.length; i++) { + const item = this.config.modules[i] + if (item.enabled) { + const command = item.module + let icon = '' + let name = '' + if (item.module === 'tweet') { + icon = 'iconfont icon-tweet2' + name = '发动态' + } else if (item.module === 'topic') { + icon = 'iconfont icon-topic' + name = '发帖子' + } else if (item.module === 'article') { + icon = 'iconfont icon-article' + name = '发文章' + } + modules.push({ + command, + icon, + name, + }) + } + } + return modules + }, + }, methods: { handlePostCommand(cmd) { if (cmd === 'topic') { diff --git a/site/store/config.js b/site/store/config.js index 5a88ad3b9..c914e50da 100644 --- a/site/store/config.js +++ b/site/store/config.js @@ -27,4 +27,28 @@ export const getters = { siteKeywords(state) { return state.config.siteKeywords || '' }, + isEnabledTweet(state) { + for (let i = 0; i < state.config.modules.length; i++) { + if (state.config.modules[i].module === 'tweet') { + return state.config.modules[i].enabled + } + } + return true + }, + isEnabledTopic(state) { + for (let i = 0; i < state.config.modules.length; i++) { + if (state.config.modules[i].module === 'topic') { + return state.config.modules[i].enabled + } + } + return true + }, + isEnabledArticle(state) { + for (let i = 0; i < state.config.modules.length; i++) { + if (state.config.modules[i].module === 'article') { + return state.config.modules[i].enabled + } + } + return true + }, }