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": "角色", "Role": "角色",
"SerialNumber": "序列号", "SerialNumber": "序列号",
"SetMFA": "设置多因子认证", "SetMFA": "设置多因子认证",
"UpdateMFA": "更改多因子认证",
"Source": "来源", "Source": "来源",
"SystemUserDetail": "系统用户详情", "SystemUserDetail": "系统用户详情",
"SystemUsers": "系统用户", "SystemUsers": "系统用户",

View File

@ -53,6 +53,9 @@ export default {
methods: { methods: {
handleClick(val) { handleClick(val) {
switch (val) { switch (val) {
case 'profile':
this.$router.push({ name: 'userProfile' })
break
case 'AdminPage': case 'AdminPage':
setPermission('Admin') setPermission('Admin')
window.location.href = `/` 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 = [ export const adminRoutes = [
Object.assign({}, commonRoutes.userProfile, { hidden: true }),
{ {
path: '/', path: '/',
component: Layout, component: Layout,
@ -187,18 +211,7 @@ export const userRoutes = [
} }
] ]
}, },
{ commonRoutes.userProfile,
path: '/users',
component: Layout,
children: [
{
path: '/users/profile',
name: 'profile',
component: () => import('@/userviews/users/index'),
meta: { title: i18n.t('route.UserProfile'), icon: 'user' }
}
]
},
{ {
path: '/command-executions', path: '/command-executions',
component: Layout, component: Layout,

View File

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

View File

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