$(function(){ var classid=getClassID(); var aid=getInfoID(); if(aid!="0"){ artclick(classid,aid) }else{ if(classid!="0"){ classclick(classid); } } }) function getinterface_data(id,key,lti){ $.ajax({ type: "post", url: "../index.php?a=getdata_interface", data: { key: key, lti: lti }, success: function (msg) { var obj = eval('(' + msg + ')'); $("#"+id).html(obj.ListHtml); } }) } /*栏目点击率方法*/ function classclick(cid){ $.ajax({ type: "POST", dataType: "json", url: '../index.php?a=hits', data: {catid:cid}, success: function (data) { } }); } /*文章页浏览量*/ function artclick(cid,aid){ $.ajax({ type: "POST", dataType: "json", url: '../index.php?a=hit', data: { id:aid, catid:cid }, success: function (data) { $("#hitid").html("浏览量:"+data); } }); } var Request = { QueryString: function (key) { var svalue = window.location.search.match(new RegExp("[\?\&]" + key + "=([^\&]*)(\&?)", "i")); return svalue ? svalue[1] : svalue; } } //回车事件 function EnterFunction(ElementInput, ElementBtn) { $(ElementInput).keydown(function (e) { var curKey = e.which; if (curKey == 13) { $(ElementBtn).click(); } }); } $(function () { EnterFunction("#formd_search_id", "#btnSearch"); EnterFunction("#formd_search_id1", "#btnSearch1"); EnterFunction("#formd_search_id3", "#btnSearch3"); EnterFunction("#search-field", "#btnSearch"); EnterFunction("#keywords", ".go_page"); }) $(document).on("click", "#public_search", function () { productSearch(1); }) function productSearch(pageindex) { var pageindex = pageindex; var pagesize = 9; var isRelationChild = 0; var catid = 71; //catid = catid.substr(0, catid.length - 1); //var title = $("#public_keywords").val(); var text18 = $("#position>a.on").text(); var text18Condition = ""; if (text18 != "所有职位" && text18!="") { text18Condition = ',{"field":"text18","value":"' + text18 + '","symbol":"=","isRelationChild":' + isRelationChild + '}'; } var text3 = $("#education>a.on").text(); var text3Condition = ""; if (text3 != "学历" && text3 != "") { text3Condition = ',{"field":"text3","value":"' + text3 + '","symbol":"=","isRelationChild":' + isRelationChild + '}'; } var pagecmd = "productSearch"; var condition = '[{"condition":[{"field":"catid","value":"' + catid + '","symbol":"in","isRelationChild":' + isRelationChild + '}' + text18Condition + text3Condition + '],"condition_type":1,"pagesize":' + pagesize + ',"pageindex":' + pageindex + '}]'; //console.log(condition); var attrArgs = "cmd|search|pagecmd|search|condition";//为了转换数组与json中的逗号冲突,此处用|search|分隔 var valArgs = "getConditionResult" + "|search|" + pagecmd + "|search|" + condition; var data = "attrArgs=" + encryption(attrArgs) + "&valArgs=" + encryption(valArgs) + ""; ajaxPublicSearch(data, function (msg) { var obj = eval('(' + msg + ')'); var HtmlList = ''; if (obj.data != null) { for (var i = 0; i < obj.data.length; i++) { HtmlList += '
  • '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '

    ' + obj.data[i]['text18'] +'

    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '

    ' + obj.data[i]['text4'] +'

    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '

    ' + obj.data[i]['year'] + '年' + obj.data[i]['month'] + '月' + obj.data[i]['day'] +'日

    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '

    '; HtmlList += ' 展开收起 '; HtmlList += ' '; HtmlList += '

    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '

    薪资范围: ' + obj.data[i]['text5'] +'

    '; HtmlList += '

    学历: ' + obj.data[i]['text3'] +'

    '; HtmlList += '

    工作地点:' + obj.data[i]['text6'] +'

    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '

    岗位职责

    '; HtmlList += '
    '; HtmlList += ' ' + obj.data[i]['description'] +' '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '

    薪资待遇

    '; HtmlList += '
    '; HtmlList += ' ' + obj.data[i]['description2'] +' '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '

    任职资格

    '; HtmlList += '
    '; HtmlList += ' ' + obj.data[i]['description1'] +' '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += ' 投递简历 '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
    '; HtmlList += '
  • '; } } else { HtmlList += '
  • 非常抱歉,没有搜索到相关信息!
  • '; } console.log(obj.data); $("#PublicSearch_Html").html(HtmlList); $("#PublicSearch_Page").html(''); if (obj.pagecount > 1) { PageHtml = obj.data_page['PageHtml']; $("#PublicSearch_Page").html(PageHtml); } }); } function ajaxPublicSearch(data, fn) { $.ajax({ "type": "post", "url": "/index.php?g=Contents&m=Index&a=public_ajax_search", "data": data, "datatype": "html", "success": function (msg) { if (fn) { fn(msg); } }, "error": function () { /*alert("对不起,服务器繁忙请稍后重试");*/ } }); } /*-------------------------没有内容自动隐藏-------------------------*/ $(function () { $('.IFHide').map(function (index) { if ($(this).html().trim().length <= 0) { $(this).hide(); $('.DivHide:eq(' + index + ')').hide(); } }); }); /*-----------------------------搜索结果绑定-------------------------------------------------------------------------*/ $(function () { $('#btnSearch').click(function () { search(); }); function search() { if ($.trim($("#formd_search_id").val()) == '' || $.trim($("#formd_search_id").val()) == "search...") { $('#formd_search_id').focus(); alert("请输入关键词!"); return false; } else { window.location = "/other/search.html?key=" + encodeURIComponent($.trim($("#formd_search_id").val())); } } }) $(function () { $('#btnSearch1').click(function () { search1(); }); function search1() { if ($.trim($("#formd_search_id1").val()) == '' || $.trim($("#formd_search_id1").val()) == "search...") { $('#formd_search_id1').focus(); alert("请输入关键词!"); return false; } else { window.location = "/other/search.html?key=" + encodeURIComponent($.trim($("#formd_search_id1").val())); } } }) $(function () { $('#btnSearch3').click(function () { search3(); }); function search3() { if ($.trim($("#formd_search_id3").val()) == '' || $.trim($("#formd_search_id3").val()) == "search...") { $('#formd_search_id3').focus(); alert("请输入关键词!"); return false; } else { window.location = "/other/search.html?key=" + encodeURIComponent($.trim($("#formd_search_id3").val())); } } }) $(document).on("click", "#searchIds>a", function () { ToPage(1); }) //危险字符过滤 $(function () { $(document).on('keyup', 'input[type=text],textarea,input[type=password]', function () { var val = $(this).val().toLocaleLowerCase(); var otherKey = " and | exec | count | chr | mid | master | or | truncate | char | declare | join |<|>|/*|*/|;|\\u|insert|select|delete|update|create|drop|script|javascript|alert"; var goon = true; for (var i = 0; i < otherKey.split('|').length ; i++) { if (goon) { if (val.indexOf(otherKey.split('|')[i]) != -1) { alert("不能包含危险字符!"); $(this).val(''); goon = false; return; } } } }); }) function checkSQL(tempKey) { var val = tempKey; var otherKey = " and | exec | count | chr | mid | master | or | truncate | char | declare | join |<|>|*|/*|*/|;|\\u|insert|select|delete|update|create|drop|script|javascript|alert"; var goon = true; for (var i = 0; i < otherKey.split('|').length ; i++) { if (goon) { if (val.indexOf(otherKey.split('|')[i]) != -1) { goon = false; } } } return goon; } var classid = ''; var key = ''; var ToPage = function (pageIndex) { //console.log(pageIndex); if (!checkSQL(key)) { alert("请不要包含危险字符!"); window.location.href="../index.html"; return false; } if(pageIndex==1){ $("#AjaxList").html(""); } var html_start=$("#html_start").val(); var html_end=$("#html_end").val(); var pageclass=$("#pageClass").val(); var pagesize=$("#pagesize").val(); var updatetime=$("#updatetime").val(); var listhtml=$("#listhtml").val(); var pagehtml = $("#pagehtml").val(); var catids = $("#searchIds>a.on").attr("data-catids"); console.log(catids); $.ajax({ type: "post", url: "../index.php?a=qwsearch", data: { pageindex: pageIndex, pagesize: pagesize, key: key, catids: catids, html_start: html_start, html_end: html_end, pageclass: pageclass, updatetime: updatetime, listhtml: listhtml, pagehtml: pagehtml }, success: function (msg) { var obj = eval('(' + msg + ')'); $('#AjaxList').html(obj.ListHtml.toString()); $('#AjaxPageList').html(obj.PageHtml.toString()); $('#searchNum').html(obj.RecordCount); $('#formd_search_id').val(key); $('#formd_search_id3').val(key); $('#searchText').html('"'+key+'"'); $('#formd_search_id1').val(key); } }) } /*-----------------------------利用cookie保存浏览记录-------------------------------*/ function SetMyCollect(id,url,photo){ $.ajax({ type: "post", url: "../index.php?a=history", data: { id: id, url: url, photo: photo }, success: function (msg) { } }) } /*-----------------------------获取浏览记录-------------------------------*/ function getMyCollect() { $.ajax({ type: "post", url: "../index.php?a=gethistory", data:"", success: function (msg) { var obj = eval('(' + msg + ')'); $('#GetMyCollect').html(obj.ListHtml); } }) } /*----------------------当前位置定位-------------------*/ $(function () { var MenuName = $.trim($("div.site>a:eq(1)").text()); $('nav.nav>ul>li>a>span').map(function () { if ($.trim($(this).text()) == MenuName) { $(this).parent().parent().addClass('on').siblings().removeClass('on'); } }); var MenuName = $.trim($("div.site>a:eq(2)").text()); $('nav.nav>ul>li>a>span').map(function () { if ($.trim($(this).text()) == MenuName) { $(this).parent().parent().addClass('on').siblings().removeClass('on'); } }); var MenuName = $.trim($("div.site>span").text()); $('nav.nav>ul>li>a>span').map(function () { if ($.trim($(this).text()) == MenuName) { $(this).parent().parent().addClass('on').siblings().removeClass('on'); } }) if ($.trim($("div.site>span").text()).length == 0) { $('nav.nav>ul>li:eq(0)').addClass('on').siblings().removeClass('on'); } }) /*----------------------点击下载及时更新下载次数-------------------*/ $(document).on('click', '.Mylike', function () { var strid = $(this).attr("data-id");//ID var strurl =$(this).attr("data-url"); var stremid = $(this).parents('.AForm').find('.Mylikelist'); var objMylike = $(this); data = "id=" + strid; $.ajax({ type: "post", url: "../index.php?a=downloadnum", data:data, success: function (msg) { var obj = eval('(' + msg + ')'); if(obj.status==1){ stremid.text(Number(stremid.text()) + Number(1)); window.location = "" + strurl; } } }) }); /*----------------------获取下载次数-------------------*/ $(function () { var ids = ''; $('.Mylikelist').map(function () { ids += $(this).attr('data-id') + ','; }); if (ids.length == 0) { return; } data="ids="+ids; $.ajax({ type: "post", url: "../index.php?a=getdownloadnum", data:data, success: function (msg) { var obj = eval('(' + msg + ')'); var hits=(obj.info); for (var i = 0; i < hits.split(',').length; i++) { $('.Mylikelist').eq(i).text(hits.split(',')[i]); } } }) }); /*----------------------动态加载公共模板--------------------*/ function getAajaxInclude(dataUrl,element) { $.ajax({ "type": "get", "url": "" + dataUrl+"", "datatype": "html", "success": function (msg) { $(element).html(msg); }, "error": function (e) { } }) } /*------------------文字转语音------------------------*/ $(".audio_btn").click(function () { var count = 0; var Timer = null; var target = $("#audiodiv audio:eq(" + count + ")").get(0); if (target.paused) { target.play(); $(".audio_btn").addClass("pause"); } else { target.pause(); $(".audio_btn").removeClass("pause"); } Timer = setInterval(function () { $("#audiodiv audio:eq(" + count + ")").get(0).onended = function () { $("#audiodiv audio:eq(" + count + ")").get(0).pause(); count = count + 1; $("#audiodiv audio:eq(" + count + ")").get(0).play(); }; $("#audiodiv audio:last").get(0).onended = function () { $(".audio_btn").removeClass("pause"); }; }, 10) })