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 @@