头部更新

This commit is contained in:
caishi 2023-04-07 11:11:15 +08:00
parent cc093b6ddf
commit f4ad819bea
7 changed files with 1112 additions and 1022 deletions

1974
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3950,7 +3950,7 @@ html>body #ajax-indicator {
}
.head-nav {
text-align: center;
height: 58px;
height: 72px;
box-sizing: border-box;
overflow: hidden;
text-overflow: ellipsis;
@ -3962,27 +3962,55 @@ html>body #ajax-indicator {
position: absolute;
top: 0px;
z-index: 3;
height: 58px;
height: 72px;
box-sizing: border-box;
}
.head-nav ul#header-nav li {
float: left;
height: 58px;
line-height: 58px;
height: 72px;
line-height: 72px;
cursor: pointer;
position: relative;
font-size: 16px;
padding-right:40px;
padding-right:30px;
}
.downMenus{
background: #ffffff;
box-shadow: 0px 10px 16px 0px #cecece;
border-radius: 6px;
position: absolute;
z-index: 999;
left: -20px;
top: -15px;
padding: 20px;
line-height: 1.5;
min-width: 105px;
}
.downMenus li{
cursor: pointer;
}
.downMenus li:hover aside{
color: #165dff!important;
}
.head-nav ul#header-nav li a {
display: block;
display: flex;
align-items: center;
height: 100%;
width: 100%;
color: #fff;
font-size: 16px;
}
.head-nav ul#header-nav li a:hover{
color: #c5c5c5!important;
}
#header-nav li a i{
font-size: 20px!important;
display: inline-block;
transform: translateY(1px) scale(0.7);
color: #979797;
}
.head-nav ul#header-nav li a:hover,.head-nav ul#header-nav li.active a {
color: #5091FF;

View File

