diff --git a/src/forge/Head/Header.js b/src/forge/Head/Header.js index 4e836b9..18ce82d 100644 --- a/src/forge/Head/Header.js +++ b/src/forge/Head/Header.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import AccountProfile from "../../modules/user/AccountProfile"; import { getImageUrl } from 'educoder' import axios from 'axios'; -import { Input , notification , Dropdown ,Popover, Menu,Badge, Button } from 'antd'; +import { Input, notification, Dropdown, Popover, Menu, Badge, Button } from 'antd'; import { Link } from 'react-router-dom'; import LoginDialog from '../../modules/login/LoginDialog'; @@ -23,7 +23,7 @@ let old_url; window._header_componentHandler = null; // 非trustie链接则新开页跳转 -const str = ['www.trustie.net','forgeplus.trustie.net','forum.trustie.net','testforgeplus.trustie.net'] +const str = ['www.trustie.net', 'forgeplus.trustie.net', 'forum.trustie.net', 'testforgeplus.trustie.net'] class NewHeader extends Component { constructor(props) { super(props) @@ -49,8 +49,8 @@ class NewHeader extends Component { headtypess: "/", settings: null, visiblemyss: false, - openSearch:false, - visible:false, //浮动消息框展示控制 + openSearch: false, + visible: false, //浮动消息框展示控制 } } componentDidMount() { @@ -81,7 +81,7 @@ class NewHeader extends Component { //获取游览器地址 try { window.sessionStorage.setItem("yslgeturls", JSON.stringify(window.location.href)) - } catch (e) {} + } catch (e) { } } openNotification = (messge) => { @@ -162,7 +162,7 @@ class NewHeader extends Component { headtypesonClickbool: bool, }) } - goRouter=(url)=>{ + goRouter = (url) => { this.props.history.push(url) } //获取数据为空的时候 @@ -218,98 +218,99 @@ class NewHeader extends Component { matchpaths = (url) => { const { match } = this.props; - if(url){ + if (url) { if (match.path.indexOf(url) > -1) { return true - }else { + } else { return false } } } - - checkProfile=(url)=>{ - const { showCompeleteDialog , completeProfile } = this.props; - if(!completeProfile){ + + checkProfile = (url) => { + const { showCompeleteDialog, completeProfile } = this.props; + if (!completeProfile) { showCompeleteDialog && showCompeleteDialog(); - }else{ + } else { window.location.href(url); } } - addMenu=(list)=>{ - return( - list && list.length >0 && + addMenu = (list) => { + return ( + list && list.length > 0 &&
- + { - list.map((item,key)=>{ - return( - (item.name !=="加入课堂" && item.name !=="加入开发项目") && - - {window.location.href=item.url}}>{item.name} + list.map((item, key) => { + return ( + (item.name !== "加入课堂" && item.name !== "加入开发项目") && + + { window.location.href = item.url }}>{item.name} ) }) } - +
) } - renderMenu=(personal)=>{ + renderMenu = (personal) => { const { current_user } = this.props; - return( + return ( {current_user && current_user.username} - { - personal && personal.length > 0 && personal.map((item,key)=>{ - return( -
  • {item.name}
  • - ) - }) - } - {/*
  • 设置
  • */} - this.educoderloginysl()}>退出 + { + personal && personal.length > 0 && personal.map((item, key) => { + return ( +
  • {item.name}
  • + ) + }) + } + {/*
  • 设置
  • */} + {/* this.educoderloginysl()}>退出 */} + 退出
    ) } - renderMenuList=()=>{ - return( + renderMenuList = () => { + return ( - 首页 + 首页 - 平台动态 + 平台动态 - 需求中心 + 需求中心 - 科创服务 + 科创服务 - 赛事活动 + 赛事活动 - 科创智库 + 科创智库 - 政策法规 + 政策法规 - 入驻合作 + 入驻合作 - 成果转化 + 成果转化 - 运营单位 + 运营单位 ) @@ -319,7 +320,7 @@ class NewHeader extends Component { }; render() { - const { match ,resetUserInfo ,showNotification} = this.props; + const { match, resetUserInfo, showNotification } = this.props; let current_user = this.props.user; let { AccountProfiletype, @@ -422,20 +423,20 @@ class NewHeader extends Component { {...this.props} {...this.state} /> : ""} - { - settings && settings.nav_logo_url ? - + { + settings && settings.nav_logo_url ? + 可控开源社区 : "" - } - -
    菜单
    -
    + } + +
    菜单
    +
    {/* { settings && settings.navbar && settings.navbar.length > 0 ? @@ -475,19 +476,19 @@ class NewHeader extends Component { } */}
    - { search_url && } + {search_url && } { - current_user && (current_user.main_site || current_user.login) && (settings && settings.add && settings.add.length>0)? - - - :"" + current_user && (current_user.main_site || current_user.login) && (settings && settings.add && settings.add.length > 0) ? + + + : "" } - - { (settings && settings.common && settings.common.notice) && (current_user && current_user.login)? + + {(settings && settings.common && settings.common.notice) && (current_user && current_user.login) ? } + content={} visible={visible} onVisibleChange={this.handleVisibleChange} destroyTooltipOnHide @@ -501,7 +502,7 @@ class NewHeader extends Component { : "" }
    - {!user || (user && !user.login) ? + {!user || (user && !user.login) ? {/* this.educoderlogin()} className="mr5 color-grey-6">登录 */} 登录 @@ -513,7 +514,7 @@ class NewHeader extends Component { : - + 头像