From 123e3835d25a874659e484c3706f7eb7db63fe01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=99=AF=E9=98=B3?= <1656488874@qq.com> Date: Tue, 28 Jan 2020 15:12:33 +0800 Subject: [PATCH] =?UTF-8?q?feature=20=E6=96=B0=E5=A2=9E=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/i18n/zh.js | 5 + frontend/src/store/modules/user.js | 22 +++ frontend/src/views/setting/Setting.vue | 181 +++++++++++++++++++------ 3 files changed, 164 insertions(+), 44 deletions(-) diff --git a/frontend/src/i18n/zh.js b/frontend/src/i18n/zh.js index a5dddfcc..fc8b7303 100644 --- a/frontend/src/i18n/zh.js +++ b/frontend/src/i18n/zh.js @@ -361,6 +361,11 @@ export default { 'Never': '从不', 'DingTalk Robot Webhook': '钉钉机器人 Webhook', 'Wechat Robot Webhook': '微信机器人 Webhook', + 'Password Settings': '密码设置', + 'Notify Settings': '通知设置', + 'Global Variable': '全局变量', + 'Add Global Variable': '新增全局变量', + 'Are you sure to delete this global variable': '确定删除该全局变量?', // 其他 tagsView: { diff --git a/frontend/src/store/modules/user.js b/frontend/src/store/modules/user.js index af778816..3324ba15 100644 --- a/frontend/src/store/modules/user.js +++ b/frontend/src/store/modules/user.js @@ -9,6 +9,8 @@ const user = { avatar: '', roles: [], userList: [], + globalVariableList: [], + globalVariableForm: {}, userForm: {}, userInfo: undefined, adminPaths: [ @@ -61,6 +63,9 @@ const user = { }, SET_TOTAL_COUNT: (state, value) => { state.totalCount = value + }, + SET_GLOBAL_VARIABLE_LIST: (state, value) => { + state.globalVariableList = value } }, @@ -148,6 +153,23 @@ const user = { // 添加用户 addUser ({ dispatch, commit, state }) { return request.put('/users', state.userForm) + }, + // 新增全局变量 + addGlobalVariable ({ commit, state }) { + return request.post(`/variable`, state.globalVariableForm) + .then(() => { + state.globalVariableForm = {} + }) + }, + // 获取全局变量列表 + getGlobalVariable ({ commit, state }) { + request.get('/variables').then((response) => { + commit('SET_GLOBAL_VARIABLE_LIST', response.data.data) + }) + }, + // 删除全局变量 + deleteGlobalVariable ({ commit, state }, id) { + return request.delete(`/variable/${id}`) } } } diff --git a/frontend/src/views/setting/Setting.vue b/frontend/src/views/setting/Setting.vue index e82d47b6..0eade556 100644 --- a/frontend/src/views/setting/Setting.vue +++ b/frontend/src/views/setting/Setting.vue @@ -1,47 +1,98 @@