Commit 05c741e2 by 姜雷

带出用户数据

parent e40e259b
...@@ -4,6 +4,7 @@ import { applyPublicCar, fetchCarCategory } from '../../api/index'; ...@@ -4,6 +4,7 @@ import { applyPublicCar, fetchCarCategory } from '../../api/index';
import styles from './style.css'; import styles from './style.css';
import { formatDate } from '../../utils/index'; import { formatDate } from '../../utils/index';
import arrIcon from '../../components/Input/Select/images/select_icon@2x.png'; import arrIcon from '../../components/Input/Select/images/select_icon@2x.png';
import UserInfoContext from '../../context/userinfo-context'
const CustomChildren = ({ extra, onClick, children }) => ( const CustomChildren = ({ extra, onClick, children }) => (
<div onClick={onClick} className={styles.selectWrap}> <div onClick={onClick} className={styles.selectWrap}>
...@@ -17,9 +18,9 @@ class PublicCarApply extends Component { ...@@ -17,9 +18,9 @@ class PublicCarApply extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
department: '', department: props.userinfo.department,
createDate: formatDate(new Date(), 'yyyy-MM-dd'), createDate: formatDate(new Date(), 'yyyy-MM-dd'),
name: '', name: props.userinfo.name,
categoryId: '', categoryId: '',
userCount: '', userCount: '',
beginDate: '', beginDate: '',
...@@ -207,4 +208,8 @@ class PublicCarApply extends Component { ...@@ -207,4 +208,8 @@ class PublicCarApply extends Component {
} }
} }
export default PublicCarApply; export default props => (
<UserInfoContext.Consumer>
{({ userinfo }) => <PublicCarApply userinfo={userinfo} {...props} />}
</UserInfoContext.Consumer>
);
...@@ -14,6 +14,7 @@ import { fetchRepairArea, fetchRepairTerm } from '../../api/index'; ...@@ -14,6 +14,7 @@ import { fetchRepairArea, fetchRepairTerm } from '../../api/index';
import { reportRepair } from '../../api/repairAdd'; import { reportRepair } from '../../api/repairAdd';
import Perview from '../../components/Perview/Perview'; import Perview from '../../components/Perview/Perview';
import store from '../../store/index'; import store from '../../store/index';
import UserInfoContext from '../../context/userinfo-context';
class ReprtRepair extends Component { class ReprtRepair extends Component {
constructor(props) { constructor(props) {
...@@ -22,8 +23,8 @@ class ReprtRepair extends Component { ...@@ -22,8 +23,8 @@ class ReprtRepair extends Component {
areaList: [], areaList: [],
termList: [], termList: [],
applyForm: { applyForm: {
name: '', name: props.userinfo.name,
repairCellphone: '', repairCellphone: props.userinfo.cellphone,
applyIdentity: '学生', applyIdentity: '学生',
area: '', area: '',
areaId: '', areaId: '',
...@@ -356,4 +357,8 @@ class ReprtRepair extends Component { ...@@ -356,4 +357,8 @@ class ReprtRepair extends Component {
} }
} }
export default ReprtRepair; export default props => (
<UserInfoContext.Consumer>
{({ userinfo }) => <ReprtRepair userinfo={userinfo} {...props} />}
</UserInfoContext.Consumer>
);
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