portal html css js resource

cmpInforShow.js 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. $(function() {
  2. loginStatus(); //判断个人是否登录
  3. var userid = $.cookie("userid");
  4. var orgId = GetQueryString("orgId");
  5. var oName = "";
  6. if(orgId) {
  7. getCmpInfo(orgId); //获取个人详细信息
  8. getResource( 10,1, true); //获取个人发布的资源
  9. getArticle(10, 1, true); //获取个人发布的文章
  10. ifcollectionAbout(orgId,$(".goSpan").find(".attenSpan"),6);
  11. //点击关注按钮
  12. $("#attentBtn").on('click', function() {
  13. if(userid && userid != null && userid != "null") {
  14. if($(this).is('.attenedSpan')){
  15. cancelCollectionAbout(orgId,$(this),6)
  16. } else {
  17. collectionAbout(orgId,$(this), 6);
  18. }
  19. }else{
  20. $.MsgBox.Alert("提示", "请先登录再进行关注");
  21. $("#mb_btn_ok").val("去登录");
  22. var aele = document.createElement('a');
  23. $("#mb_btnbox").append(aele);
  24. $("#mb_btnbox a").css({
  25. 'display': "block",
  26. 'width': '100%',
  27. 'height': '40px',
  28. 'position': 'absolute',
  29. 'bottom': '-6px',
  30. 'left': '0'
  31. });
  32. aele.setAttribute('href', '../login.html');
  33. }
  34. });
  35. //点击查看全部资源
  36. $(".coninfobox").on("click", "#seeMoreR", function() {
  37. document.body.scrollTop = document.documentElement.scrollTop = 0;
  38. $(".navconBox ul>li").eq(1).addClass("liNow").siblings().removeClass("liNow");
  39. $("#item1user").hide();
  40. $("#item2user").show();
  41. })
  42. //点击查看全部文章
  43. $(".coninfobox").on("click", "#seeMoreA", function() {
  44. document.body.scrollTop = document.documentElement.scrollTop = 0;
  45. $(".navconBox ul>li").eq(2).addClass("liNow").siblings().removeClass("liNow");
  46. $("#item1user").hide();
  47. $("#item3user").show();
  48. })
  49. }
  50. function subjectShow(data) {
  51. console.log(data)
  52. if(data != undefined && data.length != 0) {
  53. var subs = new Array();
  54. if(data.indexOf(',')) {
  55. subs = data.split(',');
  56. } else {
  57. subs[0] = data;
  58. }
  59. if(subs.length > 0) {
  60. for(var i = 0; i < subs.length; i++) {
  61. $("#subjectShow").append("<li>" + subs[i] + "</li>");
  62. };
  63. }
  64. }
  65. }
  66. function qualificationShow(data) {
  67. if(data != undefined && data.length != 0) {
  68. var subs = new Array();
  69. if(data.indexOf(',')) {
  70. subs = data.split(',');
  71. } else {
  72. subs[0] = data;
  73. }
  74. if(subs.length > 0) {
  75. for(var i = 0; i < subs.length; i++) {
  76. $("#qualification").append("<li><div class='h4tit'>" + subs[i] + "</div></li>");
  77. };
  78. }
  79. }
  80. }
  81. //企业详细信息
  82. function getCmpInfo(orgId) {
  83. $.ajax({
  84. type: "get",
  85. url: "/ajax/org/" + orgId,
  86. async: false,
  87. success: function(data) {
  88. var $info = data.data;
  89. //console.log($info)
  90. if(data.success) {
  91. if($info.hasOrgLogo) {
  92. $("#proHead").attr("src", "/images/org/" + $info.id + ".jpg");
  93. }else{
  94. $("#proHead").attr("src", "/images/default-icon.jpg");
  95. }
  96. if($info.forShort) {
  97. $("#proName").text($info.forShort);
  98. } else {
  99. $("#proName").text($info.name);
  100. }
  101. oName = $info.name;
  102. if($info.authStatus == "3") {
  103. $("#proAuth").addClass("authicon-com-ok");
  104. $("#proAuth").attr("title", "科袖认证企业");
  105. }
  106. if($info.city) {
  107. $("#proAddress").html($info.city + "<span style='margin-right:10px;'></span>");
  108. }
  109. var proOther = "";
  110. if($info.industry) {
  111. proOther = $info.industry.replace(/,/gi, " | ");
  112. }
  113. $("#proOther").text(proOther);
  114. if($info.orgType == "2") {
  115. $("#proTit").html(orgTypeShow[$info.orgType] + "<span style='margin-right:10px;'></span>");
  116. }
  117. var llqtitle = $info.name + "-" + proOther + "科袖网"; //修改浏览器title信息
  118. document.title = llqtitle;
  119. //简介
  120. if($info.descp) {
  121. $("#item1user>.nodatabox").addClass("displayNone");
  122. $("#descpS").parents(".coninfobox").removeClass("displayNone");
  123. $("#descpS").text($info.descp);
  124. } else {
  125. $("#descpS").parents(".coninfobox").addClass("displayNone");
  126. }
  127. //学术领域
  128. if($info.subject) {
  129. $("#item1user>.nodatabox").addClass("displayNone");
  130. $("#subjectShow").parents(".coninfobox").removeClass("displayNone");
  131. subjectShow($info.subject);
  132. } else {
  133. $("#subjectShow").parents(".coninfobox").addClass("displayNone");
  134. }
  135. //企业资质
  136. if($info.qualification) {
  137. qualificationShow($info.qualification);
  138. } else {
  139. $("#qualification").parents(".coninfobox").hide();
  140. }
  141. //企业详情
  142. $("#orgName").text($info.name);
  143. if($info.orgSize) {
  144. //console.log(typeof($info.orgSize),orgSizeShow[$info.orgSize])
  145. $("#orgSize").text(orgSizeShow[$info.orgSize]);
  146. } else {
  147. $("#orgSize").parent("li").hide();
  148. }
  149. if($info.industry) {
  150. $("#orgIndustry").text($info.industry);
  151. } else {
  152. $("#orgIndustry").parent("li").hide();
  153. }
  154. if($info.city) {
  155. $("#orgCity").text($info.city);
  156. } else {
  157. $("#orgCity").parent("li").hide();
  158. }
  159. if($info.orgType) {
  160. $("#orgType").text(orgTypeShow[$info.orgType]);
  161. } else {
  162. $("#orgType").parent("li").hide();
  163. }
  164. if($info.foundTime) {
  165. $("#foundTime").text(TimeTr($info.foundTime));
  166. } else {
  167. $("#foundTime").parent("li").hide();
  168. }
  169. if($info.orgUrl) {
  170. $("#orgUrl").text($info.orgUrl);
  171. } else {
  172. $("#orgUrl").parent("li").hide();
  173. }
  174. if($info.addr) {
  175. $("#cmpAddress").text($info.addr);
  176. } else {
  177. $("#cmpAddress").parent("li").hide();
  178. }
  179. var weibotitle = $info.name;
  180. var weibourl = window.location.href;
  181. var weibopic = "http://" + window.location.host + "/images/org/" + $info.id + ".jpg";
  182. $("#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");
  183. }
  184. },
  185. error: function() {
  186. $.MsgBox.Alert('提示', '链接服务器超时')
  187. }
  188. });
  189. }
  190. //获取资源
  191. function getResource(pageSize, pageNo, isbind) {
  192. $.ajax({
  193. "url": "/ajax/resource/pqOrgPublish",
  194. "type": "get",
  195. "async": false,
  196. "data": {
  197. "orgId": orgId,
  198. "pageSize": pageSize,
  199. "pageNo": pageNo
  200. },
  201. "success": function(data) {
  202. //console.log(data);
  203. if(data.success) {
  204. $("#proResource").html("");
  205. if(data.data.data.length > 0) {
  206. $("#showResource").parents(".coninfobox").removeClass("displayNone");
  207. $("#item1user>.nodatabox").addClass("displayNone");
  208. for(var i = 0; i < data.data.data.length; i++) {
  209. var madiaHead = '';
  210. if(data.data.data[i].images.length) {
  211. madiaHead = '/data/resource/' + data.data.data[i].images[0].imageSrc;
  212. } else {
  213. madiaHead = '/images/default-resource.jpg';
  214. }
  215. var strAdd = '';
  216. strAdd += '<li><a href="resourceShow.html?resourceId=' + data.data.data[i].resourceId + '" class="flexCenter urlgo">';
  217. strAdd += '<div class="madiaHead resouseHead" style="background-image:url(' + madiaHead + ')"></div>';
  218. 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>';
  219. strAdd += '</a></li>';
  220. if(isbind==true && i==0){
  221. $("#showResource").html("");
  222. $("#showResource").append(strAdd);
  223. }
  224. $("#proResource").append(strAdd);
  225. }
  226. if(isbind == true) {
  227. $(".resoucePageCode").createPage({
  228. pageCount: Math.ceil(data.data.total / 10),
  229. current: data.data.pageNo,
  230. backFn: function(p) {
  231. $("#proResource").html("");
  232. getResource(10, p, false);
  233. //document.body.scrollTop = document.documentElement.scrollTop = 0;
  234. }
  235. });
  236. }
  237. } else {
  238. $("#item2user .nodatabox").show();
  239. $("#item2user .nodatabox").find(".noContip").text("企业尚未发布任何资源");
  240. }
  241. }
  242. },
  243. "error": function() {
  244. $.MsgBox.Alert("提示", "服务器连接超时")
  245. }
  246. });
  247. }
  248. //获取文章
  249. function getArticle(pageSize, pageNo, isbind) {
  250. $.ajax({
  251. url: "/ajax/article/pqOrgPublish",
  252. dataType: 'json', //数据格式类型
  253. type: 'GET', //http请求类型
  254. data: {
  255. "orgId": orgId,
  256. "pageSize": pageSize,
  257. "pageNo": pageNo
  258. },
  259. timeout: 10000, //超时设置
  260. success: function(data) {
  261. if(data.success) {
  262. $("#proArticel").html("");
  263. if(data.data.data.length > 0) {
  264. $("#showArticle").parents(".coninfobox").removeClass("displayNone");
  265. $("#item1user>.nodatabox").addClass("displayNone");
  266. for(var i = 0; i < data.data.data.length; i++) {
  267. var madiaHead = '/images/default-artical.jpg';
  268. if(data.data.data[i].articleImg) {
  269. madiaHead = '/data/article/' + data.data.data[i].articleImg;
  270. }
  271. var strAdd = '';
  272. strAdd += '<li><a href="articalShow.html?articleId=' + data.data.data[i].articleId + '" class="flexCenter urlgo">';
  273. strAdd += '<div class="madiaHead artHead" style="background-image:url(' + madiaHead + ')"></div>';
  274. strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">' + data.data.data[i].articleTitle + '</p>';
  275. strAdd += '<ul class="h2Font clearfix">';
  276. strAdd += '<li><span class="time">' + commenTime(data.data.data[i].publishTime) + '</span></li>';
  277. strAdd += '<li><span id="pageViews">阅读量 ' + data.data.data[i].pageViews + '</span></li>';
  278. strAdd += '<li><span id="articleAgree">点赞 ' + data.data.data[i].articleAgree + '</span></li>';
  279. strAdd += '<li><span id="comment"></span></li>';
  280. strAdd += '</ul></div>';
  281. strAdd += '</a></li>';
  282. var $strAdd = $(strAdd);
  283. $("#proArticel").append($strAdd);
  284. commentnum(data.data.data[i].articleId, $strAdd) //文章评论数
  285. if(isbind==true && i==0){
  286. $("#showArticle").html("");
  287. $("#showArticle").append(strAdd);
  288. commentnum(data.data.data[0].articleId, $strAdd)
  289. }
  290. }
  291. if(isbind == true) {
  292. $(".expertPageCode").createPage({
  293. pageCount: Math.ceil(data.data.total / 10),
  294. current: data.data.pageNo,
  295. backFn: function(p) {
  296. $("#proArticel").html("");
  297. getArticle(10, p, false);
  298. //document.body.scrollTop = document.documentElement.scrollTop = 0;
  299. }
  300. });
  301. }
  302. } else {
  303. $("#item3user .nodatabox").show();
  304. $("#item3user .nodatabox").find(".noContip").text("企业尚未发布任何文章");
  305. var i = 0;
  306. $("#item1user").find('.coninfobox').each(function() {
  307. if($(this).css("display") == "none") {
  308. i++;
  309. }
  310. })
  311. if(i == 4) {
  312. $("#item1user").hide();
  313. $(".navconBox ul>li").eq(3).addClass("liNow").siblings().removeClass("liNow");
  314. $("#item6user").show();
  315. }
  316. }
  317. }
  318. },
  319. error: function() {
  320. return;
  321. }
  322. });
  323. }
  324. //查文章评论数
  325. function commentnum(articleId, $itemlist) {
  326. $.ajax({
  327. "url": "/ajax/leaveWord/lwCount",
  328. "type": "GET",
  329. "dataType": "json",
  330. "async": false,
  331. "data": {
  332. "articleId": articleId
  333. },
  334. "success": function(data) {
  335. if(data.success) {
  336. $itemlist.find("#comment").text("评论 " + data.data);
  337. }
  338. },
  339. "error": function() {
  340. $.MsgBox.Alert('提示', '链接服务器超时')
  341. }
  342. });
  343. }
  344. //关注企业数量
  345. function commentnum() {
  346. $.ajax({
  347. "url": "/ajax/watch/countProfessor",
  348. "type": "GET",
  349. "dataType": "json",
  350. "async": true,
  351. "data": {
  352. "id": orgId,
  353. "type": 6
  354. },
  355. "success": function(data) {
  356. if(data.success) {
  357. $("#attenNum").text(data.data);
  358. }
  359. },
  360. "error": function() {
  361. $.MsgBox.Alert('提示', '链接服务器超时')
  362. }
  363. });
  364. }
  365. commentnum();
  366. function comNum() {
  367. $.ajax({
  368. "url": "/ajax/org/regInfo",
  369. "type": "get",
  370. "dataType": "json",
  371. "data": {
  372. "name": oName
  373. },
  374. "success": function(data) {
  375. if(data.success) {
  376. if(data.data) {
  377. var $data = data.data;
  378. var str = "";
  379. if($data.num) {
  380. str += "<li>工商注册号:" + $data.num + "</li>"
  381. }
  382. if($data.code) {
  383. str += "<li>组织机构代码:" + $data.code + "</li>"
  384. }
  385. if($data.creditCode) {
  386. str += "<li>统一信用代码:" + $data.creditCode + "</li>"
  387. }
  388. if($data.type) {
  389. str += "<li>企业类型:" + $data.type + "</li>"
  390. }
  391. if($data.industry) {
  392. str += "<li>行业:" + $data.industry + "</li>"
  393. }
  394. if($data.operatingPeriod) {
  395. str += "<li>营业期限:" + $data.operatingPeriod + "</li>"
  396. }
  397. if($data.dayOfApproval) {
  398. str += "<li>核准日期:" + $data.dayOfApproval + "</li>"
  399. }
  400. if($data.manager) {
  401. str += "<li>登记机关:" + $data.manager + "</li>"
  402. }
  403. if($data.addr) {
  404. str += "<li>注册地址:" + $data.addr + "</li>"
  405. }
  406. if($data.scopeOfBusiness) {
  407. str += "<li>经营范围:" + $data.scopeOfBusiness + "</li>"
  408. }
  409. $("#comMes").html(str);
  410. }else {
  411. $("#comMes").parents(".coninfobox").hide();
  412. }
  413. }else{
  414. $("#comMes").parents(".coninfobox").hide();
  415. }
  416. },
  417. "error": function() {
  418. $.MsgBox.Alert('提示', '链接服务器超时')
  419. }
  420. });
  421. }
  422. comNum();
  423. industryCommerce();
  424. function industryCommerce() {
  425. $.ajax({
  426. "url": "/ajax/org/incPageViews",
  427. "type": "POST",
  428. "dataType": "json",
  429. "async": true,
  430. "data": {
  431. "id": orgId,
  432. },
  433. "success": function(data) {
  434. if(data.success) {
  435. console.log(data);
  436. }
  437. },
  438. "error": function() {
  439. $.MsgBox.Alert('提示', '链接服务器超时')
  440. }
  441. });
  442. }
  443. //纠错反馈
  444. $(".correctSubmit").on("click",function(){
  445. var cntCon=$(this).siblings(".correctCon").val();
  446. var cntUser="";
  447. if(userid && userid != null && userid != "null") {
  448. cntUser = userid;
  449. }
  450. if(cntCon.length>500){
  451. $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
  452. return;
  453. }else{
  454. $.ajax({
  455. "url": "/ajax/feedback/error/org",
  456. "type": "POST",
  457. "dataType": "json",
  458. "async": true,
  459. "data": {
  460. "id": orgId,
  461. "cnt":cntCon,
  462. "user":cntUser
  463. },
  464. "success": function(data) {
  465. if(data.success) {
  466. backSuccessed();
  467. }
  468. },
  469. "error": function() {
  470. $.MsgBox.Alert('提示', '链接服务器超时')
  471. }
  472. });
  473. }
  474. })
  475. })