mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-18 13:04:46 +08:00
feat: 部分页面添加面包屑
This commit is contained in:
parent
9990cb07ac
commit
3ea378aaa6
@ -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});
|
||||
}
|
||||
|
@ -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({
|
||||
|
@ -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) {
|
||||
|
@ -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 = [];
|
||||
|
@ -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 <div className="user-profile">
|
||||
<div className="user-item-body">
|
||||
{userinfo.uid === this.props.curUid?<h3>个人设置</h3>:<h3>{userinfo.username} 资料设置</h3>}
|
||||
|
||||
|
||||
<Row className="avatarCon" type="flex" justify="start">
|
||||
<Col span={24}>{userinfo.uid === this.props.curUid?<AvatarUpload uid={userinfo.uid}>点击上传头像</AvatarUpload>:<div className = "avatarImg"><img src = {`/api/user/avatar?uid=${userinfo.uid}`} /></div>}</Col>
|
||||
</Row>
|
||||
@ -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 <div className="avatar-box">
|
||||
<Tooltip placement="right" title={<div>点击头像更换 (只支持jpg、png格式且大小不超过200kb的图片)</div>}>
|
||||
<div>
|
||||
@ -387,7 +392,7 @@ function beforeUpload(file) {
|
||||
if (!isLt2M) {
|
||||
message.error('图片必须小于 200kb!');
|
||||
}
|
||||
|
||||
|
||||
return (isPNG||isJPG) && isLt2M;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user