123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566 |
- $(function() {
- loginStatus();
- var userid = $.cookie("userid");
- var orgId = GetQueryString("orgId");
- var oName = "";
-
- if(orgId) {
- getCmpInfo(orgId);
- getResource(1, 10, true);
- getArticle(1, 10, true);
- ifCollection();
- function ifCollection() {
- $.ajax({
- url: "/ajax/watch/hasWatch",
- data: {
- "professorId": userid,
- "watchObject": orgId
- },
- dataType: 'json',
- type: 'get',
- timeout: 10000,
- async: true,
- success: function(data) {
- if(data.success && data.data != null) {
- $('.attenSpan').addClass("attenSpanyes");
- $('.attenSpan').addClass("attenedSpan");
- $('.attenSpan').text('已关注');
- zjreturnId = data.data.watchObject;
- } else {
- $('.attenSpan').removeClass("attenSpanyes");
- $('.attenSpan').removeClass("attenedSpan");
- $('.attenSpan').text('关注');
- }
- },
- error: function() {
- $.MsgBox.Alert('提示', "服务器链接超时");
- }
- });
- }
-
- function collectionExpert(watchObject) {
- $.ajax({
- url: "/ajax/watch",
- data: {
- "professorId": userid,
- "watchObject": watchObject,
- "watchType": 6
- },
- dataType: 'json',
- type: 'POST',
- timeout: 10000,
- async: false,
- success: function(data) {
- if(data.success) {
- $('.attenSpan').addClass("attenSpanyes");
- $('.attenSpan').addClass("attenedSpan");
- $('.attenSpan').text('已关注');
- zjreturnId = data.data.watchObject;
- }
- },
- error: function() {
- $.MsgBox.Alert('提示', "服务器链接超时");
- }
- });
- }
-
- function cancelCollectionExpert(watchObject) {
- $.ajax({
- url: "/ajax/watch/delete",
- data: {
- professorId: userid,
- watchObject: watchObject
- },
- dataType: 'json',
- type: 'post',
- timeout: 10000,
- async: true,
- success: function(data) {
- console.log(data.success)
- if(data.success) {
- $('.attenSpan').removeClass("attenSpanyes");
- $('.attenSpan').removeClass("attenedSpan");
- $('.attenSpan').text('关注');
- }
- },
- error: function(data) {
- $.MsgBox.Alert('提示', "服务器链接超时");
- }
- });
- }
-
- $("#attentBtn").on('click', function() {
- if(userid && userid != null && userid != "null") {
- if($(this).is('.attenSpanyes')){
- cancelCollectionExpert(orgId)
- } else {
- collectionExpert(orgId);
- }
- }else{
- $.MsgBox.Alert("提示", "请先登录再进行关注");
- $("#mb_btn_ok").val("去登录");
- var aele = document.createElement('a');
- $("#mb_btnbox").append(aele);
- $("#mb_btnbox a").css({
- 'display': "block",
- 'width': '100%',
- 'height': '40px',
- 'position': 'absolute',
- 'bottom': '-6px',
- 'left': '0'
- });
- aele.setAttribute('href', '../login.html');
- }
- });
-
- $(".coninfobox").on("click", "#seeMoreR", function() {
- document.body.scrollTop = document.documentElement.scrollTop = 0;
- $(".navconBox ul>li").eq(1).addClass("liNow").siblings().removeClass("liNow");
- $("#item1user").hide();
- $("#item2user").show();
- })
-
- $(".coninfobox").on("click", "#seeMoreA", function() {
- document.body.scrollTop = document.documentElement.scrollTop = 0;
- $(".navconBox ul>li").eq(2).addClass("liNow").siblings().removeClass("liNow");
- $("#item1user").hide();
- $("#item3user").show();
- })
- }
- function subjectShow(data) {
- console.log(data)
- if(data != undefined && data.length != 0) {
- var subs = new Array();
- if(data.indexOf(',')) {
- subs = data.split(',');
- } else {
- subs[0] = data;
- }
- if(subs.length > 0) {
- for(var i = 0; i < subs.length; i++) {
- $("#subjectShow").append("<li>" + subs[i] + "</li>");
- };
- }
- }
- }
- function qualificationShow(data) {
- if(data != undefined && data.length != 0) {
- var subs = new Array();
- if(data.indexOf(',')) {
- subs = data.split(',');
- } else {
- subs[0] = data;
- }
- if(subs.length > 0) {
- for(var i = 0; i < subs.length; i++) {
- $("#qualification").append("<li><div class='h4tit'>" + subs[i] + "</div></li>");
- };
- }
- }
- }
-
- function getCmpInfo(orgId) {
- $.ajax({
- type: "get",
- url: "/ajax/org/" + orgId,
- async: false,
- success: function(data) {
- var $info = data.data;
-
- if(data.success) {
- 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);
- }
- oName = $info.name;
- if($info.authStatus == "3") {
- $("#proAuth").addClass("authicon-com-ok");
- $("#proAuth").attr("title", "科袖认证企业");
- }
- if($info.city) {
- $("#proAddress").html($info.city + "<span style='margin-right:10px;'></span>");
- }
- var proOther = "";
- if($info.industry) {
- proOther = $info.industry.replace(/,/gi, " | ");
- }
- $("#proOther").text(proOther);
- if($info.orgType == "2") {
- $("#proTit").html(orgTypeShow[$info.orgType] + "<span style='margin-right:10px;'></span>");
- }
- var llqtitle = $info.name + "-" + proOther + "-科袖网";
- document.title = llqtitle;
-
- if($info.descp) {
- $("#descpS").text($info.descp);
- } else {
- $("#descpS").parents(".coninfobox").hide();
- }
-
- console.log($info.subject)
- if($info.subject) {
- subjectShow($info.subject);
- } else {
- $("#subjectShow").parents(".coninfobox").hide();
- }
-
- if($info.qualification) {
- qualificationShow($info.qualification);
- } 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");
- }
- },
- error: function() {
- $.MsgBox.Alert('提示', '链接服务器超时')
- }
- });
- }
-
- function getResource(pageSize, pageNo, isbind) {
- $.ajax({
- "url": "/ajax/resource/pqOrgPublish",
- "type": "get",
- "async": false,
- "data": {
- "orgId": orgId,
- "pageSize": pageSize,
- "pageNo": pageNo
- },
- "success": function(data) {
-
- if(data.success) {
- $("#proResource").html("");
- if(data.data.data.length > 0) {
- for(var i = 0; i < data.data.data.length; i++) {
- var madiaHead = '';
- if(data.data.data[i].images.length) {
- madiaHead = '/data/resource/' + data.data.data[i].images[0].imageSrc;
- } else {
- madiaHead = '/images/default-resource.jpg';
- }
- var strAdd = '';
- strAdd += '<li><a href="resourceShow.html?resourceId=' + data.data.data[i].resourceId + '" class="flexCenter urlgo">';
- strAdd += '<div class="madiaHead resouseHead" style="background-image:url(' + madiaHead + ')"></div>';
- strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">' + data.data.data[i].resourceName + '</p><p class="h2Font ellipsisSty">应用用途:' + data.data.data[i].supportedServices + '</p></div>';
- strAdd += '</a></li>';
- if(i == 0) {
- $("#showResource").append(strAdd);
- }
- $("#proResource").append(strAdd);
- }
- if(isbind == true) {
- $(".resoucePageCode").createPage({
- pageCount: Math.ceil(data.data.total / 10),
- current: data.data.pageNo,
- backFn: function(p) {
- $("#proResource").html("");
- getResource(10, p, false);
-
- }
- });
- }
- } else {
- $("#item2user .nodatabox").show();
- $("#item2user .nodatabox").find(".noContip").text("主人尚未发布任何资源");
- $("#showResource").parents(".coninfobox").hide();
- }
- }
- },
- "error": function() {
- $.MsgBox.Alert("提示", "服务器连接超时")
- }
- });
- }
-
- function getArticle(pageSize, pageNo, isbind) {
- $.ajax({
- url: "/ajax/article/pqOrgPublish",
- dataType: 'json',
- type: 'GET',
- data: {
- "orgId": orgId,
- "pageSize": pageSize,
- "pageNo": pageNo
- },
- timeout: 10000,
- success: function(data) {
- if(data.success) {
- $("#proArticel").html("");
- if(data.data.data.length > 0) {
- $(".navconBox").find("li:contains('文章')").show();
- $(".navconBox").find("li:contains('主页')").show();
- for(var i = 0; i < data.data.data.length; i++) {
- var madiaHead = '/images/default-artical.jpg';
- if(data.data.data[i].articleImg) {
- madiaHead = '/data/article/' + data.data.data[i].articleImg;
- }
- var strAdd = '';
- strAdd += '<li><a href="articalShow.html?articleId=' + data.data.data[i].articleId + '" class="flexCenter urlgo">';
- strAdd += '<div class="madiaHead artHead" style="background-image:url(' + madiaHead + ')"></div>';
- strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">' + data.data.data[i].articleTitle + '</p>';
- strAdd += '<ul class="h2Font clearfix">';
- strAdd += '<li><span class="time">' + commenTime(data.data.data[i].publishTime) + '</span></li>';
- strAdd += '<li><span id="pageViews">阅读量 ' + data.data.data[i].pageViews + '</span></li>';
- strAdd += '<li><span id="articleAgree">点赞 ' + data.data.data[i].articleAgree + '</span></li>';
- strAdd += '<li><span id="comment"></span></li>';
- strAdd += '</ul></div>';
- strAdd += '</a></li>';
- var $strAdd = $(strAdd);
- $("#proArticel").append($strAdd);
- commentnum(data.data.data[i].articleId, $strAdd)
- if(i == 0) {
- $("#showArticle").append(strAdd);
- commentnum(data.data.data[0].articleId, $strAdd)
- }
- }
- if(isbind == true) {
- $(".expertPageCode").createPage({
- pageCount: Math.ceil(data.data.total / 10),
- current: data.data.pageNo,
- backFn: function(p) {
- $("#proArticel").html("");
- getArticle(10, p, false);
-
- }
- });
- }
- } else {
- $("#item3user .nodatabox").show();
- $("#item3user .nodatabox").find(".noContip").text("主人尚未发布任何文章");
- $("#showArticle").parents(".coninfobox").hide();
- var i = 0;
- $("#item1user").find('.coninfobox').each(function() {
- if($(this).css("display") == "none") {
- i++;
- }
- })
- if(i == 4) {
- $(".navconBox ul>li").eq(3).addClass("liNow").siblings().removeClass("liNow");
- $("#item6user").show()
- }
- }
- }
- },
- error: function() {
- return;
- }
- });
- }
-
- function commentnum(articleId, $itemlist) {
- $.ajax({
- "url": "/ajax/leaveWord/lwCount",
- "type": "GET",
- "dataType": "json",
- "async": false,
- "data": {
- "articleId": articleId
- },
- "success": function(data) {
- if(data.success) {
- $itemlist.find("#comment").text("评论 " + data.data);
- }
- },
- "error": function() {
- $.MsgBox.Alert('提示', '链接服务器超时')
- }
- });
- }
-
- function commentnum() {
- $.ajax({
- "url": "/ajax/watch/countProfessor",
- "type": "GET",
- "dataType": "json",
- "async": true,
- "data": {
- "id": orgId,
- "type": 6
- },
- "success": function(data) {
- if(data.success) {
- $("#attenNum").text(data.data);
- }
- },
- "error": function() {
- $.MsgBox.Alert('提示', '链接服务器超时')
- }
- });
- }
- commentnum();
- function comNum() {
- $.ajax({
- "url": "/ajax/org/regInfo",
- "type": "get",
- "dataType": "json",
- "data": {
- "name": oName
- },
- "success": function(data) {
- if(data.success) {
- if(data.data) {
- var $data = data.data;
- var str = "";
- if($data.num) {
- str += "<li>工商注册号:" + $data.num + "</li>"
- }
- if($data.code) {
- str += "<li>组织机构代码:" + $data.code + "</li>"
- }
- if($data.creditCode) {
- str += "<li>统一信用代码:" + $data.creditCode + "</li>"
- }
- if($data.type) {
- str += "<li>企业类型:" + $data.type + "</li>"
- }
- if($data.industry) {
- str += "<li>行业:" + $data.industry + "</li>"
- }
- if($data.operatingPeriod) {
- str += "<li>营业期限:" + $data.operatingPeriod + "</li>"
- }
- if($data.dayOfApproval) {
- str += "<li>核准日期:" + $data.dayOfApproval + "</li>"
- }
- if($data.manager) {
- str += "<li>登记机关:" + $data.manager + "</li>"
- }
- if($data.addr) {
- str += "<li>注册地址:" + $data.addr + "</li>"
- }
- if($data.scopeOfBusiness) {
- str += "<li>经营范围:" + $data.scopeOfBusiness + "</li>"
- }
- $("#comMes").html(str);
- }else {
- $("#comMes").parents(".coninfobox").hide();
- }
- }else{
- $("#comMes").parents(".coninfobox").hide();
- }
- },
- "error": function() {
- $.MsgBox.Alert('提示', '链接服务器超时')
- }
- });
- }
- comNum();
- function industryCommerce() {
- $.ajax({
- "url": "/ajax/org/incPageViews POST",
- "type": "POST",
- "dataType": "json",
- "async": true,
- "data": {
- "id": orgId,
- },
- "success": function(data) {
- if(data.success) {
- console.log(data);
- }
- },
- "error": function() {
- $.MsgBox.Alert('提示', '链接服务器超时')
- }
- });
- }
-
- $(".correctSubmit").on("click",function(){
- var cntCon=$(this).siblings(".correctCon").val();
- var cntUser="";
- if(userid && userid != null && userid != "null") {
- cntUser = userid;
- }
- if(cntCon.length>500){
- $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
- return;
- }else{
- $.ajax({
- "url": "/ajax/feedback/error/org",
- "type": "POST",
- "dataType": "json",
- "async": true,
- "data": {
- "id": orgId,
- "cnt":cntCon,
- "user":cntUser
- },
- "success": function(data) {
- if(data.success) {
- backSuccessed();
- }
- },
- "error": function() {
- $.MsgBox.Alert('提示', '链接服务器超时')
- }
- });
- }
- })
-
-
- })
|