portal html css js resource

index.js 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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. mouseIn()
  126. ruZhuCmp()
  127. resShare()
  128. hotArea()
  129. // carouselThis()
  130. var thisTabcon=$(".con-ultab>li:first-child").text();
  131. $(".con-ultab>li").eq(0).addClass("liNow");
  132. proShow(thisTabcon)
  133. $(".con-ultab").on("click","li",function(){
  134. thisTabcon=$(this).text();
  135. $(".con-ultab>li").eq($(this).index()).addClass("liNow").siblings().removeClass("liNow")
  136. proShow(thisTabcon);
  137. })
  138. $(".con-ulList").on("mouseenter","li",function(){
  139. $(this).find(".boxBlockimg").css("transform", "scale(1.1)");
  140. }).on("mouseleave","li",function(){
  141. $(this).find(".boxBlockimg").css("transform", "scale(1)");
  142. })
  143. function ruZhuCmp(){//入驻企业
  144. $.ajax({
  145. url: "/ajax/org/find/pq",
  146. type: "GET",
  147. timeout: 10000,
  148. dataType: "json",
  149. data:{
  150. "pageSize": 6,
  151. "pageNo": 1
  152. },
  153. success: function(data) {
  154. if(data.success) {
  155. var $info = data.data.data;
  156. for(var i = 0; i < $info.length; i++) {
  157. var liStr=$("<li></li>").appendTo("#ruZhuCmp");
  158. var cmpname,imgurl='../images/default-icon.jpg'
  159. if($info[i].hasOrgLogo) {
  160. imgurl='/images/org/' + $info[i].id + '.jpg';
  161. }
  162. // if($info[i].forShort){
  163. // cmpname = $info[i].forShort;
  164. // }else{
  165. cmpname = $info[i].name;
  166. // }
  167. var oSty={sty:"",tit:""};
  168. if($info[i].authStatus == 3) {
  169. oSty.sty="authicon-com-ok"
  170. oSty.tit="科袖认证企业"
  171. }
  172. var orgOther = "",orgType="";
  173. if($info[i].industry) {
  174. orgOther = $info[i].industry.replace(/,/gi, " | ");
  175. }
  176. if($info[i].orgType == "2") {
  177. orgType = orgTypeShow[$info[i].orgType] + "<span style='margin-right:16px;'></span>";
  178. }
  179. var strCon='';
  180. strCon += '<a target="_blank" href="cmpInforShow.html?orgId='+$info[i].id+'">'
  181. strCon += '<div class="madiaHead">'
  182. strCon += '<div class="boxBlock"><img class="boxBlockimg" src="'+imgurl+'"></div></div>'
  183. strCon += '<div class="madiaInfo">'
  184. strCon += '<div class="h1Font clearfix">'
  185. strCon += '<span class="qiyego ellipsisSty">'+cmpname+'</span>'
  186. strCon += '<span class="authiconNew '+oSty.sty+'" title="'+oSty.tit+'"></span>'
  187. strCon += '</div>'
  188. strCon += '<div class="h3Font ellipsisSty">'
  189. strCon += '<span>'+orgType+orgOther+'</span>'
  190. strCon += '</div>'
  191. strCon += '</div></a>'
  192. liStr.html(strCon);
  193. }
  194. }
  195. },
  196. error: function() {
  197. }
  198. })
  199. }
  200. function resShare(){//资源共享
  201. $.ajax({
  202. url: "/ajax/resource/firstpq",
  203. type: "GET",
  204. timeout: 10000,
  205. dataType: "json",
  206. data:{
  207. "pageSize":8,
  208. "pageNo": 1
  209. },
  210. success: function(data) {
  211. if(data.success) {
  212. var $info = data.data.data;
  213. for(var i = 0; i < $info.length; i++) {
  214. var liStr=$("<li></li>").appendTo("#resShare");
  215. var cmpname,imgurl='../images/default-resource.jpg'
  216. var oSty={sty:"",tit:""};
  217. if($info[i].images.length > 0) {
  218. imgurl='/data/resource/' + $info[i].images[0].imageSrc
  219. }
  220. if($info[i].resourceType == 1) { //个人资源
  221. cmpname = $info[i].editProfessor.name;
  222. oSty = autho($info[i].editProfessor.authType, $info[i].editProfessor.orgAuth, $info[i].editProfessor.authStatus);
  223. } else if($info[i].resourceType == 2) { //企业资源
  224. if($info[i].organization.forShort) {
  225. cmpname = $info[i].organization.forShort;
  226. }else{
  227. cmpname = $info[i].organization.name;
  228. }
  229. if($info[i].organization.authStatus==3){
  230. oSty.sty="authicon-com-ok"
  231. oSty.tit="科袖认证企业"
  232. }
  233. }
  234. var strCon='';
  235. strCon += '<a target="_blank" class="madiaOuter" href="resourceShow.html?resourceId='+$info[i].resourceId+'" style="background-image:url('+imgurl+');">'
  236. // strCon += '<div class="madiaHead" style="background-image:url('+imgurl+')"></div>'
  237. strCon += '<div class="madiaInfo madiaInner">'
  238. strCon += '<div class="h1Font ellipsisSty-2">'+$info[i].resourceName+'</div>'
  239. strCon += '<div class="h3Font clearfix">'
  240. strCon += '<span class="qiyego ellipsisSty">'+cmpname+'</span>'
  241. strCon += '<span class="authiconNew '+oSty.sty+'" title="'+oSty.tit+'"></span>'
  242. strCon += '</div>'
  243. strCon += '</div></a>'
  244. liStr.html(strCon);
  245. }
  246. $(".madiaOuter").each(function(i){
  247. $(this).showOn($(".madiaInner").eq(i));
  248. });
  249. }
  250. },
  251. error: function() {
  252. }
  253. })
  254. }
  255. function proShow(thiscon){//专家
  256. $.ajax({
  257. url: "/ajax/professor/pqBaseInfo",
  258. type: "GET",
  259. timeout: 10000,
  260. dataType: "json",
  261. async:false,
  262. data:{
  263. "subject":thiscon,
  264. "pageSize": 6,
  265. "pageNo": 1
  266. },
  267. success: function(data) {
  268. if(data.success) {
  269. var $info = data.data.data;
  270. //console.log(data)
  271. $("#proShow").html("");
  272. for(var i = 0; i < $info.length; i++) {
  273. var liStr=$("<li class='flexCenter'></li>").appendTo("#proShow");
  274. var cmpname,imgurl='../images/default-photo.jpg'
  275. var oSty=autho($info[i].authType, $info[i].orgAuth, $info[i].authStatus);
  276. cmpname = $info[i].name;
  277. if($info[i].hasHeadImage) {
  278. imgurl='/images/head/' + $info[i].id + '_l.jpg';
  279. }
  280. var oTitle='';
  281. if($info[i].title) {
  282. oTitle = $info[i].title;
  283. if($info[i].orgName){
  284. oTitle = $info[i].title +','+ $info[i].orgName;
  285. }
  286. } else {
  287. if($info[i].office) {
  288. oTitle = $info[i].office;
  289. if($info[i].orgName){
  290. oTitle = $info[i].office +','+ $info[i].orgName;
  291. }
  292. }
  293. }
  294. var oResult=""
  295. if($info[i].researchAreas.length > 0){
  296. oResult = '研究方向:';
  297. for(var n = 0; n < $info[i].researchAreas.length; n++) {
  298. oResult += $info[i].researchAreas[n].caption
  299. if(n < $info[i].researchAreas.length - 1) {
  300. oResult += ";"
  301. }
  302. }
  303. }
  304. var strCon='';
  305. strCon += '<a target="_blank" href="userInforShow.html?professorId='+$info[i].id+'">'
  306. strCon += '<div class="madiaHead" style="background-image:url('+imgurl+')"></div>'
  307. strCon += '<div class="madiaInfo">'
  308. strCon += '<div class="h1Font clearfix">'
  309. strCon += '<span class="qiyego ellipsisSty">'+cmpname+'</span>'
  310. strCon += '<span class="authiconNew '+oSty.sty+'" title="'+oSty.tit+'"></span>'
  311. strCon += '</div>'
  312. strCon += '<div class="h3Font ellipsisSty" style="margin-top:0;">'+oTitle+'</div>'
  313. strCon += '<div class="h3Font ellipsisSty-2">'+oResult+'</div>'
  314. strCon += '</div></a>'
  315. liStr.html(strCon);
  316. }
  317. }
  318. },
  319. error: function() {
  320. }
  321. })
  322. }
  323. function hotArea(){//领域名称
  324. $.ajax({
  325. url: "/ajax/dataDict/qaDictCode",
  326. type: "GET",
  327. timeout: 10000,
  328. async:false,
  329. dataType: "json",
  330. data: {
  331. "dictCode":"SUBJECT",
  332. },
  333. success: function(data) {
  334. if(data.success) {
  335. var $info = data.data;
  336. //console.log(data)
  337. for(var i = 0; i < $info.length; i++) {
  338. var liStr=$("<li>"+$info[i].caption+"</li>").appendTo("#hotArea");
  339. }
  340. }
  341. },
  342. error: function() {
  343. }
  344. })
  345. }
  346. //kexiu carousel
  347. function carouselThis(){
  348. $.ajax({
  349. url: "/ajax/article/find",
  350. type: "GET",
  351. timeout: 10000,
  352. dataType: "json",
  353. data:{
  354. "col": 7,
  355. "pageSize": 3,
  356. "pageNo": 1
  357. },
  358. success: function(data) {
  359. if(data.success) {
  360. $("#carouselThis").html("");
  361. var $info = data.data.data;
  362. for(var i = 0; i < $info.length; i++) {
  363. var liStr=$('<div class="item"></div>').appendTo("#carouselThis");
  364. if(i==0){
  365. $(".item").addClass("active")
  366. }
  367. var imgurl="../images/default-artical.jpg";
  368. if($info[i].articleImg) {
  369. imgurl ='/data/article/' + $info[i].articleImg ;
  370. }
  371. if($info[i].articleType==1){
  372. }
  373. var strCon='';
  374. strCon += '<a target="_blank" class="aitemLink" href="articalShow.html?articleId='+ $info[i].articleId+'" style="background-image: url('+ imgurl+')" alt="'+$info[i].articleTitle+'">'
  375. strCon += '<div class="carousel-caption">'
  376. strCon += '<div class="homeinfo">'
  377. strCon += '<p class="h1Font ellipsisSty-2">'+ $info[i].articleTitle+'</p>'
  378. // strCon += '<p class="h2Font ">'+ authorInfo +'</p>'
  379. // strCon += '<p class="h2Font">'+ $info[i].articleContent +'</p>'
  380. strCon += '</div>'
  381. strCon += '</div></a>'
  382. liStr.html(strCon);
  383. // if($info[i].articleType==1){
  384. // userFun($info[i].professorId, liStr);
  385. // }else{
  386. // cmpFun($info[i].orgId, liStr);
  387. // }
  388. }
  389. }
  390. },
  391. error: function() {
  392. }
  393. })
  394. }
  395. /*用户信息*/
  396. function userFun(id,$listItem) {
  397. $.ajax({
  398. "url": "/ajax/professor/baseInfo/" + id,
  399. "type": "get",
  400. "async": true,
  401. "success": function(data) {
  402. if(data.success && data.data) {
  403. $listItem.find(".ownerName").text(data.data.name);
  404. }
  405. },
  406. "error": function() {
  407. $.MsgBox.Alert('提示', '链接服务器超时')
  408. }
  409. });
  410. }
  411. /*企业用户信息*/
  412. function cmpFun(id,$listItem) {
  413. $.ajax({
  414. "url": "/ajax/org/" + id,
  415. "type": "get",
  416. "async": true,
  417. "success": function(data) {
  418. if(data.success && data.data) {
  419. if(data.data.forShort) {
  420. $listItem.find(".ownerName").text(data.data.forShort);
  421. }else{
  422. $listItem.find(".ownerName").text(data.data.name);
  423. }
  424. }
  425. },
  426. "error": function() {
  427. $.MsgBox.Alert('提示', '链接服务器超时')
  428. }
  429. });
  430. }
  431. //资源mouseIn效果
  432. function mouseIn(){
  433. $.fn.extend({
  434. showOn : function(div){
  435. var w = this.width(),
  436. h = this.height(),
  437. xpos = w/2,
  438. ypos = h/2,
  439. eventType = "",
  440. direct = "";
  441. this.css({"overflow" : "hidden", "position" : "relative"});
  442. div.css({"position" : "absolute", "top" : this.width()});
  443. this.on("mouseenter mouseleave", function(e){
  444. var oe = e || event;
  445. var x = oe.offsetX;
  446. var y = oe.offsetY;
  447. var angle = Math.atan((x - xpos)/(y - ypos)) * 180 / Math.PI;
  448. if(angle > -45 && angle < 45 && y > ypos){
  449. direct = "down";
  450. }
  451. if(angle > -45 && angle < 45 && y < ypos){
  452. direct = "up";
  453. }
  454. if(((angle > -90 && angle <-45) || (angle >45 && angle <90)) && x > xpos){
  455. direct = "right";
  456. }
  457. if(((angle > -90 && angle <-45) || (angle >45 && angle <90)) && x < xpos){
  458. direct = "left";
  459. }
  460. move(e.type, direct)
  461. });
  462. function move(eventType, direct){
  463. if(eventType == "mouseenter"){
  464. switch(direct){
  465. case "down":
  466. div.css({"left": "0px", "top": h}).stop(true,true).animate({"top": "0px"}, "fast");
  467. break;
  468. case "up":
  469. div.css({"left": "0px", "top": -h}).stop(true,true).animate({"top": "0px"}, "fast");
  470. break;
  471. case "right":
  472. div.css({"left": w, "top": "0px"}).stop(true,true).animate({"left": "0px"}, "fast");
  473. break;
  474. case "left":
  475. div.css({"left": -w, "top": "0px"}).stop(true,true).animate({"left": "0px"}, "fast");
  476. break;
  477. }
  478. }else{
  479. switch(direct){
  480. case "down":
  481. div.stop(true,true).animate({"top": h}, "fast");
  482. break;
  483. case "up":
  484. div.stop(true,true).animate({"top": -h}, "fast");
  485. break;
  486. case "right":
  487. div.stop(true,true).animate({"left": w}, "fast");
  488. break;
  489. case "left":
  490. div.stop(true,true).animate({"left": -w}, "fast");
  491. break;
  492. }
  493. }
  494. }
  495. }
  496. });
  497. }
  498. })