portal html css js resource

index.js 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. $(function(){
  2. $(".headnav li").eq(0).addClass("navcurrent");
  3. loginStatus();//判断个人是否登录
  4. var userid = $.cookie('userid');
  5. //加载页面时,判断企业账号是否登录
  6. var orgid = $.cookie('orgId');
  7. $("#cmpSettled").on("click",function(){
  8. if (orgid && orgid != "null" && orgid != null) {
  9. location.href="cmp-portal/cmp-workspaces.html"
  10. }else{
  11. location.href="cmp-portal/cmp-settled-reg.html"
  12. }
  13. })
  14. $("#gocmp").on("click",function(){
  15. if (orgid && orgid != "null" && orgid != null) {
  16. location.href="cmp-portal/cmp-workspaces.html"
  17. }else{
  18. location.href="cmp-portal/cmp-settled-log.html"
  19. }
  20. })
  21. var sureOrg ='<div class="mb-list mb-listL" style="text-align:left"><p class="msg-tit">请先确认您的所在机构:<small>(建议填写正式全称)</small></p>'+
  22. '<div style="height:56px;"><input type="text" class="form-control sureOrg" placeholder="如:北京科袖科技有限公司" /><p class="msg-warning">50字以内</p></div>'+
  23. '<div class="msg-tip"><p>注:</p><p>1. 只能发布您所在机构的需求。</p><p>2. 当您在资料中变更了所在机构后,该需求将会自动关闭。</p></div></div>';
  24. $(".setTimeBlock").on("focus",".sureOrg",function(){
  25. $(".msg-warning").show();
  26. }).on("blur",".sureOrg",function(){
  27. $(".msg-warning").hide();
  28. }).on("keyup",".sureOrg",function(){
  29. if($(this).val().length>0){
  30. $(".setTimeBlock").find(".mb_btnOkpub").removeAttr("disabled");
  31. }else{
  32. $(".setTimeBlock").find(".mb_btnOkpub").attr("disabled",true)
  33. }
  34. })
  35. /*发布需求*/
  36. $("#postNow").click(function(){
  37. if(userid=="null"||userid==undefined){
  38. location.href="login.html";
  39. }
  40. var $status=["0","1"];
  41. $.ajax({//查询是否有发布中和已过期的需求
  42. url:"/ajax/demand/qc",
  43. type:"get",
  44. data:{
  45. state:$status,
  46. uid:userid
  47. },
  48. async:true,
  49. datatype:"json",
  50. traditional: true,
  51. success:function(data){
  52. console.log(data)
  53. var statusN=data.data;
  54. if(statusN){
  55. window.open("postDemand.html");
  56. }else{
  57. $(".blackcover2").fadeIn();
  58. var btnOk='<input class="mb_btn mb_btnOk mb_btnOkpub" type="button" disabled value="确定">'
  59. $(".modelContain").show(); $("body").addClass("modelOpen");
  60. $(".mb-listL").remove();$("#promotTh").prepend(sureOrg);
  61. $(".mb_btnOk").remove(); $("#promotGt").prepend(btnOk);
  62. $.ajax({
  63. "url": "/ajax/professor/editBaseInfo/" + userid,
  64. "type": "get",
  65. "async": true,
  66. "datatype":"json",
  67. "success": function(data) {
  68. if(data.success && data.data) {
  69. if(data.data.orgName!=""){
  70. $(".setTimeBlock .sureOrg").val(data.data.orgName);
  71. $("#oldName").val(data.data.orgName);
  72. }
  73. if($(".setTimeBlock .sureOrg").val().length>0){
  74. $(".setTimeBlock").find(".mb_btnOkpub").removeAttr("disabled");
  75. }
  76. }
  77. }
  78. });
  79. $(".setTimeBlock").on("click",".mb_btnOkpub", function() {
  80. $(".blackcover2").fadeOut();
  81. $(".modelContain").hide();
  82. $("body").removeClass("modelOpen");
  83. var newName=$(".setTimeBlock .sureOrg").val();
  84. if(newName.length<50){
  85. if(newName == $("#oldName").val()){
  86. location.href="postDemand.html";
  87. }else{
  88. updateOrgName(newName);
  89. }
  90. }else{
  91. $.MsgBox.Alert("提示", "机构名称不得超过50个字");
  92. }
  93. })
  94. }
  95. }
  96. });
  97. })
  98. /*我是专家*/
  99. $("#JoinKeXiu").click(function(){
  100. if(userid=="null"||userid==undefined){
  101. location.href="login.html";
  102. }
  103. location.href="expert-authentication.html"
  104. })
  105. function updateOrgName(newName){
  106. $.ajax({
  107. "url": "/ajax/professor/org",
  108. "type": "POST",
  109. "async": true,
  110. "data":{
  111. "id":userid,
  112. "name":newName
  113. },
  114. "success": function(data) {
  115. if(data.success && data.data) {
  116. console.log(data)
  117. $.MsgBox.Confirm("提示", "机构名称修改成功",function(){
  118. location.href="postDemand.html";
  119. });
  120. $("#mb_msgicon").css("background", 'url("images/sign_icon_chenggong_nor.png") 0% 0% / contain');
  121. }
  122. }
  123. });
  124. }
  125. ruZhuCmp()
  126. resShare()
  127. hotArea()
  128. // carouselThis()
  129. var thisTabcon=$(".con-ultab>li:first-child").text();
  130. $(".con-ultab>li").eq(0).addClass("liNow");
  131. proShow(thisTabcon)
  132. $(".con-ultab").on("click","li",function(){
  133. thisTabcon=$(this).text();
  134. $(".con-ultab>li").eq($(this).index()).addClass("liNow").siblings().removeClass("liNow")
  135. proShow(thisTabcon);
  136. })
  137. $(".con-ulList").on("mouseenter","li",function(){
  138. $(this).find(".boxBlockimg").css("transform", "scale(1.1)");
  139. }).on("mouseleave","li",function(){
  140. $(this).find(".boxBlockimg").css("transform", "scale(1)");
  141. })
  142. function ruZhuCmp(){//入驻企业
  143. $.ajax({
  144. url: "/ajax/org/find/pq",
  145. type: "GET",
  146. timeout: 10000,
  147. dataType: "json",
  148. data:{
  149. "pageSize": 6,
  150. "pageNo": 1
  151. },
  152. success: function(data) {
  153. if(data.success) {
  154. var $info = data.data.data;
  155. for(var i = 0; i < $info.length; i++) {
  156. var liStr=$("<li></li>").appendTo("#ruZhuCmp");
  157. var cmpname,imgurl='../images/default-icon.jpg'
  158. if($info[i].hasOrgLogo) {
  159. imgurl='/images/org/' + $info[i].id + '.jpg';
  160. }
  161. // if($info[i].forShort){
  162. // cmpname = $info[i].forShort;
  163. // }else{
  164. cmpname = $info[i].name;
  165. // }
  166. var oSty={sty:"",tit:""};
  167. if($info[i].authStatus == 3) {
  168. oSty.sty="authicon-com-ok"
  169. oSty.tit="科袖认证企业"
  170. }
  171. var orgOther = "",orgType="";
  172. if($info[i].industry) {
  173. orgOther = $info[i].industry.replace(/,/gi, " | ");
  174. }
  175. if($info[i].orgType == "2") {
  176. orgType = orgTypeShow[$info[i].orgType] + "<span style='margin-right:16px;'></span>";
  177. }
  178. var strCon='';
  179. strCon += '<a target="_blank" href="cmpInforShow.html?orgId='+$info[i].id+'">'
  180. strCon += '<div class="madiaHead">'
  181. strCon += '<div class="boxBlock"><img class="boxBlockimg" src="'+imgurl+'"></div></div>'
  182. strCon += '<div class="madiaInfo">'
  183. strCon += '<div class="h1Font clearfix">'
  184. strCon += '<span class="qiyego ellipsisSty">'+cmpname+'</span>'
  185. strCon += '<span class="authiconNew '+oSty.sty+'" title="'+oSty.tit+'"></span>'
  186. strCon += '</div>'
  187. strCon += '<div class="h3Font ellipsisSty">'
  188. strCon += '<span>'+orgType+orgOther+'</span>'
  189. strCon += '</div>'
  190. strCon += '</div></a>'
  191. liStr.html(strCon);
  192. }
  193. }
  194. },
  195. error: function() {
  196. }
  197. })
  198. }
  199. function resShare(){//资源共享
  200. $.ajax({
  201. url: "/ajax/resource/firstpq",
  202. type: "GET",
  203. timeout: 10000,
  204. dataType: "json",
  205. data:{
  206. "pageSize":8,
  207. "pageNo": 1
  208. },
  209. success: function(data) {
  210. if(data.success) {
  211. var $info = data.data.data;
  212. for(var i = 0; i < $info.length; i++) {
  213. var liStr=$("<li></li>").appendTo("#resShare");
  214. var cmpname,imgurl='../images/default-resource.jpg'
  215. var oSty={sty:"",tit:""};
  216. if($info[i].images.length > 0) {
  217. imgurl='/data/resource/' + $info[i].images[0].imageSrc
  218. }
  219. if($info[i].resourceType == 1) { //个人资源
  220. cmpname = $info[i].editProfessor.name;
  221. oSty = autho($info[i].editProfessor.authType, $info[i].editProfessor.orgAuth, $info[i].editProfessor.authStatus);
  222. } else if($info[i].resourceType == 2) { //企业资源
  223. if($info[i].organization.forShort) {
  224. cmpname = $info[i].organization.forShort;
  225. }else{
  226. cmpname = $info[i].organization.name;
  227. }
  228. if($info[i].organization.authStatus==3){
  229. oSty.sty="authicon-com-ok"
  230. oSty.tit="科袖认证企业"
  231. }
  232. }
  233. var strCon='';
  234. strCon += '<a target="_blank" class="madiaOuter" href="resourceShow.html?resourceId='+$info[i].resourceId+'" style="background-image:url('+imgurl+');">'
  235. // strCon += '<div class="madiaHead" style="background-image:url('+imgurl+')"></div>'
  236. strCon += '<div class="madiaInfo madiaInner">'
  237. strCon += '<div class="h1Font ellipsisSty-2">'+$info[i].resourceName+'</div>'
  238. strCon += '<div class="h3Font clearfix">'
  239. strCon += '<span class="qiyego ellipsisSty">'+cmpname+'</span>'
  240. strCon += '<span class="authiconNew '+oSty.sty+'" title="'+oSty.tit+'"></span>'
  241. strCon += '</div>'
  242. strCon += '</div></a>'
  243. liStr.html(strCon);
  244. }
  245. $(".madiaOuter").each(function(i){
  246. $(this).showOn($(".madiaInner").eq(i));
  247. });
  248. }
  249. },
  250. error: function() {
  251. }
  252. })
  253. }
  254. function proShow(thiscon){//专家
  255. $.ajax({
  256. url: "/ajax/professor/pqBaseInfo",
  257. type: "GET",
  258. timeout: 10000,
  259. dataType: "json",
  260. async:false,
  261. data:{
  262. "subject":thiscon,
  263. "pageSize": 6,
  264. "pageNo": 1
  265. },
  266. success: function(data) {
  267. if(data.success) {
  268. var $info = data.data.data;
  269. //console.log(data)
  270. $("#proShow").html("");
  271. for(var i = 0; i < $info.length; i++) {
  272. var liStr=$("<li class='flexCenter'></li>").appendTo("#proShow");
  273. var cmpname,imgurl='../images/default-photo.jpg'
  274. var oSty=autho($info[i].authType, $info[i].orgAuth, $info[i].authStatus);
  275. cmpname = $info[i].name;
  276. if($info[i].hasHeadImage) {
  277. imgurl='/images/head/' + $info[i].id + '_l.jpg';
  278. }
  279. var oTitle='';
  280. if($info[i].title) {
  281. oTitle = $info[i].title;
  282. if($info[i].orgName){
  283. oTitle = $info[i].title +','+ $info[i].orgName;
  284. }
  285. } else {
  286. if($info[i].office) {
  287. oTitle = $info[i].office;
  288. if($info[i].orgName){
  289. oTitle = $info[i].office +','+ $info[i].orgName;
  290. }
  291. }
  292. }
  293. var oResult=""
  294. if($info[i].researchAreas.length > 0){
  295. oResult = '研究方向:';
  296. for(var n = 0; n < $info[i].researchAreas.length; n++) {
  297. oResult += $info[i].researchAreas[n].caption
  298. if(n < $info[i].researchAreas.length - 1) {
  299. oResult += ";"
  300. }
  301. }
  302. }
  303. var strCon='';
  304. strCon += '<a target="_blank" href="userInforShow.html?professorId='+$info[i].id+'">'
  305. strCon += '<div class="madiaHead" style="background-image:url('+imgurl+')"></div>'
  306. strCon += '<div class="madiaInfo">'
  307. strCon += '<div class="h1Font clearfix">'
  308. strCon += '<span class="qiyego ellipsisSty">'+cmpname+'</span>'
  309. strCon += '<span class="authiconNew '+oSty.sty+'" title="'+oSty.tit+'"></span>'
  310. strCon += '</div>'
  311. strCon += '<div class="h3Font ellipsisSty" style="margin-top:0;">'+oTitle+'</div>'
  312. strCon += '<div class="h3Font ellipsisSty-2">'+oResult+'</div>'
  313. strCon += '</div></a>'
  314. liStr.html(strCon);
  315. }
  316. }
  317. },
  318. error: function() {
  319. }
  320. })
  321. }
  322. function hotArea(){//领域名称
  323. $.ajax({
  324. url: "/ajax/dataDict/qaDictCode",
  325. type: "GET",
  326. timeout: 10000,
  327. async:false,
  328. dataType: "json",
  329. data: {
  330. "dictCode":"SUBJECT",
  331. },
  332. success: function(data) {
  333. if(data.success) {
  334. var $info = data.data;
  335. //console.log(data)
  336. for(var i = 0; i < $info.length; i++) {
  337. var liStr=$("<li>"+$info[i].caption+"</li>").appendTo("#hotArea");
  338. }
  339. }
  340. },
  341. error: function() {
  342. }
  343. })
  344. }
  345. //kexiu carousel
  346. function carouselThis(){
  347. $.ajax({
  348. url: "/ajax/article/find",
  349. type: "GET",
  350. timeout: 10000,
  351. dataType: "json",
  352. data:{
  353. "col": 7,
  354. "pageSize": 3,
  355. "pageNo": 1
  356. },
  357. success: function(data) {
  358. if(data.success) {
  359. $("#carouselThis").html("");
  360. var $info = data.data.data;
  361. for(var i = 0; i < $info.length; i++) {
  362. var liStr=$('<div class="item"></div>').appendTo("#carouselThis");
  363. if(i==0){
  364. $(".item").addClass("active")
  365. }
  366. var imgurl="../images/default-artical.jpg";
  367. if($info[i].articleImg) {
  368. imgurl ='/data/article/' + $info[i].articleImg ;
  369. }
  370. if($info[i].articleType==1){
  371. }
  372. var strCon='';
  373. strCon += '<a target="_blank" class="aitemLink" href="articalShow.html?articleId='+ $info[i].articleId+'" style="background-image: url('+ imgurl+')" alt="'+$info[i].articleTitle+'">'
  374. strCon += '<div class="carousel-caption">'
  375. strCon += '<div class="homeinfo">'
  376. strCon += '<p class="h1Font ellipsisSty-2">'+ $info[i].articleTitle+'</p>'
  377. // strCon += '<p class="h2Font ">'+ authorInfo +'</p>'
  378. // strCon += '<p class="h2Font">'+ $info[i].articleContent +'</p>'
  379. strCon += '</div>'
  380. strCon += '</div></a>'
  381. liStr.html(strCon);
  382. // if($info[i].articleType==1){
  383. // userFun($info[i].professorId, liStr);
  384. // }else{
  385. // cmpFun($info[i].orgId, liStr);
  386. // }
  387. }
  388. }
  389. },
  390. error: function() {
  391. }
  392. })
  393. }
  394. /*用户信息*/
  395. function userFun(id,$listItem) {
  396. $.ajax({
  397. "url": "/ajax/professor/baseInfo/" + id,
  398. "type": "get",
  399. "async": true,
  400. "success": function(data) {
  401. if(data.success && data.data) {
  402. $listItem.find(".ownerName").text(data.data.name);
  403. }
  404. },
  405. "error": function() {
  406. $.MsgBox.Alert('提示', '链接服务器超时')
  407. }
  408. });
  409. }
  410. /*企业用户信息*/
  411. function cmpFun(id,$listItem) {
  412. $.ajax({
  413. "url": "/ajax/org/" + id,
  414. "type": "get",
  415. "async": true,
  416. "success": function(data) {
  417. if(data.success && data.data) {
  418. if(data.data.forShort) {
  419. $listItem.find(".ownerName").text(data.data.forShort);
  420. }else{
  421. $listItem.find(".ownerName").text(data.data.name);
  422. }
  423. }
  424. },
  425. "error": function() {
  426. $.MsgBox.Alert('提示', '链接服务器超时')
  427. }
  428. });
  429. }
  430. //资源mouseIn效果
  431. (function($){
  432. $.fn.extend({
  433. showOn : function(div){
  434. var w = this.width(),
  435. h = this.height(),
  436. xpos = w/2,
  437. ypos = h/2,
  438. eventType = "",
  439. direct = "";
  440. this.css({"overflow" : "hidden", "position" : "relative"});
  441. div.css({"position" : "absolute", "top" : this.width()});
  442. this.on("mouseenter mouseleave", function(e){
  443. var oe = e || event;
  444. var x = oe.offsetX;
  445. var y = oe.offsetY;
  446. var angle = Math.atan((x - xpos)/(y - ypos)) * 180 / Math.PI;
  447. if(angle > -45 && angle < 45 && y > ypos){
  448. direct = "down";
  449. }
  450. if(angle > -45 && angle < 45 && y < ypos){
  451. direct = "up";
  452. }
  453. if(((angle > -90 && angle <-45) || (angle >45 && angle <90)) && x > xpos){
  454. direct = "right";
  455. }
  456. if(((angle > -90 && angle <-45) || (angle >45 && angle <90)) && x < xpos){
  457. direct = "left";
  458. }
  459. move(e.type, direct)
  460. });
  461. function move(eventType, direct){
  462. if(eventType == "mouseenter"){
  463. switch(direct){
  464. case "down":
  465. div.css({"left": "0px", "top": h}).stop(true,true).animate({"top": "0px"}, "fast");
  466. break;
  467. case "up":
  468. div.css({"left": "0px", "top": -h}).stop(true,true).animate({"top": "0px"}, "fast");
  469. break;
  470. case "right":
  471. div.css({"left": w, "top": "0px"}).stop(true,true).animate({"left": "0px"}, "fast");
  472. break;
  473. case "left":
  474. div.css({"left": -w, "top": "0px"}).stop(true,true).animate({"left": "0px"}, "fast");
  475. break;
  476. }
  477. }else{
  478. switch(direct){
  479. case "down":
  480. div.stop(true,true).animate({"top": h}, "fast");
  481. break;
  482. case "up":
  483. div.stop(true,true).animate({"top": -h}, "fast");
  484. break;
  485. case "right":
  486. div.stop(true,true).animate({"left": w}, "fast");
  487. break;
  488. case "left":
  489. div.stop(true,true).animate({"left": -w}, "fast");
  490. break;
  491. }
  492. }
  493. }
  494. }
  495. });
  496. })(jQuery)
  497. })