diff --git a/ui/src/store/getters.js b/ui/src/store/getters.js index 935a78f20a1..fba66a8a1c8 100644 --- a/ui/src/store/getters.js +++ b/ui/src/store/getters.js @@ -23,7 +23,6 @@ const getters = { project: state => state.user.project, avatar: state => state.user.avatar, nickname: state => state.user.name, - welcome: state => state.user.welcome, apis: state => state.user.apis, features: state => state.user.features, userInfo: state => state.user.info, diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js index fd64e0580ec..6e2aa0088de 100644 --- a/ui/src/store/modules/user.js +++ b/ui/src/store/modules/user.js @@ -20,13 +20,11 @@ import Vue from 'vue' import md5 from 'md5' import { login, logout, api } from '@/api' import { ACCESS_TOKEN, CURRENT_PROJECT, DEFAULT_THEME, ASYNC_JOB_IDS } from '@/store/mutation-types' -import { welcome } from '@/utils/util' const user = { state: { token: '', name: '', - welcome: '', avatar: '', info: {}, apis: {}, @@ -45,9 +43,8 @@ const user = { Vue.ls.set(CURRENT_PROJECT, project) state.project = project }, - SET_NAME: (state, { name, welcome }) => { + SET_NAME: (state, name) => { state.name = name - state.welcome = welcome }, SET_AVATAR: (state, avatar) => { state.avatar = avatar @@ -97,8 +94,16 @@ const user = { Vue.ls.set(ACCESS_TOKEN, result.sessionkey, 24 * 60 * 60 * 1000) commit('SET_TOKEN', result.sessionkey) + + commit('SET_APIS', {}) + commit('SET_NAME', '') + commit('SET_AVATAR', '') + commit('SET_INFO', {}) commit('SET_PROJECT', {}) commit('SET_ASYNC_JOB_IDS', []) + commit('SET_FEATURES', {}) + commit('SET_LDAP', {}) + commit('SET_CLOUDIAN', {}) resolve() }).catch(error => { @@ -129,7 +134,7 @@ const user = { api('listUsers').then(response => { const result = response.listusersresponse.user[0] commit('SET_INFO', result) - commit('SET_NAME', { name: result.firstname + ' ' + result.lastname, welcome: welcome() }) + commit('SET_NAME', result.firstname + ' ' + result.lastname) if ('email' in result) { commit('SET_AVATAR', 'https://www.gravatar.com/avatar/' + md5(result.email)) } else { @@ -174,8 +179,11 @@ const user = { }) commit('SET_TOKEN', '') - commit('SET_PROJECT', {}) commit('SET_APIS', {}) + commit('SET_PROJECT', {}) + commit('SET_ASYNC_JOB_IDS', []) + commit('SET_FEATURES', {}) + commit('SET_LDAP', {}) commit('SET_CLOUDIAN', {}) commit('RESET_THEME') Vue.ls.remove(CURRENT_PROJECT) diff --git a/ui/src/utils/util.js b/ui/src/utils/util.js index e2abc76b1d4..2f017e07bce 100644 --- a/ui/src/utils/util.js +++ b/ui/src/utils/util.js @@ -21,12 +21,6 @@ export function timeFix () { return hour < 9 ? '早上好' : hour <= 11 ? '上午好' : hour <= 13 ? '中午好' : hour < 20 ? '下午好' : '晚上好' } -export function welcome () { - const arr = ['休息一会儿吧', '准备吃什么呢?', '要不要打一把 DOTA', '我猜你可能累了'] - const index = Math.floor(Math.random() * arr.length) - return arr[index] -} - export function triggerWindowResizeEvent () { const event = document.createEvent('HTMLEvents') event.initEvent('resize', true, true)