From 3ea378aaa6a305c9e5071f0b4e7998d4315166c8 Mon Sep 17 00:00:00 2001 From: "wenbo.dong" Date: Mon, 28 Aug 2017 17:49:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=83=A8=E5=88=86=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=9D=A2=E5=8C=85=E5=B1=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/containers/AddProject/AddProject.js | 6 +++++- client/containers/Follows/Follows.js | 6 +++++- .../Group/ProjectList/ProjectList.js | 18 ++++++------------ client/containers/User/List.js | 8 ++++++++ client/containers/User/Profile.js | 15 ++++++++++----- 5 files changed, 34 insertions(+), 19 deletions(-) diff --git a/client/containers/AddProject/AddProject.js b/client/containers/AddProject/AddProject.js index ebd82ee6..15d3bd73 100644 --- a/client/containers/AddProject/AddProject.js +++ b/client/containers/AddProject/AddProject.js @@ -5,6 +5,7 @@ import { Button, Form, Input, Icon, Tooltip, Select, message, Row, Col, Radio } import { addProject } from '../../reducer/modules/project.js'; import { fetchGroupList } from '../../reducer/modules/group.js' import { autobind } from 'core-decorators'; +import { setBreadcrumb } from '../../reducer/modules/user'; const { TextArea } = Input; const FormItem = Form.Item; const Option = Select.Option; @@ -36,7 +37,8 @@ const formItemLayout = { }, { fetchGroupList, - addProject + addProject, + setBreadcrumb } ) @withRouter @@ -52,6 +54,7 @@ class ProjectList extends Component { form: PropTypes.object, addProject: PropTypes.func, history: PropTypes.object, + setBreadcrumb: PropTypes.func, fetchGroupList: PropTypes.func } @@ -85,6 +88,7 @@ class ProjectList extends Component { } async componentWillMount() { + this.props.setBreadcrumb([{name: '新建项目'}]); await this.props.fetchGroupList(); this.setState({groupList: this.props.groupList}); } diff --git a/client/containers/Follows/Follows.js b/client/containers/Follows/Follows.js index 156d0f32..241badee 100644 --- a/client/containers/Follows/Follows.js +++ b/client/containers/Follows/Follows.js @@ -4,6 +4,7 @@ import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { Row, Col } from 'antd'; import { getFollowList } from '../../reducer/modules/follow'; +import { setBreadcrumb } from '../../reducer/modules/user'; import Subnav from '../../components/Subnav/Subnav.js'; import ProjectCard from '../../components/ProjectCard/ProjectCard.js'; import ErrMsg from '../../components/ErrMsg/ErrMsg.js'; @@ -17,7 +18,8 @@ import ErrMsg from '../../components/ErrMsg/ErrMsg.js'; } }, { - getFollowList + getFollowList, + setBreadcrumb } ) class Follows extends Component { @@ -29,6 +31,7 @@ class Follows extends Component { } static propTypes = { getFollowList: PropTypes.func, + setBreadcrumb: PropTypes.func, uid: PropTypes.number } @@ -43,6 +46,7 @@ class Follows extends Component { } async componentWillMount() { + this.props.setBreadcrumb([{name: '我的关注'}]); this.props.getFollowList(this.props.uid).then((res) => { if (res.payload.data.errcode === 0) { this.setState({ diff --git a/client/containers/Group/ProjectList/ProjectList.js b/client/containers/Group/ProjectList/ProjectList.js index bd49e109..1049978b 100644 --- a/client/containers/Group/ProjectList/ProjectList.js +++ b/client/containers/Group/ProjectList/ProjectList.js @@ -6,6 +6,7 @@ import { addProject, fetchProjectList, delProject, changeUpdateModal } from '.. import ProjectCard from '../../../components/ProjectCard/ProjectCard.js'; import ErrMsg from '../../../components/ErrMsg/ErrMsg.js'; import { autobind } from 'core-decorators'; +import { setBreadcrumb } from '../../../reducer/modules/user'; import './ProjectList.scss' @@ -23,7 +24,8 @@ import './ProjectList.scss' fetchProjectList, addProject, delProject, - changeUpdateModal + changeUpdateModal, + setBreadcrumb } ) class ProjectList extends Component { @@ -45,6 +47,7 @@ class ProjectList extends Component { userInfo: PropTypes.object, tableLoading: PropTypes.bool, currGroup: PropTypes.object, + setBreadcrumb: PropTypes.func, currPage: PropTypes.number } @@ -70,19 +73,10 @@ class ProjectList extends Component { receiveRes() { this.props.fetchProjectList(this.props.currGroup._id, this.props.currPage); } - // // 分页逻辑 取消分页 - // @autobind - // paginationChange(pageNum) { - // this.props.fetchProjectList(this.props.currGroup._id, pageNum).then((res) => { - // if (res.payload.data.errcode) { - // message.error(res.payload.data.errmsg); - // } else { - // this.props.changeTableLoading(false); - // } - // }); - // } componentWillReceiveProps(nextProps) { + this.props.setBreadcrumb([{name: '分组: ' + (nextProps.currGroup.group_name || '')}]); + // 切换分组 if (this.props.currGroup !== nextProps.currGroup) { if (nextProps.currGroup._id) { diff --git a/client/containers/User/List.js b/client/containers/User/List.js index 31230d45..97f48680 100755 --- a/client/containers/User/List.js +++ b/client/containers/User/List.js @@ -1,6 +1,7 @@ import React, { Component } from 'react' import { formatTime } from '../../common.js' import { Link } from 'react-router-dom' +import { setBreadcrumb } from '../../reducer/modules/user'; //import PropTypes from 'prop-types' import { connect } from 'react-redux' import PropTypes from 'prop-types' @@ -17,6 +18,8 @@ const limit = 10; return { curUserRole: state.user.role } + },{ + setBreadcrumb } ) class List extends Component { @@ -30,6 +33,7 @@ class List extends Component { } } static propTypes = { + setBreadcrumb: PropTypes.func, curUserRole: PropTypes.string } changePage =(current)=>{ @@ -82,6 +86,10 @@ class List extends Component { } ) } + async componentWillMount() { + this.props.setBreadcrumb([{name: '用户管理'}]); + } + render() { const role = this.props.curUserRole; let data = []; diff --git a/client/containers/User/Profile.js b/client/containers/User/Profile.js index 6c9ae7ea..f9074fde 100644 --- a/client/containers/User/Profile.js +++ b/client/containers/User/Profile.js @@ -3,7 +3,7 @@ import { Row, Col, Input, Button, Select, message, Upload, Tooltip} from 'antd' import axios from 'axios'; import {formatTime} from '../../common.js' import PropTypes from 'prop-types' -// import { Link } from 'react-router-dom' +import { setBreadcrumb } from '../../reducer/modules/user'; import { connect } from 'react-redux' @connect(state=>{ @@ -13,7 +13,7 @@ import { connect } from 'react-redux' curRole: state.user.role } },{ - + setBreadcrumb }) class Profile extends Component { @@ -22,6 +22,7 @@ class Profile extends Component { match: PropTypes.object, curUid: PropTypes.number, userType: PropTypes.string, + setBreadcrumb: PropTypes.func, curRole: PropTypes.string } @@ -148,6 +149,10 @@ class Profile extends Component { } + async componentWillMount() { + this.props.setBreadcrumb([{name: '用户资料'}]); + } + render() { let ButtonGroup = Button.Group; let userNameEditHtml, emailEditHtml, secureEditHtml, roleEditHtml; @@ -269,7 +274,7 @@ class Profile extends Component { return
{userinfo.uid === this.props.curUid?

个人设置

:

{userinfo.username} 资料设置

} - + {userinfo.uid === this.props.curUid?点击上传头像:
}
@@ -356,7 +361,7 @@ class AvatarUpload extends Component { render() { let imageUrl = this.state.imageUrl?this.state.imageUrl:`/api/user/avatar?uid=${this.props.uid}`; // console.log(this.props.uid); - + return
点击头像更换 (只支持jpg、png格式且大小不超过200kb的图片)
}>
@@ -387,7 +392,7 @@ function beforeUpload(file) { if (!isLt2M) { message.error('图片必须小于 200kb!'); } - + return (isPNG||isJPG) && isLt2M; }