|
|
|
@ -28,7 +28,7 @@ import 'antd/lib/radio/style/index.css';
|
|
|
|
|
|
|
|
|
|
import 'antd/lib/input/style/index.css';
|
|
|
|
|
|
|
|
|
|
import './TPMIndex.css'
|
|
|
|
|
import './TPMIndex.css';
|
|
|
|
|
|
|
|
|
|
import { trigger, broadcastChannelPostMessage } from 'educoder';
|
|
|
|
|
|
|
|
|
@ -38,114 +38,6 @@ const $ = window.$
|
|
|
|
|
const RadioGroup = Radio.Group;
|
|
|
|
|
const { Search } = Input;
|
|
|
|
|
let old_url;
|
|
|
|
|
function loadHeader(){
|
|
|
|
|
//头部导航条的----------显示搜索框
|
|
|
|
|
$("#search-open").on("click",function(e){
|
|
|
|
|
$(this).hide();
|
|
|
|
|
// $("#header-nav").animate({opacity:"0"},1000);
|
|
|
|
|
$(".posi-search").show() // animate({opacity:"1"},1000);
|
|
|
|
|
$("#header-nav").css("z-index","2");
|
|
|
|
|
$(".posi-search").css("z-index","3");
|
|
|
|
|
$(".HeaderSearch").show();
|
|
|
|
|
$(".HeaderSearch").val("");
|
|
|
|
|
$(".search-input").focus();
|
|
|
|
|
$(".search-all .search-content").hide();
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
});
|
|
|
|
|
$(".HeaderSearch").on("click",function(e){
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
});
|
|
|
|
|
//搜索框输入内容
|
|
|
|
|
$(".HeaderSearch").on("input",function(e){
|
|
|
|
|
if($(".HeaderSearch").val()==""){
|
|
|
|
|
$(".search-all .search-content").hide();
|
|
|
|
|
}else{
|
|
|
|
|
$(".search-all .search-content").show();
|
|
|
|
|
}
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
});
|
|
|
|
|
//搜索
|
|
|
|
|
// $("#header_keyword_search").on("click", header_search);
|
|
|
|
|
// $("input[name='search_keyword']").on("keydown", function(event){
|
|
|
|
|
// var code;
|
|
|
|
|
// if (!event) {
|
|
|
|
|
// event = window.event; //针对ie浏览器
|
|
|
|
|
// code = event.keyCode;
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// code = event.keyCode;
|
|
|
|
|
// }
|
|
|
|
|
// if(code == 13) {
|
|
|
|
|
// header_search();
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
$(".search-clear").click(function(e){e.stopPropagation();});
|
|
|
|
|
//切换搜索条件
|
|
|
|
|
$("#searchkey li").click(function(e){
|
|
|
|
|
var key=$($(this).children("a")[0]).html();
|
|
|
|
|
switch (key){
|
|
|
|
|
case '实训':
|
|
|
|
|
$("#search_type").val('1');
|
|
|
|
|
break;
|
|
|
|
|
case '课堂':
|
|
|
|
|
$("#search_type").val('2');
|
|
|
|
|
break;
|
|
|
|
|
case '用户':
|
|
|
|
|
$("#search_type").val('3');
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
$("#searchkey").siblings(".searchkey").html(key);
|
|
|
|
|
$("#searchkey").hide();
|
|
|
|
|
e.stopPropagation();//阻止冒泡
|
|
|
|
|
});
|
|
|
|
|
//切换选择导航条
|
|
|
|
|
$("#header-nav li").click(function(){
|
|
|
|
|
$("#header-nav li").removeClass("active");
|
|
|
|
|
$(this).addClass("active");
|
|
|
|
|
});
|
|
|
|
|
//点击页面其它(与搜索框无关的地方)都会将搜索框隐藏,所以与搜索框有关的地方需要阻止冒泡
|
|
|
|
|
$("body").on("click",function(){
|
|
|
|
|
closeSearch();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(".search_history").on("click", function(){
|
|
|
|
|
$("input[name='search_keyword']").val($(this).html());
|
|
|
|
|
header_search();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function header_search(reactHeaderComponnet){
|
|
|
|
|
console.log(old_url)
|
|
|
|
|
var keyword = $("input[name='search_keyword']").val(); // 搜索关键字
|
|
|
|
|
window.location.href ="/search"+"?value="+keyword;
|
|
|
|
|
// if (!reactHeaderComponnet) {
|
|
|
|
|
// reactHeaderComponnet = window._header_componentHandler
|
|
|
|
|
// }
|
|
|
|
|
// if (!reactHeaderComponnet) {
|
|
|
|
|
// var index = $("#search_type").val(); // 搜索课程/项目
|
|
|
|
|
// keyword = encodeURIComponent(keyword);
|
|
|
|
|
// // $.get('/users/search_shixuns_or_course',
|
|
|
|
|
// // { search: keyword,
|
|
|
|
|
// // index: index});
|
|
|
|
|
// window.location.href = old_url+"/users/search_shixuns_or_courses" + "?search=" + keyword + "&index=" + index;
|
|
|
|
|
//e.stopPropagation();//阻止冒泡
|
|
|
|
|
// } else {
|
|
|
|
|
// window.__headSearchKeyword = keyword
|
|
|
|
|
// reactHeaderComponnet.props.history.push(`/shixuns`)
|
|
|
|
|
// trigger('searchKeywordChange', keyword)
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
//头部导航条的隐藏
|
|
|
|
|
function closeSearch(){
|
|
|
|
|
$('#posi-search').hide();
|
|
|
|
|
$("#search-open").show();
|
|
|
|
|
// $(".posi-search").animate({opacity:"0"},800);
|
|
|
|
|
$(".HeaderSearch").hide();
|
|
|
|
|
$("#header-nav").animate({opacity:"1"},1000);
|
|
|
|
|
$(".posi-search").css("z-index","2");
|
|
|
|
|
$("#header-nav").css("z-index","3");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
_logined_header.html.erb
|
|
|
|
@ -170,8 +62,9 @@ class NewHeader extends Component {
|
|
|
|
|
RadioGroupvalue:undefined,
|
|
|
|
|
submitapplications:false,
|
|
|
|
|
isRender:false,
|
|
|
|
|
// isRenders:false,
|
|
|
|
|
showSearchOpentype:false,
|
|
|
|
|
showTrial:false,
|
|
|
|
|
setevaluatinghides:false
|
|
|
|
|
}
|
|
|
|
|
// console.log("176")
|
|
|
|
|
// console.log(props);
|
|
|
|
@ -180,8 +73,6 @@ class NewHeader extends Component {
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
window._header_componentHandler = this;
|
|
|
|
|
|
|
|
|
|
loadHeader();
|
|
|
|
|
|
|
|
|
|
//下拉框的显示隐藏
|
|
|
|
|
var hoverTimeout;
|
|
|
|
|
var hoveredPanel;
|
|
|
|
@ -382,36 +273,11 @@ class NewHeader extends Component {
|
|
|
|
|
onKeywordSearch = () => {
|
|
|
|
|
header_search(this)
|
|
|
|
|
}
|
|
|
|
|
onKeywordSearchKeyDown = (e) => {
|
|
|
|
|
|
|
|
|
|
let url="/search?value="+e.target.value;
|
|
|
|
|
|
|
|
|
|
this.props.history.push(url)
|
|
|
|
|
// let code = e.keyCode;
|
|
|
|
|
|
|
|
|
|
// if(code == 13) {
|
|
|
|
|
// header_search(this);
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
onSearchhref = (e) => {
|
|
|
|
|
let url="/search?value="+e.target.value;
|
|
|
|
|
|
|
|
|
|
this.props.history.push(url)
|
|
|
|
|
// let code = e.keyCode;
|
|
|
|
|
|
|
|
|
|
// if(code == 13) {
|
|
|
|
|
// header_search(this);
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hideAddcoursestypes=()=>{
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
Addcoursestypes:false
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -575,12 +441,50 @@ submittojoinclass=(value)=>{
|
|
|
|
|
cancelModulationModels = () => {
|
|
|
|
|
this.setState({isRenders: false})
|
|
|
|
|
}
|
|
|
|
|
inputjoinclassvalue=(e)=>{
|
|
|
|
|
|
|
|
|
|
inputjoinclassvalue=(e)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
tojoinclasstitle:e.target.value
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showSearchOpen=(e)=>{
|
|
|
|
|
this.setState({
|
|
|
|
|
showSearchOpentype:true
|
|
|
|
|
})
|
|
|
|
|
e.stopPropagation(e);//阻止冒泡
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hideshowSearchOpen=(e)=>{
|
|
|
|
|
let {setevaluatinghides}=this.state;
|
|
|
|
|
if(setevaluatinghides===true){
|
|
|
|
|
this.setState({
|
|
|
|
|
showSearchOpentype:false,
|
|
|
|
|
setevaluatinghides:false
|
|
|
|
|
})
|
|
|
|
|
e.stopPropagation(e);//阻止冒泡
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onKeywordSearchKeyDown = (value) => {
|
|
|
|
|
let url=`/search?value=${value}`;
|
|
|
|
|
this.props.history.push(url)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onKeywordSearchKeyDowns=()=>{
|
|
|
|
|
this.setState(
|
|
|
|
|
{
|
|
|
|
|
setevaluatinghides:false
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setevaluatinghides=()=>{
|
|
|
|
|
this.setState(
|
|
|
|
|
{
|
|
|
|
|
setevaluatinghides:true
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
render() {
|
|
|
|
|
const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。
|
|
|
|
@ -601,7 +505,7 @@ submittojoinclass=(value)=>{
|
|
|
|
|
submitapplicationsvalue,
|
|
|
|
|
user,
|
|
|
|
|
isRender,
|
|
|
|
|
isRenders,
|
|
|
|
|
showSearchOpentype,
|
|
|
|
|
}=this.state;
|
|
|
|
|
/*
|
|
|
|
|
用户名称 用户头像url
|
|
|
|
@ -631,25 +535,13 @@ submittojoinclass=(value)=>{
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
|
|
|
|
|
<div className="newHeader" id="nHeader">
|
|
|
|
|
{/*{*/}
|
|
|
|
|
{/* isRender&& isRender === true?*/}
|
|
|
|
|
<div className="newHeader" id="nHeader" >
|
|
|
|
|
|
|
|
|
|
<LoginDialog
|
|
|
|
|
{...this.state}
|
|
|
|
|
{...this.props}
|
|
|
|
|
/>
|
|
|
|
|
{/* :""*/}
|
|
|
|
|
{/*}*/}
|
|
|
|
|
|
|
|
|
|
{/*{*/}
|
|
|
|
|
{/* isRenders&&isRenders===true?*/}
|
|
|
|
|
{/* <Trialapplication*/}
|
|
|
|
|
{/* {...this.state}*/}
|
|
|
|
|
{/* Cancel={() => this.cancelModulationModels()}*/}
|
|
|
|
|
{/* />*/}
|
|
|
|
|
{/* :""*/}
|
|
|
|
|
{/*}*/}
|
|
|
|
|
{/*<Trialapplication {...this.state} {...this.props} Cancel={() => this.cancelModulationModels()} ></Trialapplication>*/}
|
|
|
|
|
|
|
|
|
|
<div className="educontent clearfix">
|
|
|
|
|
{/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/}
|
|
|
|
|
<a href="/">
|
|
|
|
@ -726,17 +618,18 @@ submittojoinclass=(value)=>{
|
|
|
|
|
</div>
|
|
|
|
|
{/*<input type="text" className="search-input fl" id="search-input" */}
|
|
|
|
|
{/*onKeyDown={this.onKeywordSearchKeyDown} name="search_keyword" placeholder="搜索实训项目"/>*/}
|
|
|
|
|
|
|
|
|
|
<div className={"HeaderSearch"}
|
|
|
|
|
style={{display: 'none'}}
|
|
|
|
|
>
|
|
|
|
|
{/*搜索框*/}
|
|
|
|
|
{showSearchOpentype===true?<div className={"HeaderSearch"} onBlur={(e)=>this.hideshowSearchOpen(e)} onMouseLeave={()=>this.setevaluatinghides()}>
|
|
|
|
|
<Search
|
|
|
|
|
id={"HeaderSearchs"}
|
|
|
|
|
placeholder="实践课程/翻转课堂/开发社区/交流问答"
|
|
|
|
|
// onSearch={(e)=>this.onSearchhref(e)}
|
|
|
|
|
onPressEnter={this.onKeywordSearchKeyDown}
|
|
|
|
|
onInput={()=>this.onKeywordSearchKeyDowns()}
|
|
|
|
|
onSearch={(value) => this.onKeywordSearchKeyDown(value)}
|
|
|
|
|
// onPressEnter={this.onKeywordSearchKeyDown}
|
|
|
|
|
style={{ width: 300 }}
|
|
|
|
|
autoFocus={true}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>:""}
|
|
|
|
|
|
|
|
|
|
{/*<a className="search-icon fl" id="header_keyword_search" onClick={this.onKeywordSearch}>*/}
|
|
|
|
|
{/*/!*<i className="fa fa-search font-16 mt23 color-grey-6"></i>*!/*/}
|
|
|
|
@ -798,13 +691,13 @@ submittojoinclass=(value)=>{
|
|
|
|
|
}
|
|
|
|
|
{/*href="https://www.educoder.net/login"*/}
|
|
|
|
|
<div className="fr head-right ">
|
|
|
|
|
{ loadHeader()}
|
|
|
|
|
<a id="search-open" className="fl mr30 headIcon">
|
|
|
|
|
{/*{ loadHeader()}*/}
|
|
|
|
|
{showSearchOpentype===true?"":<a id="search-open" className="fl mr30 headIcon" onClick={(e)=>this.showSearchOpen(e)}>
|
|
|
|
|
{/*"/images/educoder/icon/search.svg"
|
|
|
|
|
<img src={getImageUrl(`images/educoder/icon/search.svg`)} /> */}
|
|
|
|
|
|
|
|
|
|
<i className="iconfont icon-sousuo color-white"></i>
|
|
|
|
|
</a>
|
|
|
|
|
</a>}
|
|
|
|
|
|
|
|
|
|
{/*</div>*/}
|
|
|
|
|
<div className="fl mr30 edu-menu-panel headIcon">
|
|
|
|
@ -981,7 +874,7 @@ export default NewHeader;
|
|
|
|
|
|
|
|
|
|
{/*
|
|
|
|
|
需求:消息数量
|
|
|
|
|
<div className="fl mr30 edu-menu-panel headIcon">
|
|
|
|
|
<div className="fl mr30 edu-menu-panel headIcon">
|
|
|
|
|
<a href={`/users/${user.login}/user_tidings`}><img src={getImageUrl(`images/educoder/icon/bell.svg`}></a>
|
|
|
|
|
|
|
|
|
|
<em className="newslight"></em>
|
|
|
|
@ -990,5 +883,117 @@ export default NewHeader;
|
|
|
|
|
您有<span className="color-orange">30</span>条新消息,点击查看
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
*/}
|
|
|
|
|
</div>
|
|
|
|
|
*/}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// function loadHeader(){
|
|
|
|
|
// //头部导航条的----------显示搜索框
|
|
|
|
|
// $("#search-open").on("click",function(e){
|
|
|
|
|
// $(this).hide();
|
|
|
|
|
// // $("#header-nav").animate({opacity:"0"},1000);
|
|
|
|
|
// $(".posi-search").show() // animate({opacity:"1"},1000);
|
|
|
|
|
// $("#header-nav").css("z-index","2");
|
|
|
|
|
// $(".posi-search").css("z-index","3");
|
|
|
|
|
// $(".HeaderSearch").show();
|
|
|
|
|
// $(".HeaderSearch").val("");
|
|
|
|
|
// $(".search-input").focus();
|
|
|
|
|
// $(".search-all .search-content").hide();
|
|
|
|
|
// e.stopPropagation();//阻止冒泡
|
|
|
|
|
// });
|
|
|
|
|
// $(".HeaderSearch").on("click",function(e){
|
|
|
|
|
// debugger
|
|
|
|
|
// e.stopPropagation();//阻止冒泡
|
|
|
|
|
// });
|
|
|
|
|
//搜索框输入内容
|
|
|
|
|
// $("#HeaderSearchs").blur(function(e){
|
|
|
|
|
// closeSearch();
|
|
|
|
|
// e.stopPropagation();//阻止冒泡
|
|
|
|
|
// });
|
|
|
|
|
//点击页面其它(与搜索框无关的地方)都会将搜索框隐藏,所以与搜索框有关的地方需要阻止冒泡
|
|
|
|
|
// $("body").on("click",function(){
|
|
|
|
|
// closeSearch();
|
|
|
|
|
// });
|
|
|
|
|
// $(".HeaderSearch").on("input",function(e){
|
|
|
|
|
// $(".search-all .search-content").show();
|
|
|
|
|
// e.stopPropagation();//阻止冒泡
|
|
|
|
|
// });
|
|
|
|
|
//搜索
|
|
|
|
|
// $("#header_keyword_search").on("click", header_search);
|
|
|
|
|
// $("input[name='search_keyword']").on("keydown", function(event){
|
|
|
|
|
// var code;
|
|
|
|
|
// if (!event) {
|
|
|
|
|
// event = window.event; //针对ie浏览器
|
|
|
|
|
// code = event.keyCode;
|
|
|
|
|
// }
|
|
|
|
|
// else {
|
|
|
|
|
// code = event.keyCode;
|
|
|
|
|
// }
|
|
|
|
|
// if(code == 13) {
|
|
|
|
|
// header_search();
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// $(".search-clear").click(function(e){e.stopPropagation();});
|
|
|
|
|
// //切换搜索条件
|
|
|
|
|
// $("#searchkey li").click(function(e){
|
|
|
|
|
// var key=$($(this).children("a")[0]).html();
|
|
|
|
|
// switch (key){
|
|
|
|
|
// case '实训':
|
|
|
|
|
// $("#search_type").val('1');
|
|
|
|
|
// break;
|
|
|
|
|
// case '课堂':
|
|
|
|
|
// $("#search_type").val('2');
|
|
|
|
|
// break;
|
|
|
|
|
// case '用户':
|
|
|
|
|
// $("#search_type").val('3');
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// $("#searchkey").siblings(".searchkey").html(key);
|
|
|
|
|
// $("#searchkey").hide();
|
|
|
|
|
// e.stopPropagation();//阻止冒泡
|
|
|
|
|
// });
|
|
|
|
|
// //切换选择导航条
|
|
|
|
|
// $("#header-nav li").click(function(){
|
|
|
|
|
// $("#header-nav li").removeClass("active");
|
|
|
|
|
// $(this).addClass("active");
|
|
|
|
|
// });
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// $(".search_history").on("click", function(){
|
|
|
|
|
// $("input[name='search_keyword']").val($(this).html());
|
|
|
|
|
// header_search();
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// function header_search(reactHeaderComponnet){
|
|
|
|
|
// console.log(old_url)
|
|
|
|
|
// var keyword = $("input[name='search_keyword']").val(); // 搜索关键字
|
|
|
|
|
// window.location.href ="/search"+"?value="+keyword;
|
|
|
|
|
// // if (!reactHeaderComponnet) {
|
|
|
|
|
// // reactHeaderComponnet = window._header_componentHandler
|
|
|
|
|
// // }
|
|
|
|
|
// // if (!reactHeaderComponnet) {
|
|
|
|
|
// // var index = $("#search_type").val(); // 搜索课程/项目
|
|
|
|
|
// // keyword = encodeURIComponent(keyword);
|
|
|
|
|
// // // $.get('/users/search_shixuns_or_course',
|
|
|
|
|
// // // { search: keyword,
|
|
|
|
|
// // // index: index});
|
|
|
|
|
// // window.location.href = old_url+"/users/search_shixuns_or_courses" + "?search=" + keyword + "&index=" + index;
|
|
|
|
|
// //e.stopPropagation();//阻止冒泡
|
|
|
|
|
// // } else {
|
|
|
|
|
// // window.__headSearchKeyword = keyword
|
|
|
|
|
// // reactHeaderComponnet.props.history.push(`/shixuns`)
|
|
|
|
|
// // trigger('searchKeywordChange', keyword)
|
|
|
|
|
// // }
|
|
|
|
|
// }
|
|
|
|
|
// //头部导航条的隐藏
|
|
|
|
|
// function closeSearch(){
|
|
|
|
|
// $('#posi-search').hide();
|
|
|
|
|
// $("#search-open").show();
|
|
|
|
|
// // $(".posi-search").animate({opacity:"0"},800);
|
|
|
|
|
// $(".HeaderSearch").hide();
|
|
|
|
|
// $("#header-nav").animate({opacity:"1"},1000);
|
|
|
|
|
// $(".posi-search").css("z-index","2");
|
|
|
|
|
// $("#header-nav").css("z-index","3");
|
|
|
|
|
// }
|
|
|
|
|