@ -2,7 +2,7 @@ import React, { useState } from "react";
import { Input ,notification} from "antd";
const { Search } = Input;
export default ({history}) => {
export default ({history,searchUrl}) => {
const [openSearch, setOpenSearch] = useState(false);
function onGlobalSearch(value) {
@ -32,9 +32,7 @@ export default ({history}) => {
/>
</div>
:
<i className="iconfont icon-sousuo font-18 ml30" style={{color:"#a5a5a5"}} onClick={() => {
setOpenSearch(true)
}} />
<a href={`${searchUrl}?value=`}><i className="iconfont icon-sousuo font-18 ml30 color-white" /></a>
}
</React.Fragment>
)

View File

@ -3,7 +3,7 @@ import AccountProfile from "../../modules/user/AccountProfile";
import { getImageUrl , openNewWindow } from 'educoder';
import axios from 'axios';
import cookie from 'react-cookies';
import { notification , Dropdown ,Popover, Menu,Badge, Input } from 'antd';
import { notification , Dropdown ,Popover, Menu,Badge, Input, Divider } from 'antd';
import { Link } from 'react-router-dom';
import LoginDialog from '../../modules/login/LoginDialog';
@ -14,8 +14,6 @@ import '../../modules/tpm/TPMIndex.css';
import CheckProfile from '../Component/ProfileModal/Profile';
import './header.scss';
import NoticeContent from './NoticeContent';
import MainLogo from './img/logo.png';
import Engineer from './Engineer';
const $ = window.$
// TODO 这部分脚本从公共脚本中直接调用
@ -51,18 +49,30 @@ class NewHeader extends Component {
visiblemyss: false,
openSearch:false,
visible:false, //浮动消息框展示控制
QQVisible:false
QQVisible:false,
educoderBanner:undefined
}
}
componentDidMount() {
this.geturlsdata();
window._header_componentHandler = this;
this.getEducoderSetting();
try {
window.sessionStorage.setItem("yslgeturls", JSON.stringify(window.location.href))
} catch (e) {}
}
getEducoderSetting=()=>{
const url = `https://data.educoder.net/api/setting.json`;
axios.get(url).then(result=>{
if(result && result.data){
this.setState({
educoderBanner:result.data.setting && result.data.setting.navbar
})
}
}).catch(error=>{})
}
SearchInput = (open,item)=>{
if(open){
return(
@ -296,7 +306,19 @@ class NewHeader extends Component {
{
list.map((item,key)=>{
return(
(item.name !=="加入课堂" && item.name !=="加入开发项目") &&
(item.name !=="加入课堂" && 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>
<Menu>
{
list.map((item,key)=>{
return(
(item.name ==="新建开发项目") &&
<Menu.Item key={item.name+key}>
<CheckProfile {...this.props} sureFunc={()=>{window.location.href=item.url}}>{item.name}</CheckProfile>
</Menu.Item>
@ -356,6 +378,24 @@ class NewHeader extends Component {
})
}
menus=(item)=>{
return(
<div className="downMenus">
{
item.map((i,k)=>{
return(
!i.hidden && <li onClick={()=>{window.location.href=`https://data.educoder.net${i.link}`}}>
{k!==0 &&<Divider />}
<aside className="font-16 color-ooo">{i.name}</aside>
<div className="font-14" style={{color:"rgb(159, 167, 179)",whiteSpace:'nowrap'}}>{i.content}</div>
</li>
)
})
}
</div>
)
}
render() {
let current_user = this.props.user;
let {
@ -365,6 +405,7 @@ class NewHeader extends Component {
isRender,
settings,
visible,
educoderBanner
} = this.state;
let search_url = settings && settings.common && settings.common.search;
return (
@ -402,45 +443,50 @@ class NewHeader extends Component {
}
<div className="head-nav pr" id={"head-navpre1"}>
{
settings && settings.navbar && settings.navbar.length > 0 ?
educoderBanner && educoderBanner.length > 0 ?
<ul id="header-nav">
{
settings.navbar && settings.navbar.map((item, key) => {
educoderBanner.map((item, key) => {
var new_link = item.link;
var is_hidden = item.hidden;
// var waiLian = (new_link && str.filter(item=>new_link.indexOf(item)>-1) );
// var wl = waiLian && waiLian.length>0;
return (
<li key={key} onClick={() => this.headtypesonClick(item.link, true)} className={`${((isPath && item.name === "大学开源") || this.matchpaths(item.link) === true) ? 'pr active' : 'pr'}`} style={!is_hidden ? { display: 'flex' } : { display: 'none' }}>
<a href={new_link} ><div dangerouslySetInnerHTML={{ __html: item.name }}></div></a>
{
item.subitem && item.subitem.length>0 ?
<Dropdown overlay={this.menus(item.subitem)}>
<a href={new_link} ><div dangerouslySetInnerHTML={{ __html: item.name }}></div><i className="iconfont icon-xiala1"></i></a>
</Dropdown>
:
<a href={new_link} ><div dangerouslySetInnerHTML={{ __html: item.name }}></div></a>
}
</li>
)
})
}
{
{/* {
settings && settings.engineer_url !== undefined ?
<li>
<a onClick={()=>this.turntoEngineer(settings.engineer_url)}>工程认证</a>
</li>
:""
}
} */}
</ul>
: ""
}
</div>
<div className="head-right">
{ search_url && <HeadSearch {...this.props}/>}
{ search_url && <HeadSearch {...this.props} searchUrl={settings && settings.common && settings.common.search}/>}
{
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">
<img src={require(`./img/add.png`)} alt="" width="16px" className="mr15 ml30"/>
<i className="iconfont icon-tianjiafangda color-white font-18 mr15 ml30"/>
</Dropdown>:""
}
{ (settings && settings.common && settings.common.notice) && (current_user && current_user.login)?
<a href={settings.common.notice} className="message-icon">
{current_user &&
<i className="iconfont icon-xiaoxilingdang color-grey-6 ml15 mr15"></i>
<i className="iconfont icon-xiaoxilingdang color-white ml15 mr15"></i>
}
</a>
: ""

View File

@ -1,8 +1,28 @@
.dropdownFlex{
display:flex;
background:#fff;
border-radius: 3px;
background-color: #fff;
background-clip: padding-box;
border-radius: 2px;
box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12), 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
padding:5px 0px;
>.ant-menu:first-child{
border-right: 2px solid #eee!important;
}
>.ant-menu{
margin:0px 1px;
}
&:hover{
li{
background-color: #f5f5f5;
}
}
li:hover{
background-color: #0152d9;
a{
color: #fff!important;
}
}
.ant-menu-vertical > .ant-menu-item{
border:none;
height: 35px;
@ -12,9 +32,6 @@
background-color: #fff;
a{color: rgba(0, 0, 0, 0.65)!important;}
}
&.ant-menu-item-active{
a{color: #4cacff!important;}
}
}
.ant-menu-vertical{
border:none;

View File

@ -25,7 +25,7 @@ body>.-task-title {
.newHeaders{
max-width: unset;
width: 100%;
height:64px;
height:72px;
min-width: 1200px;
z-index: 1000;
background:#001529;
@ -38,12 +38,13 @@ body>.-task-title {
background: rgba(27, 36, 64,0.2);
}
.headerContent{
padding:0px 25px;
/* padding:0px 25px; */
margin:0px auto;
padding:0px 30px;
/* padding:0px 30px; */
display: flex;
align-items: center;
height: 100%;
width: 1200px;
}
.globalSpin {
max-height: 700px !important;

View File

@ -277,7 +277,7 @@ export function TPMIndexHOC(WrappedComponent) {
size="large" tip={this._gLoadingTip || "加载中..."}
>
<div className="newContainer newContainers">
<div style={{height:"58px"}}></div>
<div style={{height:"72px"}}></div>
<div style={{minHeight:"60vh"}}>
{
current_user &&