RightContent.jsx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import { Tooltip, Tag } from 'antd';
  2. import { QuestionCircleOutlined } from '@ant-design/icons';
  3. import React, { useEffect,useState } from 'react';
  4. import { connect, SelectLang } from 'umi';
  5. import Avatar from './AvatarDropdown';
  6. import HeaderSearch from '../HeaderSearch';
  7. import styles from './index.less';
  8. import NoticeIconView from './NoticeIconView';
  9. const ENVTagColor = {
  10. dev: 'orange',
  11. test: 'green',
  12. pre: '#87d068',
  13. };
  14. const GlobalHeaderRight = (props) => {
  15. console.log('right')
  16. const { theme, layout,dispatch ,taskName} = props;
  17. const [ idInfo,setIdInfo ] = useState({})
  18. let className = styles.right;
  19. if (theme === 'dark' && layout === 'top') {
  20. className = `${styles.right} ${styles.dark}`;
  21. }
  22. // useEffect(()=>{
  23. // let token = window.location.search.split('token=') && window.location.search.split('token=')[1];
  24. // dispatch({
  25. // type: 'editReport/getIdByToken',
  26. // payload: {
  27. // token
  28. // }
  29. // }).then(res=>{
  30. // //{result: "fail", cause: "身份验证失败,请重新点击按钮进入答题页面"}
  31. // if(res.result === 'success'){
  32. // let idInfo = {
  33. // roleId:res.roleId,
  34. // caseId:res.caseId,
  35. // examId:res.examId,
  36. // userId:res.userId,
  37. // case_take_id:res.caseId + '-' + res.examId,
  38. // }
  39. // setIdInfo(idInfo);
  40. // }else{
  41. // //错误处理
  42. // console.log(res)
  43. // }
  44. // })
  45. // },[])
  46. useEffect(()=>{
  47. dispatch({
  48. type: 'report/getTaskName',
  49. payload: { examId: idInfo.examId }
  50. });
  51. },[dispatch,idInfo.examId])
  52. return (
  53. <div className={className}>
  54. {/*<NoticeIconView />*/}
  55. <h3>{taskName || ''}</h3>
  56. {/*<SelectLang className={styles.action}/>*/}
  57. </div>
  58. );
  59. };
  60. export default connect(({ report,settings }) => ({
  61. theme: settings.navTheme,
  62. layout: settings.layout,
  63. taskName:report.taskName,
  64. }))(GlobalHeaderRight);