Compare commits

...

1 Commits

3 changed files with 23 additions and 6 deletions

View File

@@ -99,8 +99,11 @@ export default {
},
currentOrgId() {
const usingOrgIds = this.usingOrgs.map(o => o.id)
let currentOrgId = this.currentOrg.id
const find = usingOrgIds.indexOf(currentOrgId) > -1
if (!find) {
currentOrgId = null
}

View File

@@ -148,11 +148,11 @@ const actions = {
}
commit('SET_CURRENT_ORG', systemOrg)
},
leaveSettingOrg({ commit }) {
const preOrg = store.state.users.preOrg
if (!preOrg) {
return
}
leaveSettingOrg({ commit, state }) {
const preOrg = getPreOrgLocal(state.profile.username)
if (!preOrg) return
commit('SET_CURRENT_ORG', preOrg)
},
enterGlobalOrg({ commit }) {

View File

@@ -1,12 +1,26 @@
<script>
import Layout from '@/layout'
import store from '@/store'
import { mapGetters } from 'vuex'
import { setPreOrgLocal } from '@/utils/auth'
import { GLOBAL_ORG_ID } from '@/utils/org'
export default {
name: 'Setting',
extends: Layout,
computed: {
...mapGetters(['currentOrg'])
},
beforeRouteEnter(to, from, next) {
store.dispatch('users/enterSettingOrg').then(() => next())
next(vm => {
if (vm.currentOrg.id === GLOBAL_ORG_ID) {
const currentUser = vm.$store.state.users.username
setPreOrgLocal(currentUser, vm.currentOrg)
}
store.dispatch('users/enterSettingOrg').then(() => next())
})
},
beforeRouteLeave(to, from, next) {
store.dispatch('users/leaveSettingOrg').then(() => next())