Improve user pages.

This commit is contained in:
Yang Luo 2020-10-21 00:00:44 +08:00
parent 89a094dd78
commit 6be01cc77c
3 changed files with 81 additions and 33 deletions

View File

@ -24,8 +24,11 @@ type User struct {
Name string `xorm:"varchar(100) notnull pk" json:"name"`
CreatedTime string `xorm:"varchar(100)" json:"createdTime"`
Title string `xorm:"varchar(100)" json:"title"`
Url string `xorm:"varchar(2000)" json:"url"`
Password string `xorm:"varchar(100)" json:"password"`
PasswordType string `xorm:"varchar(100)" json:"passwordType"`
DisplayName string `xorm:"varchar(100)" json:"displayName"`
Email string `xorm:"varchar(100)" json:"email"`
Phone string `xorm:"varchar(100)" json:"phone"`
}
func GetUsers(owner string) []*User {

View File

@ -64,23 +64,53 @@ class UserEditPage extends React.Component {
}} />
</Col>
</Row>
<Row style={{marginTop: '10px'}} >
<Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={2}>
Title:
Password Type:
</Col>
<Col span={22} >
<Input value={this.state.user.title} onChange={e => {
this.updateUserField('title', e.target.value);
<Input value={this.state.user.passwordType} onChange={e => {
this.updateUserField('passwordType', e.target.value);
}} />
</Col>
</Row>
<Row style={{marginTop: '10px'}} >
<Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={2}>
Link:
Password:
</Col>
<Col span={22} >
<Input prefix={<LinkOutlined/>} value={this.state.user.url} onChange={e => {
this.updateUserField('url', e.target.value);
<Input value={this.state.user.password} onChange={e => {
this.updateUserField('password', e.target.value);
}} />
</Col>
</Row>
<Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={2}>
Display Name:
</Col>
<Col span={22} >
<Input value={this.state.user.displayName} onChange={e => {
this.updateUserField('displayName', e.target.value);
}} />
</Col>
</Row>
<Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={2}>
Email:
</Col>
<Col span={22} >
<Input value={this.state.user.email} onChange={e => {
this.updateUserField('email', e.target.value);
}} />
</Col>
</Row>
<Row style={{marginTop: '20px'}} >
<Col style={{marginTop: '5px'}} span={2}>
Phone:
</Col>
<Col span={22} >
<Input value={this.state.user.phone} onChange={e => {
this.updateUserField('phone', e.target.value);
}} />
</Col>
</Row>

View File

@ -30,9 +30,12 @@ class UserListPage extends React.Component {
return {
owner: "admin", // this.props.account.username,
name: `user_${this.state.users.length}`,
title: `New User - ${this.state.users.length}`,
createdTime: moment().format(),
Url: "",
password: "123456",
passwordType: "plain",
displayName: `New User - ${this.state.users.length}`,
email: "user@example.com",
phone: "1-12345678",
}
}
@ -79,13 +82,6 @@ class UserListPage extends React.Component {
)
}
},
{
title: 'Title',
dataIndex: 'title',
key: 'title',
// width: '80px',
sorter: (a, b) => a.title.localeCompare(b.title),
},
{
title: 'Created Time',
dataIndex: 'createdTime',
@ -97,26 +93,45 @@ class UserListPage extends React.Component {
}
},
{
title: 'Url',
dataIndex: 'url',
key: 'url',
title: 'PasswordType',
dataIndex: 'passwordType',
key: 'passwordType',
width: '150px',
sorter: (a, b) => a.url.localeCompare(b.url),
render: (text, record, index) => {
return (
<a target="_blank" href={text}>
{
text
}
</a>
)
}
sorter: (a, b) => a.passwordType.localeCompare(b.passwordType),
},
{
title: 'Password',
dataIndex: 'password',
key: 'password',
width: '150px',
sorter: (a, b) => a.password.localeCompare(b.password),
},
{
title: 'Display Name',
dataIndex: 'displayName',
key: 'displayName',
// width: '100px',
sorter: (a, b) => a.displayName.localeCompare(b.displayName),
},
{
title: 'Email',
dataIndex: 'email',
key: 'email',
width: '150px',
sorter: (a, b) => a.email.localeCompare(b.email),
},
{
title: 'Phone',
dataIndex: 'phone',
key: 'phone',
width: '120px',
sorter: (a, b) => a.phone.localeCompare(b.phone),
},
{
title: 'Action',
dataIndex: '',
key: 'op',
width: '220px',
width: '170px',
render: (text, record, index) => {
return (
<div>