portal html css js resource

cmpInforShow.js 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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( 10,1, true); //获取个人发布的资源
  10. getArticle(10, 1, 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").attr("src", "/images/org/" + $info.id + ".jpg");
  173. }else{
  174. $("#proHead").attr("src", "/images/default-icon.jpg");
  175. }
  176. if($info.forShort) {
  177. $("#proName").text($info.forShort);
  178. } else {
  179. $("#proName").text($info.name);
  180. }
  181. oName = $info.name;
  182. if($info.authStatus == "3") {
  183. $("#proAuth").addClass("authicon-com-ok");
  184. $("#proAuth").attr("title", "科袖认证企业");
  185. }
  186. if($info.city) {
  187. $("#proAddress").html($info.city + "<span style='margin-right:10px;'></span>");
  188. }
  189. var proOther = "";
  190. if($info.industry) {
  191. proOther = $info.industry.replace(/,/gi, " | ");
  192. }
  193. $("#proOther").text(proOther);
  194. if($info.orgType == "2") {
  195. $("#proTit").html(orgTypeShow[$info.orgType] + "<span style='margin-right:10px;'></span>");
  196. }
  197. var llqtitle = $info.name + "-" + proOther + "-科袖网"; //修改浏览器title信息
  198. document.title = llqtitle;
  199. //简介
  200. if($info.descp) {
  201. $("#descpS").parents(".coninfobox").removeClass("displayNone");
  202. $("#descpS").text($info.descp);
  203. } else {
  204. $("#descpS").parents(".coninfobox").addClass("displayNone");
  205. }
  206. //学术领域
  207. if($info.subject) {
  208. $("#subjectShow").parents(".coninfobox").removeClass("displayNone");
  209. subjectShow($info.subject);
  210. } else {
  211. $("#subjectShow").parents(".coninfobox").addClass("displayNone");
  212. }
  213. //企业资质
  214. if($info.qualification) {
  215. qualificationShow($info.qualification);
  216. } else {
  217. $("#qualification").parents(".coninfobox").hide();
  218. }
  219. //企业详情
  220. $("#orgName").text($info.name);
  221. if($info.orgSize) {
  222. //console.log(typeof($info.orgSize),orgSizeShow[$info.orgSize])
  223. $("#orgSize").text(orgSizeShow[$info.orgSize]);
  224. } else {
  225. $("#orgSize").parent("li").hide();
  226. }
  227. if($info.industry) {
  228. $("#orgIndustry").text($info.industry);
  229. } else {
  230. $("#orgIndustry").parent("li").hide();
  231. }
  232. if($info.city) {
  233. $("#orgCity").text($info.city);
  234. } else {
  235. $("#orgCity").parent("li").hide();
  236. }
  237. if($info.orgType) {
  238. $("#orgType").text(orgTypeShow[$info.orgType]);
  239. } else {
  240. $("#orgType").parent("li").hide();
  241. }
  242. if($info.foundTime) {
  243. $("#foundTime").text(TimeTr($info.foundTime));
  244. } else {
  245. $("#foundTime").parent("li").hide();
  246. }
  247. if($info.orgUrl) {
  248. $("#orgUrl").text($info.orgUrl);
  249. } else {
  250. $("#orgUrl").parent("li").hide();
  251. }
  252. if($info.addr) {
  253. $("#cmpAddress").text($info.addr);
  254. } else {
  255. $("#cmpAddress").parent("li").hide();
  256. }
  257. var weibotitle = $info.name;
  258. var weibourl = window.location.href;
  259. var weibopic = "http://" + window.location.host + "/images/org/" + $info.id + ".jpg";
  260. $("#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");
  261. }
  262. },
  263. error: function() {
  264. $.MsgBox.Alert('提示', '链接服务器超时')
  265. }
  266. });
  267. }
  268. //获取资源
  269. function getResource(pageSize, pageNo, isbind) {
  270. $.ajax({
  271. "url": "/ajax/resource/pqOrgPublish",
  272. "type": "get",
  273. "async": false,
  274. "data": {
  275. "orgId": orgId,
  276. "pageSize": pageSize,
  277. "pageNo": pageNo
  278. },
  279. "success": function(data) {
  280. //console.log(data);
  281. if(data.success) {
  282. $("#proResource").html("");
  283. if(data.data.data.length > 0) {
  284. $("#showResource").parents(".coninfobox").removeClass("displayNone");
  285. $("#item1user>.nodatabox").addClass("displayNone");
  286. for(var i = 0; i < data.data.data.length; i++) {
  287. var madiaHead = '';
  288. if(data.data.data[i].images.length) {
  289. madiaHead = '/data/resource/' + data.data.data[i].images[0].imageSrc;
  290. } else {
  291. madiaHead = '/images/default-resource.jpg';
  292. }
  293. var strAdd = '';
  294. strAdd += '<li><a href="resourceShow.html?resourceId=' + data.data.data[i].resourceId + '" class="flexCenter urlgo">';
  295. strAdd += '<div class="madiaHead resouseHead" style="background-image:url(' + madiaHead + ')"></div>';
  296. 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>';
  297. strAdd += '</a></li>';
  298. if(i == 0) {
  299. $("#showResource").append(strAdd);
  300. }
  301. $("#proResource").append(strAdd);
  302. }
  303. if(isbind == true) {
  304. $(".resoucePageCode").createPage({
  305. pageCount: Math.ceil(data.data.total / 10),
  306. current: data.data.pageNo,
  307. backFn: function(p) {
  308. $("#proResource").html("");
  309. getResource(10, p, false);
  310. //document.body.scrollTop = document.documentElement.scrollTop = 0;
  311. }
  312. });
  313. }
  314. } else {
  315. $("#item2user .nodatabox").show();
  316. $("#item2user .nodatabox").find(".noContip").text("企业尚未发布任何资源");
  317. }
  318. }
  319. },
  320. "error": function() {
  321. $.MsgBox.Alert("提示", "服务器连接超时")
  322. }
  323. });
  324. }
  325. //获取文章
  326. function getArticle(pageSize, pageNo, isbind) {
  327. $.ajax({
  328. url: "/ajax/article/pqOrgPublish",
  329. dataType: 'json', //数据格式类型
  330. type: 'GET', //http请求类型
  331. data: {
  332. "orgId": orgId,
  333. "pageSize": pageSize,
  334. "pageNo": pageNo
  335. },
  336. timeout: 10000, //超时设置
  337. success: function(data) {
  338. if(data.success) {
  339. $("#proArticel").html("");
  340. if(data.data.data.length > 0) {
  341. $("#showArticle").parents(".coninfobox").removeClass("displayNone");
  342. $("#item1user>.nodatabox").addClass("displayNone");
  343. for(var i = 0; i < data.data.data.length; i++) {
  344. var madiaHead = '/images/default-artical.jpg';
  345. if(data.data.data[i].articleImg) {
  346. madiaHead = '/data/article/' + data.data.data[i].articleImg;
  347. }
  348. var strAdd = '';
  349. strAdd += '<li><a href="articalShow.html?articleId=' + data.data.data[i].articleId + '" class="flexCenter urlgo">';
  350. strAdd += '<div class="madiaHead artHead" style="background-image:url(' + madiaHead + ')"></div>';
  351. strAdd += '<div class="madiaInfo"><p class="h1Font ellipsisSty-2">' + data.data.data[i].articleTitle + '</p>';
  352. strAdd += '<ul class="h2Font clearfix">';
  353. strAdd += '<li><span class="time">' + commenTime(data.data.data[i].publishTime) + '</span></li>';
  354. strAdd += '<li><span id="pageViews">阅读量 ' + data.data.data[i].pageViews + '</span></li>';
  355. strAdd += '<li><span id="articleAgree">点赞 ' + data.data.data[i].articleAgree + '</span></li>';
  356. strAdd += '<li><span id="comment"></span></li>';
  357. strAdd += '</ul></div>';
  358. strAdd += '</a></li>';
  359. var $strAdd = $(strAdd);
  360. $("#proArticel").append($strAdd);
  361. commentnum(data.data.data[i].articleId, $strAdd) //文章评论数
  362. if(i == 0) {
  363. $("#showArticle").append(strAdd);
  364. commentnum(data.data.data[0].articleId, $strAdd)
  365. }
  366. }
  367. if(isbind == true) {
  368. $(".expertPageCode").createPage({
  369. pageCount: Math.ceil(data.data.total / 10),
  370. current: data.data.pageNo,
  371. backFn: function(p) {
  372. $("#proArticel").html("");
  373. getArticle(10, p, false);
  374. //document.body.scrollTop = document.documentElement.scrollTop = 0;
  375. }
  376. });
  377. }
  378. } else {
  379. $("#item3user .nodatabox").show();
  380. $("#item3user .nodatabox").find(".noContip").text("企业尚未发布任何文章");
  381. var i = 0;
  382. $("#item1user").find('.coninfobox').each(function() {
  383. if($(this).css("display") == "none") {
  384. i++;
  385. }
  386. })
  387. if(i == 4) {
  388. $("#item1user").hide();
  389. $(".navconBox ul>li").eq(3).addClass("liNow").siblings().removeClass("liNow");
  390. $("#item6user").show();
  391. }
  392. }
  393. }
  394. },
  395. error: function() {
  396. return;
  397. }
  398. });
  399. }
  400. //查文章评论数
  401. function commentnum(articleId, $itemlist) {
  402. $.ajax({
  403. "url": "/ajax/leaveWord/lwCount",
  404. "type": "GET",
  405. "dataType": "json",
  406. "async": false,
  407. "data": {
  408. "articleId": articleId
  409. },
  410. "success": function(data) {
  411. if(data.success) {
  412. $itemlist.find("#comment").text("评论 " + data.data);
  413. }
  414. },
  415. "error": function() {
  416. $.MsgBox.Alert('提示', '链接服务器超时')
  417. }
  418. });
  419. }
  420. //关注企业数量
  421. function commentnum() {
  422. $.ajax({
  423. "url": "/ajax/watch/countProfessor",
  424. "type": "GET",
  425. "dataType": "json",
  426. "async": true,
  427. "data": {
  428. "id": orgId,
  429. "type": 6
  430. },
  431. "success": function(data) {
  432. if(data.success) {
  433. $("#attenNum").text(data.data);
  434. }
  435. },
  436. "error": function() {
  437. $.MsgBox.Alert('提示', '链接服务器超时')
  438. }
  439. });
  440. }
  441. commentnum();
  442. function comNum() {
  443. $.ajax({
  444. "url": "/ajax/org/regInfo",
  445. "type": "get",
  446. "dataType": "json",
  447. "data": {
  448. "name": oName
  449. },
  450. "success": function(data) {
  451. if(data.success) {
  452. if(data.data) {
  453. var $data = data.data;
  454. var str = "";
  455. if($data.num) {
  456. str += "<li>工商注册号:" + $data.num + "</li>"
  457. }
  458. if($data.code) {
  459. str += "<li>组织机构代码:" + $data.code + "</li>"
  460. }
  461. if($data.creditCode) {
  462. str += "<li>统一信用代码:" + $data.creditCode + "</li>"
  463. }
  464. if($data.type) {
  465. str += "<li>企业类型:" + $data.type + "</li>"
  466. }
  467. if($data.industry) {
  468. str += "<li>行业:" + $data.industry + "</li>"
  469. }
  470. if($data.operatingPeriod) {
  471. str += "<li>营业期限:" + $data.operatingPeriod + "</li>"
  472. }
  473. if($data.dayOfApproval) {
  474. str += "<li>核准日期:" + $data.dayOfApproval + "</li>"
  475. }
  476. if($data.manager) {
  477. str += "<li>登记机关:" + $data.manager + "</li>"
  478. }
  479. if($data.addr) {
  480. str += "<li>注册地址:" + $data.addr + "</li>"
  481. }
  482. if($data.scopeOfBusiness) {
  483. str += "<li>经营范围:" + $data.scopeOfBusiness + "</li>"
  484. }
  485. $("#comMes").html(str);
  486. }else {
  487. $("#comMes").parents(".coninfobox").hide();
  488. }
  489. }else{
  490. $("#comMes").parents(".coninfobox").hide();
  491. }
  492. },
  493. "error": function() {
  494. $.MsgBox.Alert('提示', '链接服务器超时')
  495. }
  496. });
  497. }
  498. comNum();
  499. function industryCommerce() {
  500. $.ajax({
  501. "url": "/ajax/org/incPageViews POST",
  502. "type": "POST",
  503. "dataType": "json",
  504. "async": true,
  505. "data": {
  506. "id": orgId,
  507. },
  508. "success": function(data) {
  509. if(data.success) {
  510. console.log(data);
  511. }
  512. },
  513. "error": function() {
  514. $.MsgBox.Alert('提示', '链接服务器超时')
  515. }
  516. });
  517. }
  518. //纠错反馈
  519. $(".correctSubmit").on("click",function(){
  520. var cntCon=$(this).siblings(".correctCon").val();
  521. var cntUser="";
  522. if(userid && userid != null && userid != "null") {
  523. cntUser = userid;
  524. }
  525. if(cntCon.length>500){
  526. $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
  527. return;
  528. }else{
  529. $.ajax({
  530. "url": "/ajax/feedback/error/org",
  531. "type": "POST",
  532. "dataType": "json",
  533. "async": true,
  534. "data": {
  535. "id": orgId,
  536. "cnt":cntCon,
  537. "user":cntUser
  538. },
  539. "success": function(data) {
  540. if(data.success) {
  541. backSuccessed();
  542. }
  543. },
  544. "error": function() {
  545. $.MsgBox.Alert('提示', '链接服务器超时')
  546. }
  547. });
  548. }
  549. })
  550. })