import React, { Component } from 'react'
import { Select, Icon, Popconfirm,Divider, Button } from 'antd'
import { Notification } from '@/components/Common-Library'
import { inject, observer } from 'mobx-react'
import { Link, withRouter } from 'react-router-dom'
import Api from '@/service/api'
import mOffice from '@/views/Home/model'
import DateFormat from '@/utils/DateUtil'
const Option = Select.Option

@withRouter
@inject('UserContext')
@inject('i18n')
@observer
export default class Header extends Component {
    constructor(props) {
        super(props)
        this.model = new mOffice()
    }
    logout=()=>{
        const lang = this.props.i18n.lang
        this.props.UserContext.logout()
        let url = '/login'
        if(lang)
            url = `/${lang}/login`
        this.props.history.push(url)
    }
    goHome=()=>{
        const lang = this.props.i18n.lang
        let url = `/${lang}/business/home`
        if(!lang)
            url = "/business/home"
        this.props.history.push(url)
    }
    //跳转到修改密码界面
    changePwd=()=>{
      const lang = this.props.i18n.lang
      let url = `/${lang}/business/chgpwd`
      if(!lang)
        url = "/business/chgpwd"
      this.props.history.push(url)
    }

    render()
    {
        return <div>
				   <div style={{width:700,position:'absolute',fontSize:'1.8em',left:'20px',top:'0.0rem',color:"#fff"}}>
                        <span>邮储银行国结系统</span>
                </div>
				 	{/*
                <img src="img/title2.png"  style={{width:'12em',position:'relative',left:'-35px' }} />
                <div style={{width:700,position:'absolute',left:'300px',top:'0.1rem',color:"#fff"}}>
                 {this.props.UserContext.bchsta_loginsta!==null ?<span>  <span>机构登陆状态：</span><span style={{marginLeft:5}}>{this.props.UserContext.bchsta_loginsta}</span> </span>:null}
                    <span style={{marginLeft:30}}>线上清算开关：</span><span style={{marginLeft:5}}>{this.props.UserContext.syssta_online}</span>
                    <span style={{marginLeft:30}}>当前系统日期：</span><span style={{marginLeft:5}}>{this.props.UserContext.syssta_sysdat}</span>
                    <span style={{marginLeft:30}}>当前系统状态：</span><span style={{marginLeft:5}}>{this.props.UserContext.syssta_syssta}</span>
                </div>
					*/}
                <div style={{position:'absolute',right:'2rem',top:'1.3rem',fontSize:'0.9em',color:'#efefef',letterSpacing: "1px"}}>
                    <span>欢迎您，</span>
                    <span>{this.props.UserContext.usrnam}</span>
                    <span>【{this.props.UserContext.bchnam}】</span>
                </div>
                <div style={{position:'absolute',right:'2em',top:'-1em',color:'white',letterSpacing: "3px"}}>
                    <p style={{display:'inline-block',marginLeft:"5px",marginRight:"5px",cursor:'pointer'}} onClick={this.goHome}> 
                        <img src="img/zhuye.png" />
                        <span>主页</span>
                    </p>
                    <Divider type="vertical" />
                    {/* <p style={{display:'inline-block',marginLeft:"5px",marginRight:"5px"}}>
                        <span style={{color:this.props.i18n.lang!='en'?'inhreit':'#bbb'}}>中文</span>
                        <span>/</span>
                        <span style={{color:this.props.i18n.lang=='en'?'inhreit':'#bbb'}} >English</span>
                    </p>
                    <Divider type="vertical"/> */}
                    <p style={{display:'inline-block',marginLeft:"5px",marginRight:"5px",cursor:'pointer'}} onClick={this.changePwd}>
                      <span>修改密码</span>
                    </p>
                    <Divider type="vertical"/> 
                    <Popconfirm title="确定退出？" placement="bottom" onConfirm={this.logout} >
                        <span style={{color:'white',cursor:'pointer'}}>
                        <img src="img/zhuxiao.png" />注销</span>
                    </Popconfirm>
                </div>
            
        </div>
    }
} 