|
@@ -8,12 +8,9 @@ import './index.css';
|
|
|
import CaseShow from "./caseShow/CaseShow";
|
|
import CaseShow from "./caseShow/CaseShow";
|
|
|
import MyDeploy from "./myDeploy/MyDeploy";
|
|
import MyDeploy from "./myDeploy/MyDeploy";
|
|
|
import Contact from "./contact/Contact";
|
|
import Contact from "./contact/Contact";
|
|
|
-import {logoutUrl} from "../../config";
|
|
|
|
|
import {getCookie, setCookie} from "../../cookie";
|
|
import {getCookie, setCookie} from "../../cookie";
|
|
|
-import {GET_USER} from "../../gql";
|
|
|
|
|
|
|
|
|
|
-import {Query} from "react-apollo";
|
|
|
|
|
-import gql from "graphql-tag";
|
|
|
|
|
|
|
+import User from "../user/User"
|
|
|
import axios from 'axios';
|
|
import axios from 'axios';
|
|
|
import moment from 'moment';
|
|
import moment from 'moment';
|
|
|
import 'moment/locale/zh-cn';
|
|
import 'moment/locale/zh-cn';
|
|
@@ -212,92 +209,3 @@ class BasicVersion extends Component {
|
|
|
|
|
|
|
|
export default BasicVersion;
|
|
export default BasicVersion;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-class User extends Component {
|
|
|
|
|
- constructor(props) {
|
|
|
|
|
- super(props);
|
|
|
|
|
- this.state = {
|
|
|
|
|
- show: false
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- logout = () => {
|
|
|
|
|
- axios.get(logoutUrl)
|
|
|
|
|
- .then((res) => {
|
|
|
|
|
- console.log('logout success',res);
|
|
|
|
|
- setCookie("user_id", '');
|
|
|
|
|
- })
|
|
|
|
|
- .catch((err) => {
|
|
|
|
|
- });
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- render() {
|
|
|
|
|
- return (
|
|
|
|
|
- <Query query={gql(GET_USER)} variables={{id: this.props.userID}}>
|
|
|
|
|
- {
|
|
|
|
|
- ({loading, error, data}) => {
|
|
|
|
|
- if (loading) {
|
|
|
|
|
- return <Spin className='login-nickname'/>
|
|
|
|
|
- }
|
|
|
|
|
- if (error) {
|
|
|
|
|
- return 'error!';
|
|
|
|
|
- }
|
|
|
|
|
- let user = data.user_by_id;
|
|
|
|
|
- if (user !== null) {
|
|
|
|
|
- const menu = (
|
|
|
|
|
- <Menu className={'user-detail'}>
|
|
|
|
|
- <Menu.Item className={'user-info'}>
|
|
|
|
|
- <p className={'user-info-nickname'}>{user.nickname}</p>
|
|
|
|
|
- <p className={'user-info-email'}>{user.email}</p>
|
|
|
|
|
- </Menu.Item>
|
|
|
|
|
- <Menu.Item>
|
|
|
|
|
- <a href='https://www.ioobot.com' onClick={(e) => {
|
|
|
|
|
- e.preventDefault();
|
|
|
|
|
- this.props.changeLocale(e)
|
|
|
|
|
- }}>{this.props.languageButton}</a>
|
|
|
|
|
- </Menu.Item>
|
|
|
|
|
- <Menu.Item>
|
|
|
|
|
- <Link to="/login">
|
|
|
|
|
- <div>
|
|
|
|
|
- <FormattedMessage id="Account center"/>
|
|
|
|
|
- </div>
|
|
|
|
|
- </Link>
|
|
|
|
|
- </Menu.Item>
|
|
|
|
|
- <Menu.Item>
|
|
|
|
|
- <Link to="/common/contact">
|
|
|
|
|
- <div>
|
|
|
|
|
- <FormattedMessage id="Submit Support Ticket"/>
|
|
|
|
|
- </div>
|
|
|
|
|
- </Link>
|
|
|
|
|
- </Menu.Item>
|
|
|
|
|
- <Menu.Item className={'login-out'}>
|
|
|
|
|
- <a href='https://www.ioobot.com' onClick={(e) => {
|
|
|
|
|
- e.preventDefault();
|
|
|
|
|
- this.logout();
|
|
|
|
|
- this.props.history.push({
|
|
|
|
|
- pathname: '/'
|
|
|
|
|
- })
|
|
|
|
|
- }}><FormattedMessage id="exit"/></a>
|
|
|
|
|
- </Menu.Item>
|
|
|
|
|
- </Menu>
|
|
|
|
|
- );
|
|
|
|
|
- return (
|
|
|
|
|
- <div className='login-nickname' onClick={()=>{}}>
|
|
|
|
|
- <Dropdown overlay={menu} placement="bottomRight" trigger={['click']}>
|
|
|
|
|
- <div>
|
|
|
|
|
- <span style={{ marginRight: 5 }}>
|
|
|
|
|
- <Badge dot><Avatar shape="user" icon="user" /></Badge>
|
|
|
|
|
- </span>
|
|
|
|
|
- {/*<Icon type="down" />*/}
|
|
|
|
|
- </div>
|
|
|
|
|
- </Dropdown>
|
|
|
|
|
- </div>
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- </Query>
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|