mirror of
https://github.com/YMFE/yapi.git
synced 2024-12-21 05:19:42 +08:00
fix: 修改user页面细节
This commit is contained in:
parent
deb85bd81c
commit
e781bd3071
@ -83,7 +83,7 @@ class LeftMenu extends Component {
|
||||
const { dataSource } = this.state;
|
||||
return (<div className="user-list">
|
||||
<div className='cur-user'>
|
||||
<div className='user-name'><span>用户名 : </span>{`${this.props.curUserName}`}</div>
|
||||
<div className='user-name'><span>用户名 :</span>{`${this.props.curUserName}`}</div>
|
||||
</div>
|
||||
<Row type="flex" justify="start" className="search">
|
||||
<Col span="24">
|
||||
|
@ -132,7 +132,7 @@ class Profile extends Component {
|
||||
userNameEditHtml = <div >
|
||||
<span className="text">{userinfo.username}</span>
|
||||
{/*<span className="text-button" onClick={() => { this.handleEdit('usernameEdit', true) }}><Icon type="edit" />修改</span>*/}
|
||||
<Button size={'small'} icon="edit" onClick={() => { this.handleEdit('usernameEdit', true) }}>修改</Button>
|
||||
<Button icon="edit" onClick={() => { this.handleEdit('usernameEdit', true) }}>修改</Button>
|
||||
</div>
|
||||
} else {
|
||||
userNameEditHtml = <div>
|
||||
@ -148,14 +148,14 @@ class Profile extends Component {
|
||||
emailEditHtml = <div >
|
||||
<span className="text">{userinfo.email}</span>
|
||||
{/*<span className="text-button" onClick={() => { this.handleEdit('emailEdit', true) }} ><Icon type="edit" />修改</span>*/}
|
||||
<Button size={'small'} icon="edit" onClick={() => { this.handleEdit('emailEdit', true) }}>修改</Button>
|
||||
<Button icon="edit" onClick={() => { this.handleEdit('emailEdit', true) }}>修改</Button>
|
||||
</div>
|
||||
} else {
|
||||
emailEditHtml = <div>
|
||||
<Input placeholder="Email" value={_userinfo.email} name="email" onChange={this.changeUserinfo} />
|
||||
<ButtonGroup className="edit-buttons" >
|
||||
<Button size={'small'} className="edit-button" onClick={() => { this.handleEdit('emailEdit', false) }} >Cancel</Button>
|
||||
<Button size={'small'} className="edit-button" type="primary" onClick={ () => { this.updateUserinfo('email')} }>OK</Button>
|
||||
<Button className="edit-button" onClick={() => { this.handleEdit('emailEdit', false) }} >Cancel</Button>
|
||||
<Button className="edit-button" type="primary" onClick={ () => { this.updateUserinfo('email')} }>OK</Button>
|
||||
</ButtonGroup>
|
||||
</div>
|
||||
}
|
||||
@ -164,7 +164,7 @@ class Profile extends Component {
|
||||
roleEditHtml = <div>
|
||||
<span className="text">{roles[userinfo.role]}</span>
|
||||
{/*<span className="text-button" onClick={() => { this.handleEdit('roleEdit', true) }} ><Icon type="edit" />修改</span>*/}
|
||||
<Button size={'small'} icon="edit" onClick={() => { this.handleEdit('roleEdit', true) }}>修改</Button>
|
||||
<Button icon="edit" onClick={() => { this.handleEdit('roleEdit', true) }}>修改</Button>
|
||||
</div>
|
||||
} else {
|
||||
roleEditHtml = <Select defaultValue={_userinfo.role} onChange={ this.changeRole} style={{ width: 150 }} >
|
||||
@ -175,15 +175,15 @@ class Profile extends Component {
|
||||
}
|
||||
|
||||
if (this.state.secureEdit === false) {
|
||||
secureEditHtml = <Button size={'small'} icon="edit" onClick={() => { this.handleEdit('secureEdit', true) }}>修改</Button>
|
||||
secureEditHtml = <Button icon="edit" onClick={() => { this.handleEdit('secureEdit', true) }}>修改</Button>
|
||||
} else {
|
||||
secureEditHtml = <div>
|
||||
<Input style={{display: this.state.userinfo.role === 'admin' ? 'none': ''}} placeholder="旧的密码" type="password" name="old_password" id="old_password" />
|
||||
<Input placeholder="新的密码" type="password" name="password" id="password" />
|
||||
<Input placeholder="确认密码" type="password" name="verify_pass" id="verify_pass" />
|
||||
<ButtonGroup className="edit-buttons" >
|
||||
<Button size={'small'} className="edit-button" onClick={() => { this.handleEdit('secureEdit', false) }}>Cancel</Button>
|
||||
<Button size={'small'} className="edit-button" onClick={this.updatePassword} type="primary">OK</Button>
|
||||
<Button className="edit-button" onClick={() => { this.handleEdit('secureEdit', false) }}>Cancel</Button>
|
||||
<Button className="edit-button" onClick={this.updatePassword} type="primary">OK</Button>
|
||||
</ButtonGroup>
|
||||
</div>
|
||||
}
|
||||
|
@ -30,15 +30,15 @@
|
||||
}
|
||||
}
|
||||
.user-name{
|
||||
padding: 24px 0px;
|
||||
text-align: center;
|
||||
padding: 24px 10px;
|
||||
// text-align: center;
|
||||
background-color: #34495e;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
border-top-left-radius:5px;
|
||||
border-top-right-radius: 5px;
|
||||
span{
|
||||
margin-right: 10px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
.router-content{
|
||||
@ -70,9 +70,6 @@
|
||||
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20);
|
||||
background: #FFF;
|
||||
border-radius:5px;
|
||||
.ant-btn-group{
|
||||
margin-top: 12px;
|
||||
}
|
||||
.user-item {
|
||||
min-height:35px;
|
||||
line-height:35px;
|
||||
@ -90,10 +87,11 @@
|
||||
.ant-col-12{
|
||||
.ant-input{
|
||||
width: 70%;
|
||||
margin-right: 24px;
|
||||
}
|
||||
}
|
||||
.ant-col-4{
|
||||
color: black;
|
||||
color: rgba(0,0,0,0.85);
|
||||
padding: 0px 10px;
|
||||
text-indent: .7em;
|
||||
// background-color: #f1f3f6;
|
||||
|
@ -94,6 +94,7 @@ var interfaceController = function (_baseController) {
|
||||
case 0:
|
||||
params = ctx.request.body;
|
||||
|
||||
|
||||
params = _yapi2.default.commons.handleParams(params, {
|
||||
project_id: 'number',
|
||||
title: 'string',
|
||||
@ -160,8 +161,12 @@ var interfaceController = function (_baseController) {
|
||||
};
|
||||
|
||||
|
||||
if (params.req_params_form) data.req_params_form = params.req_params_form;
|
||||
if (params.req_params_other) data.req_params_other = params.req_params_other;
|
||||
if (params.req_params_form) {
|
||||
data.req_params_form = params.req_params_form;
|
||||
}
|
||||
if (params.req_params_other) {
|
||||
data.req_params_other = params.req_params_other;
|
||||
}
|
||||
|
||||
_context.next = 22;
|
||||
return this.Model.save(data);
|
||||
@ -301,7 +306,7 @@ var interfaceController = function (_baseController) {
|
||||
_context3.prev = 10;
|
||||
_context3.t0 = _context3['catch'](3);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, e.message);
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context3.t0.message);
|
||||
|
||||
case 13:
|
||||
case 'end':
|
||||
@ -356,6 +361,7 @@ var interfaceController = function (_baseController) {
|
||||
case 0:
|
||||
params = ctx.request.body;
|
||||
|
||||
|
||||
params = _yapi2.default.commons.handleParams(params, {
|
||||
title: 'string',
|
||||
path: 'string',
|
||||
@ -364,6 +370,7 @@ var interfaceController = function (_baseController) {
|
||||
});
|
||||
params.method = params.method || 'GET';
|
||||
params.method = params.method.toUpperCase();
|
||||
|
||||
id = ctx.request.body.id;
|
||||
|
||||
if (id) {
|
||||
@ -412,18 +419,36 @@ var interfaceController = function (_baseController) {
|
||||
};
|
||||
|
||||
|
||||
if (params.path) data.path = params.path;
|
||||
if (params.title) data.title = params.title;
|
||||
if (params.desc) data.desc = params.desc;
|
||||
if (params.method) data.method = params.method;
|
||||
if (params.path) {
|
||||
data.path = params.path;
|
||||
}
|
||||
if (params.title) {
|
||||
data.title = params.title;
|
||||
}
|
||||
if (params.desc) {
|
||||
data.desc = params.desc;
|
||||
}
|
||||
if (params.method) {
|
||||
data.method = params.method;
|
||||
}
|
||||
|
||||
if (params.req_headers) data.req_headers = params.req_headers;
|
||||
if (params.req_headers) {
|
||||
data.req_headers = params.req_headers;
|
||||
}
|
||||
|
||||
if (params.req_params_form) data.req_params_form = params.req_params_form;
|
||||
if (params.req_params_other) data.req_params_other = params.req_params_other;
|
||||
if (params.req_params_form) {
|
||||
data.req_params_form = params.req_params_form;
|
||||
}
|
||||
if (params.req_params_other) {
|
||||
data.req_params_other = params.req_params_other;
|
||||
}
|
||||
|
||||
if (params.res_body_type) data.res_body_type = params.res_body_type;
|
||||
if (params.res_body) data.res_body = params.res_body;
|
||||
if (params.res_body_type) {
|
||||
data.res_body_type = params.res_body_type;
|
||||
}
|
||||
if (params.res_body) {
|
||||
data.res_body = params.res_body;
|
||||
}
|
||||
|
||||
_context4.prev = 28;
|
||||
_context4.next = 31;
|
||||
|
@ -47,13 +47,17 @@ exports.log = function (msg, type) {
|
||||
|
||||
switch (type) {
|
||||
case 'log':
|
||||
f = console.log;break;
|
||||
f = console.log;
|
||||
break;
|
||||
case 'warn':
|
||||
f = console.warn;break;
|
||||
f = console.warn;
|
||||
break;
|
||||
case 'error':
|
||||
f = console.error;break;
|
||||
f = console.error;
|
||||
break;
|
||||
default:
|
||||
f = console.log;break;
|
||||
f = console.log;
|
||||
break;
|
||||
}
|
||||
|
||||
f(type + ':', msg);
|
||||
@ -231,9 +235,11 @@ exports.handleParams = function (params, keys) {
|
||||
if (params[key]) {
|
||||
switch (filter) {
|
||||
case 'string':
|
||||
params[key] = trim(params[key] + '');break;
|
||||
params[key] = trim(params[key] + '');
|
||||
break;
|
||||
case 'number':
|
||||
params[key] = parseInt(params[key], 10);break;
|
||||
params[key] = parseInt(params[key], 10);
|
||||
break;
|
||||
default:
|
||||
params[key] = trim(params + '');
|
||||
}
|
||||
|
@ -31,12 +31,13 @@ function connect() {
|
||||
var options = {};
|
||||
|
||||
if (config.user) {
|
||||
options.user = config.db.user, options.pass = config.db.pass;
|
||||
options.user = config.db.user;
|
||||
options.pass = config.db.pass;
|
||||
}
|
||||
|
||||
var db = _mongoose2.default.connect('mongodb://' + config.db.servername + ':' + config.db.port + '/' + config.db.DATABASE, options);
|
||||
|
||||
db.then(function (res) {
|
||||
db.then(function () {
|
||||
_yapi2.default.commons.log('mongodb load success...');
|
||||
}, function (err) {
|
||||
_yapi2.default.commons.log(err, 'Mongo connect error');
|
||||
|
Loading…
Reference in New Issue
Block a user