|
|
|
@ -118,22 +118,23 @@ function loadHeader(){
|
|
|
|
|
function header_search(reactHeaderComponnet){
|
|
|
|
|
console.log(old_url)
|
|
|
|
|
var keyword = $("input[name='search_keyword']").val(); // 搜索关键字
|
|
|
|
|
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;
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
// } else {
|
|
|
|
|
// window.__headSearchKeyword = keyword
|
|
|
|
|
// reactHeaderComponnet.props.history.push(`/shixuns`)
|
|
|
|
|
// trigger('searchKeywordChange', keyword)
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
//头部导航条的隐藏
|
|
|
|
|
function closeSearch(){
|
|
|
|
@ -382,12 +383,14 @@ class NewHeader extends Component {
|
|
|
|
|
header_search(this)
|
|
|
|
|
}
|
|
|
|
|
onKeywordSearchKeyDown = (e) => {
|
|
|
|
|
let code = e.keyCode;
|
|
|
|
|
|
|
|
|
|
window.location.href ="/search"+"?value="+e.target.value;
|
|
|
|
|
// let code = e.keyCode;
|
|
|
|
|
|
|
|
|
|
if(code == 13) {
|
|
|
|
|
header_search(this);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// if(code == 13) {
|
|
|
|
|
// header_search(this);
|
|
|
|
|
// return false;
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hideAddcoursestypes=()=>{
|
|
|
|
|