mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
添加、编辑、删除用户测试。
This commit is contained in:
parent
3c82b9e16e
commit
85b53b9f9b
@ -28,6 +28,10 @@ Supported Languages: 中文 / [繁體中文](README-tw.md) / [English](README-en
|
||||
14. 新增鼠标移动到物体上的效果。
|
||||
15. 新增选择模式设置。
|
||||
16. 点击系统、组织机构管理,添加机构、添加子机构、删除机构、修改机构名称、设置机构管理员、保存编辑信息、重置编辑信息,测试无bug。
|
||||
17. 添加用户,添加用户名、密码、确认密码、姓名、角色、组织机构,没有bug。
|
||||
18. 编辑用户,修改用户名、姓名、角色、组织机构,没有bug。
|
||||
19. 删除用户,没有bug。
|
||||
20.
|
||||
|
||||
## v0.3.6更新
|
||||
|
||||
|
||||
@ -179,7 +179,20 @@ namespace ShadowEditor.Server.Controllers.System
|
||||
|
||||
if (string.IsNullOrEmpty(model.RoleID))
|
||||
{
|
||||
model.RoleID = "";
|
||||
return Json(new
|
||||
{
|
||||
Code = 300,
|
||||
Msg = "Please select a role."
|
||||
});
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(model.DeptID))
|
||||
{
|
||||
return Json(new
|
||||
{
|
||||
Code = 300,
|
||||
Msg = "Please select a department."
|
||||
});
|
||||
}
|
||||
|
||||
var mongo = new MongoHelper();
|
||||
@ -268,7 +281,20 @@ namespace ShadowEditor.Server.Controllers.System
|
||||
|
||||
if (string.IsNullOrEmpty(model.RoleID))
|
||||
{
|
||||
model.RoleID = "";
|
||||
return Json(new
|
||||
{
|
||||
Code = 300,
|
||||
Msg = "Please select a role."
|
||||
});
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(model.DeptID))
|
||||
{
|
||||
return Json(new
|
||||
{
|
||||
Code = 300,
|
||||
Msg = "Please select a department."
|
||||
});
|
||||
}
|
||||
|
||||
var mongo = new MongoHelper();
|
||||
|
||||
@ -901,5 +901,6 @@
|
||||
"Please select a department.": "请选择机构。",
|
||||
"Selected Mode": "选择模式",
|
||||
"Select Whole": "选择整体",
|
||||
"Select Part": "选择部分"
|
||||
"Select Part": "选择部分",
|
||||
"Please select a role.": "请选择角色"
|
||||
}
|
||||
@ -13,7 +13,8 @@ class EditUserWindow extends React.Component {
|
||||
this.state = {
|
||||
id: props.id,
|
||||
username: props.username,
|
||||
password: props.password,
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
name: props.name,
|
||||
roles: {},
|
||||
roleID: props.roleID,
|
||||
@ -29,12 +30,12 @@ class EditUserWindow extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { id, username, password, name, roles, roleID, deptName } = this.state;
|
||||
const { id, username, password, confirmPassword, name, roles, roleID, deptName } = this.state;
|
||||
|
||||
return <Window
|
||||
className={_t('EditUserWindow')}
|
||||
title={id ? _t('Edit User') : _t('Add User')}
|
||||
style={{ width: '320px', height: '240px' }}
|
||||
style={{ width: '320px', height: '280px' }}
|
||||
mask={false}
|
||||
onClose={this.handleClose}
|
||||
>
|
||||
@ -61,6 +62,14 @@ class EditUserWindow extends React.Component {
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormControl hidden={id !== ''}>
|
||||
<Label>{_t('Confirm Password')}</Label>
|
||||
<Input name={'confirmPassword'}
|
||||
type={'password'}
|
||||
value={confirmPassword}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormControl>
|
||||
<Label>{_t('NickName')}</Label>
|
||||
<Input name={'name'}
|
||||
@ -138,7 +147,7 @@ class EditUserWindow extends React.Component {
|
||||
}
|
||||
|
||||
handleSave(callback) {
|
||||
const { id, username, password, name, roleID, deptID } = this.state;
|
||||
const { id, username, password, confirmPassword, name, roleID, deptID } = this.state;
|
||||
|
||||
if (!username || username.trim() === '') {
|
||||
app.toast(_t('Username is not allowed to be empty.'));
|
||||
@ -150,6 +159,16 @@ class EditUserWindow extends React.Component {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!id && (!confirmPassword || confirmPassword.trim() === '')) {
|
||||
app.toast(_t('Confirm password is not allowed to be empty.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!id && password !== confirmPassword) {
|
||||
app.toast(_t('Password and confirm password is not the same.'));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!name || name.trim() === '') {
|
||||
app.toast(_t('Nick name is not allowed to be empty.'));
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user