portal html css js resource

cmpInforShow.js 15KB

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