portal html css js resource

index.js 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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-needList.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-needList.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/index/search",
  149. type: "GET",
  150. timeout: 10000,
  151. dataType: "json",
  152. data:{
  153. "rows": 6
  154. },
  155. success: function(data) {
  156. if(data.success) {
  157. var $info = data.data;
  158. for(var i = 0; i < $info.length; i++) {
  159. var liStr=$("<li></li>").appendTo("#ruZhuCmp");
  160. var cmpname,imgurl='../images/default-icon.jpg'
  161. if($info[i].hasOrgLogo) {
  162. imgurl='/images/org/' + $info[i].id + '.jpg';
  163. }
  164. // if($info[i].forShort){
  165. // cmpname = $info[i].forShort;
  166. // }else{
  167. cmpname = $info[i].name;
  168. // }
  169. var oSty={sty:"",tit:""};
  170. if($info[i].authStatus == 3) {
  171. oSty.sty="authicon-com-ok"
  172. oSty.tit="科袖认证企业"
  173. }
  174. var orgOther = "",orgType="";
  175. if($info[i].industry) {
  176. orgOther = $info[i].industry.replace(/,/gi, " | ");
  177. }
  178. if($info[i].orgType == "2") {
  179. orgType = orgTypeShow[$info[i].orgType] + "<span style='margin-right:16px;'></span>";
  180. }
  181. var strCon='';
  182. strCon += '<a target="_blank" href="cmpInforShow.html?orgId='+$info[i].id+'">'
  183. strCon += '<div class="madiaHead">'
  184. strCon += '<div class="boxBlock"><img class="boxBlockimg" src="'+imgurl+'"></div></div>'
  185. strCon += '<div class="madiaInfo">'
  186. strCon += '<div class="h1Font clearfix">'
  187. strCon += '<span class="qiyego ellipsisSty">'+cmpname+'</span>'
  188. strCon += '<span class="authiconNew '+oSty.sty+'" title="'+oSty.tit+'"></span>'
  189. strCon += '</div>'
  190. strCon += '<div class="h3Font ellipsisSty">'
  191. strCon += '<span>'+orgType+orgOther+'</span>'
  192. strCon += '</div>'
  193. strCon += '</div></a>'
  194. liStr.html(strCon);
  195. }
  196. }
  197. },
  198. error: function() {
  199. }
  200. })
  201. }
  202. function resShare(){//资源共享
  203. $.ajax({
  204. url: "/ajax/resource/index/search",
  205. type: "GET",
  206. timeout: 10000,
  207. dataType: "json",
  208. data:{
  209. "rows":8
  210. },
  211. success: function(data) {
  212. if(data.success) {
  213. var $info = data.data;
  214. for(var i = 0; i < $info.length; i++) {
  215. var liStr=$("<li></li>").appendTo("#resShare");
  216. var cmpname,imgurl='../images/default-resource.jpg'
  217. var oSty={sty:"",tit:""};
  218. if($info[i].images.length > 0) {
  219. imgurl='/data/resource/' + $info[i].images[0].imageSrc
  220. }
  221. if($info[i].resourceType == 1) { //个人资源
  222. cmpname = $info[i].editProfessor.name;
  223. oSty = autho($info[i].editProfessor.authType, $info[i].editProfessor.orgAuth, $info[i].editProfessor.authStatus);
  224. } else if($info[i].resourceType == 2) { //企业资源
  225. if($info[i].organization.forShort) {
  226. cmpname = $info[i].organization.forShort;
  227. }else{
  228. cmpname = $info[i].organization.name;
  229. }
  230. if($info[i].organization.authStatus==3){
  231. oSty.sty="authicon-com-ok"
  232. oSty.tit="科袖认证企业"
  233. }
  234. }
  235. var strCon='';
  236. strCon += '<a target="_blank" class="madiaOuter" href="resourceShow.html?resourceId='+$info[i].resourceId+'" style="background-image:url('+imgurl+');">'
  237. // strCon += '<div class="madiaHead" style="background-image:url('+imgurl+')"></div>'
  238. strCon += '<div class="madiaInfo madiaInner">'
  239. strCon += '<div class="h1Font ellipsisSty-2">'+$info[i].resourceName+'</div>'
  240. strCon += '<div class="h3Font clearfix">'
  241. strCon += '<span class="qiyego ellipsisSty">'+cmpname+'</span>'
  242. strCon += '<span class="authiconNew '+oSty.sty+'" title="'+oSty.tit+'"></span>'
  243. strCon += '</div>'
  244. strCon += '</div></a>'
  245. liStr.html(strCon);
  246. }
  247. $(".madiaOuter").each(function(i){
  248. $(this).showOn($(".madiaInner").eq(i));
  249. });
  250. }
  251. },
  252. error: function() {
  253. }
  254. })
  255. }
  256. function proShow(thiscon){//专家
  257. $.ajax({
  258. url: "/ajax/professor/index/search",
  259. type: "GET",
  260. timeout: 10000,
  261. dataType: "json",
  262. async:false,
  263. data:{
  264. "subject":thiscon,
  265. "rows": 6
  266. },
  267. success: function(data) {
  268. if(data.success) {
  269. var $info = 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="/'+ pageUrl('a',$info[i])+'" 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. })