portal html css js resource

index.js 16KB

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