$(function() { var orgId = $.cookie("orgId"); var rows = 20, dataO = { artPublishTime:"", artShareId:"", resPublishTime:"", resShareId:"", serModifyTime: "", prdModifyTime: "" }, watchO={ beiTime:"", beiProId:"", }; var oAjax = function(url, dataS, otype, oFun,beforeFun,completeFun) { $.ajax({ url:url, dataType: 'json', type: otype, data: dataS, traditional: true, beforeSend: beforeFun, success: function(res) { if(res.success) { oFun(res) } }, complete:completeFun }); }, insertNodata = function (targetE,newStr) { var parent = document.getElementById(targetE).parentNode; var kong = document.createElement("div"); kong.className = "con-kong"; kong.innerHTML ='
'+ '
暂时没有符合该搜索条件的内容
' if(newStr){ kong.querySelector(".txtbox").innerHTML = newStr; } if (parent.firstChild.className == "con-kong") { return } else { parent.insertBefore(kong,parent.firstChild); } }, removeNodata = function (targetE) { var parent = document.getElementById(targetE).parentNode; if (parent.firstChild.className == "con-kong") { parent.removeChild(parent.firstChild); } else { return } }, getCmpInfo=function() { oAjax("/ajax/org/" + orgId,{}, "get", function(data){ console.log(data) var $info = data.data; if($info.resMgr){ resourceListVal(true); serviceListVal(true); $(".establishments").show() $(".goworkspaceSpan").text('发布服务、资源'); } if(!$info.colMgr && !$info.resMgr){ productListVal(true); $(".productions").show() $(".goworkspaceSpan").text('发布需求和产品'); } // if($info.colMgr){ // $(".goworkspaceSpan").text('发布文章'); // } $.cookie("colMgr",$info.colMgr); $.cookie("resMgr",$info.resMgr); //主页浏览量 $("#viewNums").text($info.pageViews); if($info.hasOrgLogo) { $("#proHead").attr("src", "/images/org/" + $info.id + ".jpg"); }else{ $("#proHead").attr("src", "/images/default-icon.jpg"); } if($info.forShort) { $("#proName").text($info.forShort); } else { $("#proName").text($info.name); } demandListVal(true,$info.name); commerceInfo($info.name);//工商信息 if($info.authStatus == "3") { $("#proAuth").addClass("authicon-com-ok"); $("#proAuth").attr("title", "科袖认证企业"); } if($info.city) { $("#proAddress").html($info.city + ""); } var proOther = ""; if($info.industry) { proOther = $info.industry.replace(/,/gi, " | "); } $("#proOther").text(proOther); if($info.orgType == "2") { $("#proTit").html(orgTypeShow[$info.orgType] + ""); } var llqtitle = $info.name + "-" + proOther + "科袖网"; //修改浏览器title信息 document.title = llqtitle; //简介 if($info.descp) { $("#item1user>.nodatabox").addClass("displayNone"); $("#descpS").parents(".coninfobox").removeClass("displayNone"); $("#descpS").text($info.descp); } else { $("#descpS").parents(".coninfobox").addClass("displayNone"); } //学术领域 if($info.subject) { $("#item1user>.nodatabox").addClass("displayNone"); $("#subjectShow").parents(".coninfobox").removeClass("displayNone"); var subs=strToAry($info.subject) if(subs.length > 0) { for(var i = 0; i < subs.length; i++) { $("#subjectShow").append("
  • " + subs[i] + "
  • "); }; } } else { $("#subjectShow").parents(".coninfobox").addClass("displayNone"); } //企业资质 if($info.qualification) { var subs=strToAry($info.qualification) if(subs.length > 0) { for(var i = 0; i < subs.length; i++) { $("#qualification").append("
  • " + subs[i] + "
  • "); }; } } else { $("#qualification").parents(".coninfobox").hide(); } //企业详情 $("#orgName").text($info.name); if($info.orgSize) { $("#orgSize").text(orgSizeShow[$info.orgSize]); } else { $("#orgSize").parent("li").hide(); } if($info.industry) { $("#orgIndustry").text($info.industry); } else { $("#orgIndustry").parent("li").hide(); } if($info.city) { $("#orgCity").text($info.city); } else { $("#orgCity").parent("li").hide(); } if($info.orgType) { $("#orgType").text(orgTypeShow[$info.orgType]); } else { $("#orgType").parent("li").hide(); } if($info.foundTime) { $("#foundTime").text(TimeTr($info.foundTime)); } else { $("#foundTime").parent("li").hide(); } if($info.orgUrl) { $("#orgUrl").text($info.orgUrl); } else { $("#orgUrl").parent("li").hide(); } if($info.addr) { $("#cmpAddress").text($info.addr); } else { $("#cmpAddress").parent("li").hide(); } var weibotitle = $info.name; var weibourl = window.location.href; var weibopic = "http://" + window.location.host + "/images/org/" + $info.id + ".jpg"; $("#weibo").attr("href", "http://service.weibo.com/share/share.php?appkey=3677230589&title=" + encodeURIComponent(weibotitle) + "&url=" + encodeURIComponent(weibourl) + "&pic=" + encodeURIComponent(weibopic) + "&content=utf-8" + "&ralateUid=6242830109&searchPic=false&style=simple"); }); }, commerceInfo=function(oName){ oAjax("/ajax/org/regInfo",{ "name": oName }, "get", function(data){ if(data.data) { $("#comMes").parents(".coninfobox").show(); var $data = data.data; var str = ""; if($data.num) { str += "
  • 工商注册号:" + $data.num + "
  • " } if($data.code) { str += "
  • 组织机构代码:" + $data.code + "
  • " } if($data.creditCode) { str += "
  • 统一信用代码:" + $data.creditCode + "
  • " } if($data.type) { str += "
  • 企业类型:" + $data.type + "
  • " } if($data.industry) { str += "
  • 行业:" + $data.industry + "
  • " } if($data.operatingPeriod) { str += "
  • 营业期限:" + $data.operatingPeriod + "
  • " } if($data.dayOfApproval) { str += "
  • 核准日期:" + $data.dayOfApproval + "
  • " } if($data.manager) { str += "
  • 登记机关:" + $data.manager + "
  • " } if($data.addr) { str += "
  • 注册地址:" + $data.addr + "
  • " } if($data.scopeOfBusiness) { str += "
  • 经营范围:" + $data.scopeOfBusiness + "
  • " } $("#comMes").html(str); } }); }, demandListVal=function(isbind,par) { oAjax("/ajax/demand/pq/org",{ "state":[1], 'oname':par, "pageSize":5 }, "get", function(data){ var $info = data.data.data; if($info.length > 0){ $("#showDemand").parents(".coninfobox").removeClass("displayNone"); $("#item1user>.nodatabox").addClass("displayNone"); for(var i = 0; i < $info.length; i++) { var liStr=$("
  • ").appendTo("#showDemand"); var $data=$info[i]; var sowU=""; if($data.pageViews!=0){ sowU='
  • 浏览量 '+$data.pageViews +'
  • ' } var strCon=''; strCon+='' strCon+='

    '+ $data.title +'

    ' strCon+='' strCon+='

    '+$data.descp+'

    ' strCon+='' strCon+='
    ' $(strCon).appendTo(liStr); } }else{ $("#showDemand").parents(".needinfobox").addClass("displayNone"); } }) }, articalListVal=function(isbind){ var aimId="proArticel",aimIdF="showArticle",newStr="企业尚未发布任何文章" oAjax("/ajax/article/publish",{ "category": "2", "owner":orgId, "publishTime":dataO.artPublishTime, "shareId": dataO.artShareId, "rows": rows }, "get", function(res){ var $info = res.data; if($info.length > 0) { $("#"+aimId).show() $("#"+aimIdF).parents(".leftconItem").find(".nodatabox").hide() $("#"+aimIdF).parents(".coninfobox").removeClass("displayNone"); dataO.artPublishTime = $info[$info.length - 1].publishTime; dataO.artShareId = $info[$info.length - 1].shareId; for(var i = 0; i < $info.length; i++) { var sowU="",hasImg="/images/default-artical.jpg" if($info[i].articleImg) { hasImg="/data/article/" + $info[i].articleImg } if($info[i].pageViews!=0){ if($info[i].articleAgree!=0){ sowU='
  • 阅读量 '+$info[i].pageViews+'
  • 赞 '+$info[i].articleAgree+'
  • ' }else{ sowU='
  • 阅读量 '+$info[i].pageViews+'
  • ' } } var itemlist = '
  • '; itemlist += ''; itemlist += '
    '; itemlist += '
    '; itemlist += '

    '+$info[i].articleTitle+'

    '; itemlist += '
      '; itemlist += '
    • ' + commenTime($info[i].publishTime) + '
    • '; itemlist += sowU itemlist += '
    • '; itemlist += '
    '; itemlist += '
  • '; var $itemlist = $(itemlist); $("#"+aimId).append($itemlist) leaveMsgCount($info[i].articleId,1,$itemlist); if(isbind && i==0){ var $itemlist = $(itemlist); $("#"+aimIdF).append($itemlist); leaveMsgCount($info[0].articleId,1,$itemlist); } } } var liLen=document.getElementById(aimId).querySelectorAll("li").length; removeNodata(aimId); if($info.length == 0 && liLen == 0 ){ $("#"+aimId).hide() insertNodata(aimId,newStr); } if(isbind){ $("#"+aimId).parent().find(".js-load-more").unbind("click").on("click",function(){ articalListVal(false) }) } if ($info.length < rows) { $("#"+aimId).parent().find(".js-load-more").unbind("click"); $("#"+aimId).parent().find(".js-load-more").hide(); } },function(){ $("#"+aimId).parent().find(".js-load-more").attr("disabled",true); $("#"+aimId).parent().find(".js-load-more").addClass("active"); },function(){ $("#"+aimId).parent().find(".js-load-more").removeAttr("disabled"); $("#"+aimId).parent().find(".js-load-more").removeClass("active"); }) }, resourceListVal=function(isbind){ var aimId="proResource",aimIdF="showResource",newStr="企业尚未发布任何资源" oAjax("/ajax/resource/publish",{ "category": "2", "owner":orgId, "publishTime":dataO.resPublishTime, "shareId": dataO.resShareId, "rows": rows }, "get", function(res){ var $info = res.data; if($info.length > 0) { $("#"+aimId).show() $("#"+aimIdF).parents(".leftconItem").find(".nodatabox").hide() $("#"+aimIdF).parents(".form-item").removeClass("displayNone"); $("#"+aimIdF).parents(".coninfobox").show(); dataO.resPublishTime = $info[$info.length - 1].publishTime; dataO.resShareId = $info[$info.length - 1].shareId; for(var i = 0; i < $info.length; i++) { var hasImg='/images/default-resource.jpg' if($info[i].images.length) { hasImg="/data/resource/" + $info[i].images[0].imageSrc } var itemlist = '
  • '; itemlist += ''; itemlist += '
    '; itemlist += '

    ' + $info[i].resourceName + '

    用途:' + $info[i].supportedServices + '

    '; itemlist += '
  • '; var $itemlist = $(itemlist); $("#"+aimId).append($itemlist) if(isbind && i==0){ var $itemlist = $(itemlist); $("#"+aimIdF).append($itemlist); } } } var liLen=document.getElementById(aimId).querySelectorAll("li").length; removeNodata(aimId); if($info.length == 0 && liLen == 0 ){ $("#"+aimId).hide() insertNodata(aimId,newStr); } if(isbind){ $("#"+aimId).parent().find(".js-load-more").unbind("click").on("click",function(){ resourceListVal(false) }) } if ($info.length < rows) { $("#"+aimId).parent().find(".js-load-more").unbind("click"); $("#"+aimId).parent().find(".js-load-more").hide(); } },function(){ $("#"+aimId).parent().find(".js-load-more").attr("disabled",true); $("#"+aimId).parent().find(".js-load-more").addClass("active"); },function(){ $("#"+aimId).parent().find(".js-load-more").removeAttr("disabled"); $("#"+aimId).parent().find(".js-load-more").removeClass("active"); }) }, serviceListVal=function(isbind){ var aimId="proService",aimIdF="showService",newStr="企业尚未发布任何服务" oAjax("/ajax/ware/publish",{ "category":"2", "owner":orgId, "modifyTime":dataO.serModifyTime, "rows": rows }, "get", function(res){ var $info = res.data; if($info.length > 0) { $("#"+aimId).show() $("#"+aimIdF).parents(".leftconItem").find(".nodatabox").hide() $("#"+aimIdF).parents(".form-item").removeClass("displayNone"); $("#"+aimIdF).parents(".coninfobox").show(); dataO.serModifyTime = $info[$info.length - 1].modifyTime; for(var i = 0; i < $info.length; i++) { var cnt="", hasImg="../images/default-service.jpg" if($info[i].images) { var subs = strToAry($info[i].images) if(subs.length > 0) { hasImg="/data/ware" + subs[0] } } var itemlist = '
  • '; itemlist += ''; itemlist += '
    '; itemlist += '

    ' + $info[i].name + '

    ' + cnt+ '

    '; itemlist += '
  • '; var $itemlist = $(itemlist); $("#"+aimId).append($itemlist) if(isbind && i==0){ var $itemlist = $(itemlist); $("#"+aimIdF).append($itemlist); } } } var liLen=document.getElementById(aimId).querySelectorAll("li").length; removeNodata(aimId); if($info.length == 0 && liLen == 0 ){ $("#"+aimId).hide() insertNodata(aimId,newStr); } if(isbind){ $("#"+aimId).parent().find(".js-load-more").unbind("click").on("click",function(){ serviceListVal(false) }) } if ($info.length < rows) { $("#"+aimId).parent().find(".js-load-more").unbind("click"); $("#"+aimId).parent().find(".js-load-more").hide(); } },function(){ $("#"+aimId).parent().find(".js-load-more").attr("disabled",true); $("#"+aimId).parent().find(".js-load-more").addClass("active"); },function(){ $("#"+aimId).parent().find(".js-load-more").removeAttr("disabled"); $("#"+aimId).parent().find(".js-load-more").removeClass("active"); }) }, productListVal=function(isbind){ var aimId="proProduct",aimIdF="showProduct",newStr="企业尚未发布任何产品" oAjax("/ajax/product/publish",{ "owner":orgId, "modifyTime":dataO.prdModifyTime, "rows": rows }, "get", function(res){ var $info = res.data; if($info.length > 0) { $("#"+aimId).show() $("#"+aimIdF).parents(".leftconItem").find(".nodatabox").hide() $("#"+aimIdF).parents(".splitBlock").removeClass("displayNone"); $("#"+aimIdF).parents(".coninfobox").show(); dataO.prdModifyTime = $info[$info.length - 1].modifyTime; for(var i = 0; i < $info.length; i++) { var cnt="", hasImg="../images/default-product.jpg" if($info[i].images) { var subs = strToAry($info[i].images) if(subs.length > 0) { hasImg="/data/product" + subs[0] } } if($info[i].cnt) { cnt = "简介:" +$info[i].cnt; } var itemlist = '
  • '; itemlist += ''; itemlist += '
    '; itemlist += '

    ' + $info[i].name + '

    ' + cnt+ '

    '; itemlist += '
  • '; var $itemlist = $(itemlist); $("#"+aimId).append($itemlist) if(isbind && i==0){ var $itemlist = $(itemlist); $("#"+aimIdF).append($itemlist); } } } var liLen=document.getElementById(aimId).querySelectorAll("li").length; removeNodata(aimId); if($info.length == 0 && liLen == 0 ){ $("#"+aimId).hide() insertNodata(aimId,newStr); } if(isbind){ $("#"+aimId).parent().find(".js-load-more").unbind("click").on("click",function(){ serviceListVal(false) }) } if ($info.length < rows) { $("#"+aimId).parent().find(".js-load-more").unbind("click"); $("#"+aimId).parent().find(".js-load-more").hide(); } },function(){ $("#"+aimId).parent().find(".js-load-more").attr("disabled",true); $("#"+aimId).parent().find(".js-load-more").addClass("active"); },function(){ $("#"+aimId).parent().find(".js-load-more").removeAttr("disabled"); $("#"+aimId).parent().find(".js-load-more").removeClass("active"); }) }, queryPubCount=function(){ oAjax("/ajax/watch/countProfessor",{//关注企业数量 "id": orgId, "type":"6" }, "GET", function(data){ $("#attenNum").text(data.data); }); oAjax("/ajax/article/count/publish",{//文章总数 "owner": orgId, "category":"2" }, "GET", function(data){ if(data.data>0 && data.data<99){ $("#artCount").text(data.data); } if(data.data>99){ $("#artCount").text("99+"); } }); oAjax("/ajax/resource/count/publish",{//资源总数 "owner": orgId, "category":"2" }, "GET", function(data){ if(data.data>0 && data.data<99){ $("#resCount").text(data.data); } if(data.data>99){ $("#resCount").text("99+"); } }); oAjax("/ajax/ware/count/publish",{//服务总数 "owner": orgId, "category":"2" }, "GET", function(data){ if(data.data>0 && data.data<99){ $("#serCount").text(data.data); } if(data.data>99){ $("#serCount").text("99+"); } }); oAjax("/ajax/product/count/publish",{//产品总数 "owner": orgId }, "GET", function(data){ if(data.data>0 && data.data<99){ $("#productCount").text(data.data); } if(data.data>99){ $("#productCount").text("99+"); } }); }, attentMyself=function(isbind){ var aimId="attendMy",newStr="企业尚未被任何人关注" oAjax("/ajax/watch/watchList",{//关注我的列表 "watchObject": orgId, "createTime": watchO.beiTime, "professorId":watchO.beiProId, "rows":rows }, "GET", function(res){ var $info = res.data; if($info.length > 0) { $("#"+aimId).show() watchO.beiTime = $info[$info.length - 1].createTime; watchO.beiProId = $info[$info.length - 1].professorId; for(var i = 0; i < $info.length; i++) { var liItem = document.createElement("li"); document.getElementById("attendMy").appendChild(liItem); detailPro($info[i].professorId,liItem); } } var liLen=document.getElementById(aimId).querySelectorAll("li").length; removeNodata(aimId); if($info.length == 0 && liLen == 0 ){ $("#"+aimId).hide() insertNodata(aimId,newStr); } if(isbind){ $("#"+aimId).parent().find(".js-load-more").unbind("click").on("click",function(){ attentMyself(false) }) } if ($info.length < rows) { $("#"+aimId).parent().find(".js-load-more").unbind("click"); $("#"+aimId).parent().find(".js-load-more").hide(); } },function(){ $("#"+aimId).parent().find(".js-load-more").attr("disabled",true); $("#"+aimId).parent().find(".js-load-more").addClass("active"); },function(){ $("#"+aimId).parent().find(".js-load-more").removeAttr("disabled"); $("#"+aimId).parent().find(".js-load-more").removeClass("active"); }) }, detailPro=function(pid,liItem) { oAjax("/ajax/professor/baseInfo/" + pid,{},"get",function(data){ var datalist=data.data; var userType = autho(datalist.authType, datalist.orgAuth, datalist.authStatus); var os = ""; if(datalist.title) { if(datalist.orgName) { os = datalist.title + "," + datalist.orgName; } else { os = datalist.title; } } else { if(datalist.office) { if(datalist.orgName) { os = datalist.office + "," + datalist.orgName; } else { os = datalist.office; } } else { if(datalist.orgName) { os = datalist.orgName; } } } var baImg = "../images/default-photo.jpg"; if(datalist.hasHeadImage == 1) { baImg = "/images/head/" + datalist.id + "_l.jpg"; } var strAdd = ''; strAdd += ''; strAdd += '
    '; strAdd += '

    ' + datalist.name + '

    '; strAdd += '

    ' + os + '

    '; strAdd += '
    '; strAdd += '
    '; liItem.innerHTML = strAdd }) }, bindClickFun=function(){ //点击查看全部产品 $(".coninfobox").on("click", "#seeMorePd", function() { document.body.scrollTop = document.documentElement.scrollTop = 0; $("#tab10user").addClass("liNow").siblings().removeClass("liNow"); $("#item1user").hide(); $("#item10user").show(); }) //点击查看全部服务 $(".coninfobox").on("click", "#seeMoreS", function() { document.body.scrollTop = document.documentElement.scrollTop = 0; $("#tab9user").addClass("liNow").siblings().removeClass("liNow"); $("#item1user").hide(); $("#item9user").show(); }) //点击查看全部资源 $(".coninfobox").on("click", "#seeMoreR", function() { document.body.scrollTop = document.documentElement.scrollTop = 0; $("#tab2user").addClass("liNow").siblings().removeClass("liNow"); $("#item1user").hide(); $("#item2user").show(); }) //点击查看全部文章 // $(".coninfobox").on("click", "#seeMoreA", function() { // document.body.scrollTop = document.documentElement.scrollTop = 0; // $("#tab3user").addClass("liNow").siblings().removeClass("liNow"); // $("#item1user").hide(); // $("#item3user").show(); // }) $("#attendmyGo").on("click",function(){ $(".mainNavUl li.rightbtn").addClass("liNow").siblings().removeClass("liNow"); $("#item8more").show(); $("#item8user").show().siblings().hide(); $(".moreBuUl li.attendMy").addClass("liNow").siblings().removeClass("liNow"); $("#item8drop1").show().siblings().hide(); }) } queryPubCount(); getCmpInfo(); //获取详细信息 // articalListVal(true); bindClickFun(); attentMyself(true); })