/*var address = "ä¸é™"; var tp = "ä¸é™"; var tp0 = "ä¸é™"; var isAll = true; var name = null; var typeName = "资讯首页"; var pages = 0; var storage = window.sessionStorage; /!** * ç”±informationIndex.jsä¸getContent(str)方法跳至æ¤å¹¶èŽ·å–æ¤å‚æ•° * contentNewsId傿•°ç”¨äºŽèŽ·å–æ–°é—»å†…容 * @type {any} *!/ var contentNewsId = storage["contentNewsId"]; var addressActive = storage["addressActive"];*/ $(function () { $(".logo button").click(function () { var content = $("#Sou").val(); var type = $("#selectType").val(); if(content.trim().length<2){ layer.tips("请至少输入两个å—符","#Sou"); }else{ if(type=="供应"){ window.location.href="/spzs/?search="+content; }else if(type=="采è´"){ window.location.href="/syjh/qiugou.htm?search="+content; }else if(type=="ä¼ä¸š"){ window.location.href="/qyml/?search="+content; }else if(type=="资讯"){ window.location.href="/hyxx/informationSearch.html?search="+content; }else if(type=="百科"){ window.location.href="/qyfw/encyclopediaSearch.html?search="+content; } } }); $(".address").click(function(){ if($(this).html() != "资讯首页"){ window.location.href="/hyxx/informationIndustryNews.html?type="+$(this).html(); } }); UrlSearch(); var newsid = parseInt(window.newsid); if(!newsid){ var weburl = window.location.href; newsid = weburl.substring(weburl.lastIndexOf('/')+1).split(".")[0]; } newsid = parseInt(newsid); if(newsid){ addSeeTime(); var info = getInfo(newsid); if(info!=null){ document.title=info.title; if(info.kwd){ $("meta[name='keywords']").attr('content',info.kwd); } if(info.des){ $("meta[name='description']").attr('content',info.des); } $("#content_title").html(info.title); $("#content_title").css({"text-align":"center","font-size":".36rem"}); if(info.picurl){ $(".title_img").attr("src",formatImgUrl(info.picurl)); }else{ $(".title_img").hide(); } if(info.content==null||info.content==""){ $("#content_content").html("æ— è¯¦ç»†å†…å®¹"); $("#content_content").css({"font-size":".16rem","line-height":"30px"}); }else{ $("#content_content").html(info.content.replace(/{{/g,'<').replace(/}}/g,'>').replace(/amp;/g,'')); $("#content_content").css({"font-size":".16rem","line-height":"30px"}); } $("#source").html(info.nfrom?'æ¥æºï¼š'+info.nfrom:'æ¥æºï¼šç½‘络'); $("#date").html(info.dateandtime?'日期:'+info.dateandtime.slice(0,10):'未知'); $("#type").html('分类:'+info.typename); $(".list,.list_00").hide(); $(".list_01").show(); $("a[class='address']").each(function(index, result){ if($(this).html() == info.typename){ $(this).attr("class", "address active"); return false; } }); }else{ window.location.href="/hyxx/"; } }else{ window.location.href="/hyxx/"; } /*//ä¿®æ”¹åˆ†ç±»æ ‡é¢˜é¢œè‰² if(addressActive != null && addressActive != undefined && addressActive != ""){ $("a[class='address']").each(function(index, result){ if($(this).html() == addressActive){ $(this).attr("class", "address active"); return; } }) } //获å–详细内容 if(contentNewsId != null && contentNewsId != undefined && contentNewsId != ""){ getContent(contentNewsId) } /!** * è®¾ç½®æœ¬åœ°ç¼“å˜ *!/ $(".address").click(function(){ typeName = $(this).html(); storage["url"] = $(this).html(); // 修改颜色 $(this).parent().siblings().children().css("color", "#333333"); $(this).css("color", "#ff774d"); //èŽ·å–æ•°æ® console.log(typeName); $(".list").attr("style","display: block"); $(".page").attr("style","display: block"); $(".list_00").attr("style","display: none"); $(".list_01").attr("style","display: none"); getInfo(typeName,0); getTotal(typeName); })*/ }); /*/!** * 查询列表 * @param page *!/ function getInfo(typeName,page) { var data = { "typename":typeName, "page": page }; $.ajax({ url:url+"/news/hyxx/hyxxchaxunfenye", data: data, type: "get", dateType: "json", async: true, success: function success(response, status, xhr) { console.log(response); var result_0 = ""; var result_1 = ""; var result_2 = ""; $.each(response, function (i, list) { var content = list.content; if (content != null && content.length > 50) { content = content.slice(0, 50) + "..."; } if(i < 10){ result_0 += "<div onclick='getContent("+list.newsid+")'>"; result_0 += "<div class='width25 display_inline_block text_align_right oneLine'>ã€"+list.typename+"】 :</div><div class='width75 display_inline_block oneLine'><a href='javascript:void(0);'>"+ifPictureNull(list.picurl)+list.title+"</a></div>"; result_0 += "</div>"; } else if (i >= 10 && i < 22){ result_1 += "<div onclick='getContent("+list.newsid+")'>"; result_1 += "<div class='width25 display_inline_block text_align_right oneLine'>ã€"+list.typename+"】 :</div><div class='width75 display_inline_block oneLine'><a href='javascript:void(0);'>"+ifPictureNull(list.picurl)+list.title+"</a></div>"; result_1 += "</div>"; } else { result_2 += "<div onclick='getContent("+list.newsid+")'>"; result_2 += "<div class='width25 display_inline_block text_align_right oneLine'>ã€"+list.typename+"】 :</div><div class='width75 display_inline_block oneLine'><a href='javascript:void(0);'>"+ifPictureNull(list.picurl)+list.title+"</a></div>"; result_2 += "</div>"; } }); if (response.length == 0) { layer.msg('æ— ç¬¦åˆæ¡ä»¶çš„结果ï¼', { icon: 2 }); // $(".list_00").html("<div><table><tr><td>æ— ç¬¦åˆæ¡ä»¶çš„结果</td></tr></table></div>"); $(".list").attr("style","display: none"); $(".page").attr("style","display: none"); $(".list_00").attr("style","display: block"); } else { $("#response_0").empty(); $("#response_1").empty(); $("#response_2").empty(); $("#response_0").html(result_0); $("#response_1").html(result_1); $("#response_2").html(result_2); $(".list").attr("style","display: block"); $(".page").attr("style","display: block"); $(".list_00").attr("style","display: none"); } }, error: function error() { layer.msg('未知错误,请è”系客æœï¼', { icon: 5 }); } }); } /!** * 获å–详细内容 *!/ function getContent(str){ if(str != ''){ $.ajax({ url:url+"/news/hyxx/getById", data: { newsid: str }, type: "get", dateType: "json", async: false, success: function success(response, status, xhr) { console.log(response); if(response.length > 0){ $(".list").attr("style","display: none"); $(".page").attr("style","display: none"); $(".list_01").attr("style","display: block"); var title = "<h1>"+response[0].title+"</h1>"; $("#content_title").html(title); $(".title_img").attr("src",response[0].picurl); $("#content_content").html(response[0].content); storage.removeItem('addressActive') } else { layer.msg("æ•°æ®ä¸ºç©º") } }, error: function error() { layer.msg('未知错误,请è”系客æœï¼', { icon: 5 }); } }); } else { layer.msg("æ— è¯¦ç»†å†…å®¹") } } /!** * 判æ–图片是å¦ä¸ºç©º *!/ function ifPictureNull(str){ if(str == ""){ return ""; } else { return "[图]" } }*/ function UrlSearch(){ var str=window.location.href; //å–å¾—æ•´ä¸ªåœ°å€æ var num=str.indexOf("?"); str=str.substr(num+1); //å–å¾—æ‰€æœ‰å‚æ•° stringvar.substr(start [, length ] var arr=str.split("&"); //å„ä¸ªå‚æ•°æ”¾åˆ°æ•°ç»„里 for(var i=0;i < arr.length;i++){ num=arr[i].indexOf("="); if(num>0){ name=arr[i].substring(0,num); value=decodeURI(arr[i].substr(num+1)); this[name]=value; } } } function ZYTT() { var result = null; $.ajax({ url:url+"/zytt/tt/listForPage", data:{}, type: "post", dateType: "json", async: false, success: function (response, status, xhr) { if(response.length==1){ result = response[0]; } }, error: function (e) { layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); console.log("ZYTT"); console.log(e.status); console.log(e.responseText); } }); return result; } function getInfo(id) { var result = null; $.ajax({ url:url+"/news/hyxx/getById", data:{"newsid":id}, type: "post", dateType: "json", async: false, success: function (response, status, xhr) { console.log(response); if(response.length==1){ result = response[0]; } }, error: function (e) { layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); console.log("getInfo"); console.log(e.status); console.log(e.responseText); } }); return result; } function addSeeTime() { $.ajax({ url:url+"/news/zxbk/addZxSee", data: {"id":window.newsid}, type: "get", dateType: "json", async: true }); }