Compare commits
3 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
4811817bbc | |
|
|
38d7f7fb64 | |
|
|
fa38d82f29 |
|
|
@ -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,99 +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 &&
|
||||
<div className="dropdownFlex">
|
||||
<Menu>
|
||||
<Menu>
|
||||
{
|
||||
list.map((item, key) => {
|
||||
return (
|
||||
(item.name !== "加入课堂" && item.name !== "加入开发项目") &&
|
||||
<Menu.Item key={item.name + key}>
|
||||
<CheckProfile {...this.props} sureFunc={() => { window.location.href = item.url }}>{item.name}</CheckProfile>
|
||||
list.map((item,key)=>{
|
||||
return(
|
||||
(item.name !=="加入课堂" && item.name !=="加入开发项目") &&
|
||||
<Menu.Item key={item.name+key}>
|
||||
<CheckProfile {...this.props} sureFunc={()=>{window.location.href=item.url}}>{item.name}</CheckProfile>
|
||||
</Menu.Item>
|
||||
)
|
||||
})
|
||||
}
|
||||
<Menu.Item>
|
||||
<AddProjectModal {...this.props} showNotification={this.props.showNotification} />
|
||||
<AddProjectModal {...this.props} showNotification={this.props.showNotification}/>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
renderMenu = (personal) => {
|
||||
renderMenu=(personal)=>{
|
||||
const { current_user } = this.props;
|
||||
return (
|
||||
return(
|
||||
<Menu className="currentMenu">
|
||||
<Menu.Item>
|
||||
<span className="currentName" title={current_user && current_user.username}>{current_user && current_user.username}</span>
|
||||
</Menu.Item>
|
||||
{
|
||||
personal && personal.length > 0 && personal.map((item, key) => {
|
||||
return (
|
||||
<li key={key}><a href={item.url} target="_blank">{item.name}</a></li>
|
||||
)
|
||||
})
|
||||
}
|
||||
{/* <li><Link to={`/settings/profile`}>设置</Link></li> */}
|
||||
{/* <Menu.Item><a onClick={() => this.educoderloginysl()}>退出</a></Menu.Item> */}
|
||||
<Menu.Item><a href='https://www.csmaci.com/#/homepage?logout'>退出</a></Menu.Item>
|
||||
{
|
||||
personal && personal.length > 0 && personal.map((item,key)=>{
|
||||
return(
|
||||
<li key={key}><a href={item.url} target="_blank">{item.name}</a></li>
|
||||
)
|
||||
})
|
||||
}
|
||||
{/* 11111 */}
|
||||
{/* <li><Link to={`/settings/profile`}>设置</Link></li> */}
|
||||
<Menu.Item><a href={'http://www.csjunchuang.com/#/homepage'}>退出</a></Menu.Item>
|
||||
</Menu>
|
||||
)
|
||||
}
|
||||
renderMenuList = () => {
|
||||
return (
|
||||
renderMenuList=()=>{
|
||||
return(
|
||||
<Menu className="currentMenu">
|
||||
<Menu.Item>
|
||||
<a className="ml5 color-grey-6" href={'https://www.csmaci.com/#/homepage'} target="_blank">首页</a>
|
||||
<a className="ml5 color-grey-6" href={'http://www.csjunchuang.com/#/homepage'} target="_blank">首页</a>
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
<a className="ml5 color-grey-6" href={'https://www.csmaci.com/#/platformNews'} target="_blank">平台动态</a>
|
||||
<a className="ml5 color-grey-6" href={'http://www.csjunchuang.com/#/platformNews'} target="_blank">平台动态</a>
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
<a className="ml5 color-grey-6" href={'https://www.csmaci.com/#/demandCenter'} target="_blank">需求中心</a>
|
||||
<a className="ml5 color-grey-6" href={'http://www.csjunchuang.com/#/demandCenter'} target="_blank">需求中心</a>
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
<a className="ml5 color-grey-6" href={'https://www.csmaci.com/#/techService'} target="_blank">科创服务</a>
|
||||
<a className="ml5 color-grey-6" href={'http://www.csjunchuang.com/#/techService'} target="_blank">科创服务</a>
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
<a className="ml5 color-grey-6" href={'https://www.csmaci.com/#/gameIndex'} target="_blank">赛事活动</a>
|
||||
<a className="ml5 color-grey-6" href={'http://www.csjunchuang.com/#/gameIndex'} target="_blank">赛事活动</a>
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
<a className="ml5 color-grey-6" href={'https://www.csmaci.com/#/thinkTank'} target="_blank">科创智库</a>
|
||||
<a className="ml5 color-grey-6" href={'http://www.csjunchuang.com/#/thinkTank'} target="_blank">科创智库</a>
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
<a className="ml5 color-grey-6" href={'https://www.csmaci.com/#/policyList'} target="_blank">政策法规</a>
|
||||
<a className="ml5 color-grey-6" href={'http://www.csjunchuang.com/#/policyList'} target="_blank">政策法规</a>
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
<a className="ml5 color-grey-6" href={'https://www.csmaci.com/#/enterCooperation'} target="_blank">入驻合作</a>
|
||||
<a className="ml5 color-grey-6" href={'http://www.csjunchuang.com/#/enterCooperation'} target="_blank">入驻合作</a>
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
<a className="ml5 color-grey-6" href={'https://www.csmaci.com/#/achievement'} target="_blank">成果转化</a>
|
||||
<a className="ml5 color-grey-6" href={'http://www.csjunchuang.com/#/achievement'} target="_blank">成果转化</a>
|
||||
</Menu.Item>
|
||||
<Menu.Item>
|
||||
<a className="ml5 color-grey-6" href={'https://www.csmaci.com/#/about'} target="_blank">运营单位</a>
|
||||
<a className="ml5 color-grey-6" href={'http://www.csjunchuang.com/#/about'} target="_blank">运营单位</a>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
)
|
||||
|
|
@ -320,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,
|
||||
|
|
@ -423,20 +423,20 @@ class NewHeader extends Component {
|
|||
{...this.props}
|
||||
{...this.state}
|
||||
/> : ""}
|
||||
{
|
||||
settings && settings.nav_logo_url ?
|
||||
<a href={'https://www.csmaci.com/#/homepage'} className={"fl mr50"} style={{ minWidth: "45px", }}>
|
||||
{
|
||||
settings && settings.nav_logo_url ?
|
||||
<a href={'http://www.csjunchuang.com/#/homepage'} className={"fl mr50"} style={{minWidth:"45px",}}>
|
||||
<img alt="可控开源社区" className="logoimg" style={{ heigth: "40px" }} src={logo}></img>
|
||||
</a>
|
||||
:
|
||||
""
|
||||
}
|
||||
<Dropdown className="menulistJun" overlay={this.renderMenuList()}>
|
||||
<div className="menulistJun">菜单</div>
|
||||
</Dropdown>
|
||||
}
|
||||
<Dropdown className="menulistJun" overlay={this.renderMenuList()}>
|
||||
<div className="menulistJun">菜单</div>
|
||||
</Dropdown>
|
||||
<div className="head-nav pr" id={"head-navpre1"}>
|
||||
<ul id="header-nav">
|
||||
<li className='pr' onClick={() => { this.goRouter('/explore') }}>开源项目</li>
|
||||
<li className='pr' onClick={()=>{this.goRouter('/explore')}}>开源项目</li>
|
||||
</ul>
|
||||
{/* {
|
||||
settings && settings.navbar && settings.navbar.length > 0 ?
|
||||
|
|
@ -476,19 +476,19 @@ class NewHeader extends Component {
|
|||
} */}
|
||||
</div>
|
||||
<div className="head-right">
|
||||
{search_url && <HeadSearch {...this.props} />}
|
||||
{ search_url && <HeadSearch {...this.props}/>}
|
||||
{
|
||||
current_user && (current_user.main_site || current_user.login) && (settings && settings.add && settings.add.length > 0) ?
|
||||
<Dropdown overlay={this.addMenu(settings && settings.add)} placement="bottomRight">
|
||||
<i className="iconfont icon-tianjiafangda color-grey-6 ml30 mr15"></i>
|
||||
</Dropdown> : ""
|
||||
current_user && (current_user.main_site || current_user.login) && (settings && settings.add && settings.add.length>0)?
|
||||
<Dropdown overlay={this.addMenu(settings && settings.add)} placement="bottomRight">
|
||||
<i className="iconfont icon-tianjiafangda color-grey-6 ml30 mr15"></i>
|
||||
</Dropdown>:""
|
||||
}
|
||||
|
||||
{(settings && settings.common && settings.common.notice) && (current_user && current_user.login) ?
|
||||
|
||||
{ (settings && settings.common && settings.common.notice) && (current_user && current_user.login)?
|
||||
<Popover
|
||||
overlayClassName="notice-popover"
|
||||
placement={`bottomRight`}
|
||||
content={<NoticeContent visible={visible} current_user={current_user} showNotification={showNotification} resetUserInfo={resetUserInfo} />}
|
||||
content={<NoticeContent visible={visible} current_user={current_user} showNotification={showNotification} resetUserInfo={resetUserInfo}/>}
|
||||
visible={visible}
|
||||
onVisibleChange={this.handleVisibleChange}
|
||||
destroyTooltipOnHide
|
||||
|
|
@ -502,19 +502,19 @@ class NewHeader extends Component {
|
|||
: ""
|
||||
}
|
||||
</div>
|
||||
{!user || (user && !user.login) ?
|
||||
{!user || (user && !user.login) ?
|
||||
<span className="font-15 ml30">
|
||||
{/* <a onClick={() => this.educoderlogin()} className="mr5 color-grey-6">登录</a> */}
|
||||
<a href={'https://www.csmaci.com/#/login'} className="mr5 color-grey-6">登录</a>
|
||||
<a href={'http://www.csjunchuang.com/#/login'} className="mr5 color-grey-6">登录</a>
|
||||
{
|
||||
settings && settings.common && settings.common.register &&
|
||||
// <span><em className="vertical-line"></em><a className="ml5 color-grey-6" href={`${settings.common.register}`} target="_blank">注册</a></span>
|
||||
<span><em className="vertical-line"></em><a className="ml5 color-grey-6" href={'https://www.csmaci.com/#/register'} target="_blank">注册</a></span>
|
||||
<span><em className="vertical-line"></em><a className="ml5 color-grey-6" href={'http://www.csjunchuang.com/#/register'} target="_blank">注册</a></span>
|
||||
}
|
||||
</span>
|
||||
:
|
||||
<Dropdown placement={`bottomRight`} overlay={this.renderMenu(settings && settings.personal)}>
|
||||
<a href={`/${this.props.current_user && this.props.current_user.login}`}>
|
||||
<a href={`/${this.props.current_user && this.props.current_user.login}`}>
|
||||
<img alt="头像" src={getImageUrl(`/${user.image_url}`)} className="currentImg"></img>
|
||||
</a>
|
||||
</Dropdown>
|
||||
|
|
|
|||
Loading…
Reference in New Issue