Commit de5685b7 authored by superman's avatar superman

1.3.3

parent de51b747
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -76,13 +76,13 @@ ...@@ -76,13 +76,13 @@
} }
} }
.ant-menu-inline .ant-menu-item, .ant-menu-inline .ant-menu-item,
.ant-menu-vertical .ant-menu-item{ .ant-menu-vertical .ant-menu-item {
border-right: 0; border-right: 0;
margin-left: 0; margin-left: 0;
left: 0; left: 0;
} }
.ant-menu-inline .ant-menu-item-selected, .ant-menu-inline .ant-menu-item-selected,
.ant-menu-inline .ant-menu-selected{ .ant-menu-inline .ant-menu-selected {
border-right: 0; border-right: 0;
} }
} }
...@@ -124,6 +124,14 @@ ...@@ -124,6 +124,14 @@
.main-form { .main-form {
padding-top: 24px; padding-top: 24px;
} }
.authorities-checkbox-group {
.ant-checkbox-group-item {
display: block;
}
.ant-checkbox-wrapper + .ant-checkbox-wrapper {
margin-left: 0;
}
}
} }
} }
...@@ -28,6 +28,7 @@ import {formItemLayout, footerFormSubmitLayout} from '../../utils'; ...@@ -28,6 +28,7 @@ import {formItemLayout, footerFormSubmitLayout} from '../../utils';
@connect(state=>({ @connect(state=>({
loading: state.customMessage.loading, loading: state.customMessage.loading,
item: state.customMessage.item
})) }))
@Form.create() @Form.create()
export default class AddItem extends Component { export default class AddItem extends Component {
...@@ -40,6 +41,12 @@ export default class AddItem extends Component { ...@@ -40,6 +41,12 @@ export default class AddItem extends Component {
} }
} }
componentWillReceiveProps(nextProps) {
if (nextProps && nextProps.item && nextProps.item.id) {
this.props.history.replace('/customMessages/' + nextProps.item.id);
}
}
handleSubmit(e) { handleSubmit(e) {
e.preventDefault(); e.preventDefault();
const data = this.props.form.getFieldsValue(); const data = this.props.form.getFieldsValue();
......
...@@ -87,7 +87,7 @@ export default class Item extends Component { ...@@ -87,7 +87,7 @@ export default class Item extends Component {
<Row type="flex" justify="space-around" align="middle"> <Row type="flex" justify="space-around" align="middle">
<Col span={tw}>推送时间</Col> <Col span={tw}>推送时间</Col>
<Col <Col
span={vw}>{item.dateCreated && item.dateCreated.replace(/[年月]/g, '-').replace(/日/g, '')}</Col> span={vw}>{item.dateCreated && (item.dateCreated+'').replace(/[年月]/g, '-').replace(/日/g, '')}</Col>
</Row> </Row>
<Row type="flex" justify="space-around" align="middle"> <Row type="flex" justify="space-around" align="middle">
<Col span={tw}>推送人数</Col> <Col span={tw}>推送人数</Col>
......
...@@ -12,21 +12,23 @@ const Home = ({location}) => { ...@@ -12,21 +12,23 @@ const Home = ({location}) => {
<p> <p>
1. 菜单栏增加"设置"; "管理员"菜单只分配给管理员角色。<br/> 1. 菜单栏增加"设置"; "管理员"菜单只分配给管理员角色。<br/>
2. 修复Window下, 报单审核照片下载文件扩展名缺失。<br/> 2. 修复Window下, 报单审核照片下载文件扩展名缺失。<br/>
3. 创建角色时, 角色ID强制"ROLE_"开头<br/> 3. 创建角色时, 角色ID强制"ROLE_"开头。<br/>
4. ROLE_ADMIN, ROLE_USER, ROLE_DEFAULT 三个角色不允许删除<br/> 4. ROLE_ADMIN, ROLE_USER, ROLE_DEFAULT 三个角色不允许删除。<br/>
5. BUG修复: 推送自定义消息成功后进入消息详情页面。<br/>
6. 更严谨的权限控制。
</p> </p>
<h3>2016-08-17 更新 1.3.2</h3> <h3>2016-08-17 更新 1.3.2</h3>
<p> <p>
1. 报单审核列表页 下载审核成功的照片 1. 报单审核列表页 下载审核成功的照片
</p> </p>
<h3>2016-08-15 更新 1.3.1</h3> <h3>2016-08-15 更新 1.3.1</h3>
<p> <p>
1. 增加身份认证审核 1. 增加身份认证审核
</p> </p>
<h3>2016-08-12 更新 1.3.0</h3> <h3>2016-08-12 更新 1.3.0</h3>
<p> <p>
1. 权限系统<br/> 1. 权限系统<br/>
2. 用户退出, 用户密码修改 2. 用户退出, 用户密码修改
</p> </p>
</div> </div>
......
...@@ -15,6 +15,10 @@ export default class Login extends Component { ...@@ -15,6 +15,10 @@ export default class Login extends Component {
}; };
componentWillMount() {
sessionStorage.clear();
}
handleSubmit = (e)=> { handleSubmit = (e)=> {
e.preventDefault(); e.preventDefault();
const data = this.props.form.getFieldsValue(); const data = this.props.form.getFieldsValue();
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
& > div { & > div {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: -150px;
h1 { h1 {
text-align: center; text-align: center;
margin-bottom: 50px; margin-bottom: 50px;
...@@ -64,8 +65,6 @@ ...@@ -64,8 +65,6 @@
} }
} }
:global(.fade-enter) { :global(.fade-enter) {
opacity: 0; opacity: 0;
animation-duration: 2s; animation-duration: 2s;
......
...@@ -51,11 +51,10 @@ export default class EditItem extends Component { ...@@ -51,11 +51,10 @@ export default class EditItem extends Component {
} }
componentDidMount() { componentDidMount() {
console.log(this.props.isAdmin);
this.fetchItem(this.props.params.id); this.fetchItem(this.props.params.id);
if (this.props.isAdmin) { // if (this.props.isAdmin) {
this.fetchAuthorityList(); this.fetchAuthorityList();
} // }
}; };
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
...@@ -106,9 +105,11 @@ export default class EditItem extends Component { ...@@ -106,9 +105,11 @@ export default class EditItem extends Component {
} }
render() { render() {
const {isAdmin, item, loading, form:{getFieldProps}, location:{query}, isEdit, authorities, dispatch, history} = this.props; const {isAdmin, item, loading, form:{getFieldProps}, location:{query}, isEdit, dispatch, history} = this.props;
let {authorities} = this.props;
const breadcrumb = isAdmin ? ['用户管理', '用户详情'] : ['我的','个人信息']; const breadcrumb = isAdmin ? ['用户管理', '用户详情'] : ['我的', '个人信息'];
const title = isAdmin ? '用户详情' : '个人信息'; const title = isAdmin ? '用户详情' : '个人信息';
...@@ -124,9 +125,10 @@ export default class EditItem extends Component { ...@@ -124,9 +125,10 @@ export default class EditItem extends Component {
const userAuthorities = []; const userAuthorities = [];
if (item && authorities) { if (item && authorities) {
authorities.forEach(authority=> { authorities.forEach(authority=> {
authority.label = authority.description + '(' + authority.name + ')'; authority.label = authority.description + '(' + authority.name + ')' + (authority.status === 5 ? '[已禁用]' : '');
authority.value = authority.name; authority.value = authority.name;
authoritiesMap[authority.name] = authority.label; authority.disabled = authority.status !== 9;
authoritiesMap[authority.name] = authority;
}); });
if (item.authorities) { if (item.authorities) {
const uas = item.authorities.split(','); const uas = item.authorities.split(',');
...@@ -140,69 +142,78 @@ export default class EditItem extends Component { ...@@ -140,69 +142,78 @@ export default class EditItem extends Component {
<Layout header={header}> <Layout header={header}>
<Spin spinning={loading}> <Spin spinning={loading}>
{ {
item && item && authorities &&
<Form className="main-form" horizontal> <Form className="main-form" horizontal>
<Form.Item label="用户名" {...smallFormItemLayout}> <Form.Item label="用户名" {...smallFormItemLayout}>
{ item.username } { item.username }
</Form.Item> </Form.Item>
{
isAdmin ?
<div> <Form.Item label="状态" {...smallFormItemLayout}>
<Form.Item label="状态" {...smallFormItemLayout}> {
{ isAdmin && isEdit ?
isEdit ? <Select
<Select placeholder="请选择状态" {...getFieldProps('status', {initialValue: userStatusToString(item.status)})} >
placeholder="请选择状态" {...getFieldProps('status', {initialValue: userStatusToString(item.status)})} > <Select.Option value="0">未激活</Select.Option>
<Select.Option value="0">未激活</Select.Option> <Select.Option value="1">已激活</Select.Option>
<Select.Option value="1">已激活</Select.Option> </Select>
</Select> :
: (typeof item.status !== 'undefined' ? userStatusToString(item.status) : NULL)
(typeof item.status !== 'undefined' ? userStatusToString(item.status) : NULL) }
} </Form.Item>
</Form.Item> <Form.Item label="角色" {...smallFormItemLayout}>
<Form.Item label="角色" {...smallFormItemLayout}> { isAdmin && isEdit ?
{ isEdit ? <div className="authorities-checkbox-group">
<Checkbox.Group options={authorities} <Checkbox.Group options={authorities}
value={this.state.authoritiesCheckedValues} value={this.state.authoritiesCheckedValues}
onChange={(checkedValues)=> { onChange={(checkedValues)=> {
this.setState({ this.setState({
authoritiesCheckedValues: checkedValues authoritiesCheckedValues: checkedValues
}) })
}}/> }}/>
: <p style={{opacity: .5}}>注意: 只能分配角色列表中已经启用的角色!</p>
(userAuthorities.length ? userAuthorities.join(',') : NULL)
}
</Form.Item>
</div> </div>
: :
<div> (
<Form.Item label="昵称" {...smallFormItemLayout}> userAuthorities.length ?
{ userAuthorities.map((userAuthorty)=>(
isEdit ? userAuthorty &&
<Input {...getFieldProps('nick', {initialValue: item.nick})} /> <div style={userAuthorty.status === 5 ? {opacity: .7} : {}}
: key={userAuthorty.name}>{userAuthorty.label}</div>
item.nick || NULL ))
} :
</Form.Item> NULL
<Form.Item label="E-mail" {...smallFormItemLayout}> )
{ }
isEdit ? </Form.Item>
<Input {...getFieldProps('email', {initialValue: item.email})} />
:
item.email || NULL <Form.Item label="昵称" {...smallFormItemLayout}>
} {
</Form.Item> !isAdmin && isEdit ?
<Form.Item label="手机号" {...smallFormItemLayout}> <Input {...getFieldProps('nick', {initialValue: item.nick})} />
{ :
isEdit ? item.nick || NULL
<Input {...getFieldProps('mobile', {initialValue: item.mobile})} /> }
: </Form.Item>
item.mobile || NULL <Form.Item label="E-mail" {...smallFormItemLayout}>
} {
</Form.Item> !isAdmin && isEdit ?
</div> <Input {...getFieldProps('email', {initialValue: item.email})} />
} :
item.email || NULL
}
</Form.Item>
<Form.Item label="手机号" {...smallFormItemLayout}>
{
!isAdmin && isEdit ?
<Input {...getFieldProps('mobile', {initialValue: item.mobile})} />
:
item.mobile || NULL
}
</Form.Item>
<Form.Item label="注册时间" {...smallFormItemLayout}> <Form.Item label="注册时间" {...smallFormItemLayout}>
{item.dateCreated && formatDateTime(item.dateCreated)} {item.dateCreated && formatDateTime(item.dateCreated)}
</Form.Item> </Form.Item>
......
...@@ -34,17 +34,19 @@ function errorMessageParse(res) { ...@@ -34,17 +34,19 @@ function errorMessageParse(res) {
function xFetch(url, options) { function xFetch(url, options) {
const opts = {...options}; const opts = {...options};
let user;
try {
user = JSON.parse(sessionStorage.getItem('user')) || {};
user = user.data || {};
} catch (ex) {
user = {};
}
opts.headers = { opts.headers = {
...opts.headers, ...opts.headers,
authorization: user.token || '',
}; };
if (url !== '/api/authenticate') {
let user;
try {
user = JSON.parse(sessionStorage.getItem('user')) || {};
user = user.data || {};
} catch (ex) {
user = {};
}
opts.headers.authorization = user.token || '';
}
if (opts.method != 'GET') { if (opts.method != 'GET') {
opts.headers['content-type'] = 'application/x-www-form-urlencoded'; opts.headers['content-type'] = 'application/x-www-form-urlencoded';
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment