切换公司2
This commit is contained in:
parent
b89a685ffb
commit
3d95f8635d
|
|
@ -1,22 +1,22 @@
|
|||
<template>
|
||||
<div>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script>
|
||||
import { getUserInfo, getRoutesConfig, getPermission, getSettings, getCompany } from '@/services/base/user'
|
||||
import { setAuthorization, setCompany } from '@/utils/request'
|
||||
import { loadRoutes } from '@/utils/routerUtil'
|
||||
import { mapMutations } from 'vuex'
|
||||
import Cookie from 'js-cookie'
|
||||
import { USER_MODEL } from '@/services/base/api.js';
|
||||
import { USER_MODEL } from '@/services/base/api.js';
|
||||
|
||||
|
||||
|
||||
//封装 登录的相关操作
|
||||
export default {
|
||||
name: 'loginActions',
|
||||
components: { },
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
logging: false,
|
||||
|
|
@ -32,26 +32,26 @@ export default {
|
|||
company: Cookie.get('company'),
|
||||
loginResult: null
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
beforeMount() {
|
||||
|
||||
|
||||
},
|
||||
created() {
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
...mapMutations('account', ['setUid', 'setUser', 'setPermissions', 'setRoutesConfig', 'setSettings', 'setCompany', 'setProject']),
|
||||
|
||||
isMiddleAdmin() {
|
||||
|
||||
isMiddleAdmin() {
|
||||
return USER_MODEL == "AdminUser";
|
||||
},
|
||||
|
||||
afterLoginSuccess({ token, access_expire, uid, msg = '登录成功',pushTo = '/dashboard/workplace' }) {
|
||||
|
||||
|
||||
afterLoginSuccess({ closeOthers, token, access_expire, uid, msg = '登录成功', pushTo = '/dashboard/workplace' }) {
|
||||
|
||||
setAuthorization({ token: token, expireAt: new Date(access_expire * 1000) }) // 设置token
|
||||
|
||||
|
||||
this.setUid(uid) // 设置用户id
|
||||
|
||||
|
||||
|
|
@ -74,8 +74,13 @@ export default {
|
|||
const routesConfig = result.data.data
|
||||
this.setRoutesConfig(routesConfig)
|
||||
loadRoutes([routesConfig])
|
||||
//this.$router.push(pushTo)
|
||||
this.$closeOthers(pushTo)
|
||||
|
||||
if (closeOthers) {
|
||||
this.$closeOthers(pushTo)
|
||||
} else {
|
||||
this.$router.push(pushTo)
|
||||
}
|
||||
|
||||
this.$message.success(msg, 3)
|
||||
}
|
||||
})
|
||||
|
|
@ -100,6 +105,6 @@ export default {
|
|||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue