12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- import React from 'react';
- import { Row, Col } from 'antd';
- import './topTab.less';
- import ajax from 'jquery/src/ajax/xhr.js'
- import $ from 'jquery/src/ajax';
- import logo from '../../../image/acc-logo.png';
- const TopTab = React.createClass({
- getInitialState() {
- return {
- username: 'username',
- };
- },
- logOut() {
- $.ajax({
- method: "get",
- dataType: "json",
- url: globalConfig.context + "/login",
- }).done(function (data) {
- window.location.href = globalConfig.context + "/portal/index.html"
- });
- },
- componentWillMount () {
- this.getData();
- },
- getData () {
- this.setState({
- loading: false
- });
- $.ajax({
- method: "get",
- dataType: "json",
- url: globalConfig.context + "/api/user/nickname"
- }).done(function (data) {
- if (data.error && data.error.length) {
- message.warning(data.error[0].message);
- } else {
- this.setState({
- nickname: data.data,
- })
- }
- }.bind(this)).always(function () {
- this.setState({
- loading: false
- });
- }.bind(this));
- },
- render() {
- return (
- <div className="account-top" >
- <div className="acc-top-user">
- <span className="acc-top-user-name">欢迎您, {this.state.nickname || userData.nickname || userData.number } <a onClick={this.logOut}>[ 退出 ]</a></span>
- <span className="acc-top-user-toindex"><a href={globalConfig.context + "/portal/index.html"}>返回首页</a></span>
- </div>
- <div className="acc-index">
- <div className="acc-index-imgbox">
- <img src={logo} alt="" />
- </div>
- <span><a href={globalConfig.context + "/user/account/index.html"}>会员中心首页</a></span>
- </div>
- <div className="acc-top-tab">
- <Row>
- <Col className={this.props.active === 'set' ? 'active' : ''} span={3}><a href={globalConfig.context + "/user/account/set.html"}>账号设置</a></Col>
- <Col className={this.props.active === 'services' ? 'active' : ''} span={3}><a href={globalConfig.context + "/user/account/services.html"}>科技服务</a></Col>
- <Col className={this.props.active === 'achievement' ? 'active' : ''} span={3}><a href={globalConfig.context + "/user/account/achievement.html"}>科技成果</a></Col>
- <Col className={this.props.active === 'demand' ? 'active' : ''} span={3}><a href={globalConfig.context + "/user/account/demand.html"}>科技需求</a></Col>
- </Row>
- </div>
- </div >
- )
- }
- });
- export default TopTab;
|