Merge pull request #64 from jumpserver/profile

[Update] 添加UserProfile页面;Nav 添加 userProfile 跳转;routes 添加commonRoutes(…
This commit is contained in:
BaiJiangJie 2020-05-27 17:01:07 +08:00 committed by GitHub
commit 1c3b57d548
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 63 additions and 37 deletions

View File

@ -69,6 +69,7 @@
"Role": "角色",
"SerialNumber": "序列号",
"SetMFA": "设置多因子认证",
"UpdateMFA": "更改多因子认证",
"Source": "来源",
"SystemUserDetail": "系统用户详情",
"SystemUsers": "系统用户",

View File

@ -53,6 +53,9 @@ export default {
methods: {
handleClick(val) {
switch (val) {
case 'profile':
this.$router.push({ name: 'userProfile' })
break
case 'AdminPage':
setPermission('Admin')
window.location.href = `/`

View File

@ -54,7 +54,31 @@ export const constantRoutes = [
}
]
/**
* admin and user routes
* the routes that need to be dynamically loaded based on admin or user roles
*/
export const commonRoutes = {
userProfile: {
path: '/users/profile',
component: Layout,
children: [
{
path: '',
name: 'userProfile',
component: () => import('@/userviews/users/index'),
meta: { title: i18n.t('route.UserProfile'), icon: 'user', activeMenu: '/users/profile' }
}
]
}
}
/**
* admin
* the routes that need to be dynamically loaded based on admin roles
*/
export const adminRoutes = [
Object.assign({}, commonRoutes.userProfile, { hidden: true }),
{
path: '/',
component: Layout,
@ -187,18 +211,7 @@ export const userRoutes = [
}
]
},
{
path: '/users',
component: Layout,
children: [
{
path: '/users/profile',
name: 'profile',
component: () => import('@/userviews/users/index'),
meta: { title: i18n.t('route.UserProfile'), icon: 'user' }
}
]
},
commonRoutes.userProfile,
{
path: '/command-executions',
component: Layout,

View File

@ -14,7 +14,7 @@ import DetailCard from '@/components/DetailCard'
import QuickActions from '@/components/QuickActions'
import { toSafeLocalDateStr } from '@/utils/common'
export default {
name: 'Detail',
name: 'UserProfile',
components: {
DetailCard,
QuickActions
@ -38,6 +38,16 @@ export default {
click: function() {}
}
},
{
title: this.$t('assets.UpdateMFA'),
attrs: {
type: 'primary',
label: this.$t('common.Reset')
},
callbacks: {
click: function() {}
}
},
{
title: this.$t('assets.UpdatePassword'),
attrs: {

View File

@ -1,37 +1,36 @@
<template>
<GenericDetailPage :object.sync="TaskDetail" :active-menu.sync="config.activeMenu" v-bind="config" v-on="$listeners">
<GenericDetailPage :object.sync="user" :active-menu.sync="config.activeMenu" v-bind="config" v-on="$listeners">
<keep-alive>
<component :is="config.activeMenu" :object="TaskDetail" />
<component :is="config.activeMenu" :object="user" />
</keep-alive>
</GenericDetailPage>
</template>
<script>
import { GenericDetailPage } from '@/layout/components'
import Detail from './Detail.vue'
export default {
name: 'AssetListDetail',
components: {
GenericDetailPage,
Detail
},
data() {
return {
TaskDetail: {},
config: {
title: this.$t('assets.SystemUserDetail'),
activeMenu: 'Detail',
submenu: [
{
title: this.$t('assets.detail'),
name: 'Detail'
}
],
hasRightSide: false
}
import { GenericDetailPage } from '@/layout/components'
import UserProfile from './UserProfile.vue'
export default {
name: 'AssetListDetail',
components: {
GenericDetailPage,
UserProfile
},
data() {
return {
user: {},
config: {
title: this.$t('common.nav.Profile'),
submenu: [
{
title: this.$t('common.BasicInfo'),
name: 'UserProfile'
}
],
hasRightSide: false
}
}
}
}
</script>
<style scoped>