mirror of
https://github.com/eyebluecn/tank-front
synced 2024-04-21 12:31:55 +00:00
Ready to add the UserDetail page.
This commit is contained in:
+2
-2
@@ -6,7 +6,7 @@ import TankComponent from '../common/component/TankComponent';
|
||||
import UserLogin from './user/Login';
|
||||
|
||||
import UserList from './user/List';
|
||||
import UserProfile from './user/Profile';
|
||||
import UserDetail from './user/Detail';
|
||||
import UserEdit from './user/Edit';
|
||||
|
||||
import MatterDetail from './matter/Detail';
|
||||
@@ -165,7 +165,7 @@ class RawFrame extends TankComponent<IProps, IState> {
|
||||
}/>
|
||||
<Route path="/index" component={Index}/>
|
||||
<Route path="/user/login" component={UserLogin}/>
|
||||
<Route path="/user/profile" component={UserProfile}/>
|
||||
<Route path="/user/detail/:uuid" component={UserDetail}/>
|
||||
<Route path="/user/list" component={UserList}/>
|
||||
<Route path="/user/create" component={UserEdit}/>
|
||||
<Route path="/user/edit/:uuid" component={UserEdit}/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import "./Profile.less"
|
||||
import "./Detail.less"
|
||||
import TankComponent from "../../common/component/TankComponent";
|
||||
import {Button} from 'antd';
|
||||
import InfoCell from "../widget/InfoCell";
|
||||
@@ -18,7 +18,7 @@ interface IState {
|
||||
|
||||
}
|
||||
|
||||
export default class Profile extends TankComponent <IProps, IState> {
|
||||
export default class Detail extends TankComponent <IProps, IState> {
|
||||
|
||||
constructor(props: IProps) {
|
||||
super(props)
|
||||
@@ -96,11 +96,18 @@ export default class Edit extends TankComponent<IProps, IState> {
|
||||
wrapperCol: {span: 18},
|
||||
};
|
||||
|
||||
//当前是否为编辑自己的模式。
|
||||
let editSelf: boolean = false
|
||||
if (!this.createMode && user.uuid === currentUser.uuid) {
|
||||
editSelf = true
|
||||
}
|
||||
|
||||
//是否可以编辑角色。
|
||||
let roleEditable: boolean = false
|
||||
if (this.createMode || (user.uuid !== currentUser.uuid && user.role === UserRole.ADMINISTRATOR)) {
|
||||
roleEditable = true
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
<div className="page-user-edit">
|
||||
@@ -137,10 +144,9 @@ export default class Edit extends TankComponent<IProps, IState> {
|
||||
initialValue={currentUser.username}
|
||||
rules={[{required: true, message: '用户名必填!'}]}
|
||||
>
|
||||
<Input/>
|
||||
<Input disabled={!this.createMode}/>
|
||||
</Form.Item>
|
||||
|
||||
|
||||
{
|
||||
this.createMode && (
|
||||
<Form.Item
|
||||
@@ -184,7 +190,7 @@ export default class Edit extends TankComponent<IProps, IState> {
|
||||
name="role"
|
||||
initialValue={currentUser.role}
|
||||
>
|
||||
<Select>
|
||||
<Select disabled={!roleEditable}>
|
||||
{
|
||||
UserRoleList.filter((item: ColorSelectionOption, index: number) => {
|
||||
return item.value !== UserRole.GUEST
|
||||
|
||||
Reference in New Issue
Block a user