portal html css js resource

cmpInforShow.js 16KB

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