Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2017
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. import React, { Component } from 'react'
  2. import { BrowserRouter, Route, Redirect, Switch } from 'react-router-dom'
  3. import { TabBar, NavBar } from 'antd-mobile';
  4. import { connect } from 'react-redux'
  5. import NavLinkBar from '../navlink'
  6.  
  7. import Boss from '../../container/boss'
  8.  
  9. function Talent(){
  10. return <h2>Talent Home</h2>
  11. }
  12.  
  13. function Msg(){
  14. return <h2>Msg Home</h2>
  15. }
  16.  
  17. function Profile(){
  18. return <h2>Profile Home</h2>
  19. }
  20.  
  21. @connect(
  22. state=>state
  23. )
  24. class Dashboard extends Component {
  25.  
  26. constructor(props) {
  27. super(props)
  28. }
  29.  
  30. componentDidMount() {
  31. }
  32.  
  33. render() {
  34. const { user } = this.props
  35. const { pathname } = this.props.location
  36. const navList = [
  37. {
  38. path: '/boss',
  39. text: 'Boss',
  40. icon: 'boss',
  41. title: 'Boss List',
  42. component: Talent,
  43. hide: user.type==='boss'
  44. },
  45. {
  46. path: '/talent',
  47. text: 'Talent',
  48. icon: 'talent',
  49. title: 'Talents List',
  50. component: Boss,
  51. hide: user.type==='talent'
  52. },
  53. {
  54. path: '/msg',
  55. text: 'Messages',
  56. icon: 'msg',
  57. title: 'Messages List',
  58. component: Msg,
  59. },
  60. {
  61. path: '/me',
  62. text: 'Profile',
  63. icon: 'profile',
  64. title: 'Profile',
  65. component: Profile
  66. }
  67. ]
  68.  
  69. console.log(navList)
  70.  
  71. return(
  72. <div>
  73. <NavBar
  74. className='fixed-header'
  75. mode='dark'
  76. >{navList.find(v=>v.path===pathname).text}</NavBar>
  77. <div style={{marginTop:45}}>
  78. <Switch>
  79. {navList.map(v=>(
  80. <Route
  81. key={v.path}
  82. path={v.path}
  83. component={v.component}>
  84. </Route>
  85. ))}
  86. </Switch>
  87. </div>
  88. <NavLinkBar navList={navList} />
  89. </div>
  90. )
  91. }
  92. }
  93.  
  94. export default Dashboard
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement