portal html css js resource

index.js 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  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. return;
  43. }
  44. window.open("postDemand.html");
  45. })
  46. /*我是专家*/
  47. $("#JoinKeXiu").click(function(){
  48. if(userid=="null"||userid==undefined){
  49. location.href="login.html";
  50. }
  51. location.href="expert-authentication.html"
  52. })
  53. mouseIn()
  54. ruZhuCmp()
  55. resShare()
  56. hotArea()
  57. // carouselThis()
  58. var thisTabcon=$(".con-ultab>li:first-child").text();
  59. $(".con-ultab>li").eq(0).addClass("liNow");
  60. proShow(thisTabcon)
  61. $(".con-ultab").on("click","li",function(){
  62. thisTabcon=$(this).text();
  63. $(".con-ultab>li").eq($(this).index()).addClass("liNow").siblings().removeClass("liNow")
  64. proShow(thisTabcon);
  65. })
  66. $(".con-ulList").on("mouseenter","li",function(){
  67. $(this).find(".boxBlockimg").css("transform", "scale(1.1)");
  68. }).on("mouseleave","li",function(){
  69. $(this).find(".boxBlockimg").css("transform", "scale(1)");
  70. })
  71. function ruZhuCmp(){//入驻企业
  72. $.ajax({
  73. url: "/ajax/org/index/search",
  74. type: "GET",
  75. timeout: 10000,
  76. dataType: "json",
  77. data:{
  78. "rows": 6
  79. },
  80. success: function(data) {
  81. if(data.success) {
  82. var $info = data.data;
  83. for(var i = 0; i < $info.length; i++) {
  84. var liStr=$("<li></li>").appendTo("#ruZhuCmp");
  85. var cmpname,imgurl='../images/default-icon.jpg'
  86. if($info[i].hasOrgLogo) {
  87. imgurl='/images/org/' + $info[i].id + '.jpg';
  88. }
  89. if($info[i].forShort){
  90. cmpname = $info[i].forShort;
  91. }else{
  92. cmpname = $info[i].name;
  93. }
  94. var oSty={sty:"",tit:""};
  95. if($info[i].authStatus == 3) {
  96. oSty.sty="authicon-com-ok"
  97. oSty.tit="科袖认证企业"
  98. }
  99. var orgOther = "",orgType="";
  100. if($info[i].industry) {
  101. orgOther = $info[i].industry.replace(/,/gi, " | ");
  102. }
  103. if($info[i].orgType == "2") {
  104. orgType = orgTypeShow[$info[i].orgType] + "<span style='margin-right:16px;'></span>";
  105. }
  106. var strCon='';
  107. strCon += '<a target="_blank" href="cmpInforShow.html?orgId='+$info[i].id+'">'
  108. strCon += '<div class="madiaHead">'
  109. strCon += '<div class="boxBlock"><img class="boxBlockimg" src="'+imgurl+'"></div></div>'
  110. strCon += '<div class="madiaInfo">'
  111. strCon += '<div class="h1Font clearfix">'
  112. strCon += '<span class="qiyego ellipsisSty">'+cmpname+'</span>'
  113. strCon += '<span class="authiconNew '+oSty.sty+'" title="'+oSty.tit+'"></span>'
  114. strCon += '</div>'
  115. strCon += '<div class="h3Font ellipsisSty">'
  116. strCon += '<span>'+orgType+orgOther+'</span>'
  117. strCon += '</div>'
  118. strCon += '</div></a>'
  119. liStr.html(strCon);
  120. }
  121. }
  122. },
  123. error: function() {
  124. }
  125. })
  126. }
  127. function resShare(){//资源共享
  128. $.ajax({
  129. url: "/ajax/resource/index/search",
  130. type: "GET",
  131. timeout: 10000,
  132. dataType: "json",
  133. data:{
  134. "rows":8
  135. },
  136. success: function(data) {
  137. if(data.success) {
  138. var $info = data.data;
  139. for(var i = 0; i < $info.length; i++) {
  140. var liStr=$("<li></li>").appendTo("#resShare");
  141. var cmpname,imgurl='../images/default-resource.jpg'
  142. var oSty={sty:"",tit:""};
  143. if($info[i].images.length > 0) {
  144. imgurl='/data/resource/' + $info[i].images[0].imageSrc
  145. }
  146. if($info[i].resourceType == 1) { //个人资源
  147. cmpname = $info[i].editProfessor.name;
  148. oSty = autho($info[i].editProfessor.authType, $info[i].editProfessor.orgAuth, $info[i].editProfessor.authStatus);
  149. } else if($info[i].resourceType == 2) { //企业资源
  150. if($info[i].organization.forShort) {
  151. cmpname = $info[i].organization.forShort;
  152. }else{
  153. cmpname = $info[i].organization.name;
  154. }
  155. if($info[i].organization.authStatus==3){
  156. oSty.sty="authicon-com-ok"
  157. oSty.tit="科袖认证企业"
  158. }
  159. }
  160. var strCon='';
  161. strCon += '<a target="_blank" class="madiaOuter" href="resourceShow.html?resourceId='+$info[i].resourceId+'" style="background-image:url('+imgurl+');">'
  162. // strCon += '<div class="madiaHead" style="background-image:url('+imgurl+')"></div>'
  163. strCon += '<div class="madiaInfo madiaInner">'
  164. strCon += '<div class="h1Font ellipsisSty-2">'+$info[i].resourceName+'</div>'
  165. strCon += '<div class="h3Font clearfix">'
  166. strCon += '<span class="qiyego ellipsisSty">'+cmpname+'</span>'
  167. strCon += '<span class="authiconNew '+oSty.sty+'" title="'+oSty.tit+'"></span>'
  168. strCon += '</div>'
  169. strCon += '</div></a>'
  170. liStr.html(strCon);
  171. }
  172. $(".madiaOuter").each(function(i){
  173. $(this).showOn($(".madiaInner").eq(i));
  174. });
  175. }
  176. },
  177. error: function() {
  178. }
  179. })
  180. }
  181. function proShow(thiscon){//专家
  182. $.ajax({
  183. url: "/ajax/professor/index/search",
  184. type: "GET",
  185. timeout: 10000,
  186. dataType: "json",
  187. async:false,
  188. data:{
  189. "subject":thiscon,
  190. "rows": 6
  191. },
  192. success: function(data) {
  193. if(data.success) {
  194. var $info = data.data;
  195. //console.log(data)
  196. $("#proShow").html("");
  197. for(var i = 0; i < $info.length; i++) {
  198. var liStr=$("<li class='flexCenter'></li>").appendTo("#proShow");
  199. var cmpname,imgurl='../images/default-photo.jpg'
  200. var oSty=autho($info[i].authType, $info[i].orgAuth, $info[i].authStatus);
  201. cmpname = $info[i].name;
  202. if($info[i].hasHeadImage) {
  203. imgurl='/images/head/' + $info[i].id + '_l.jpg';
  204. }
  205. var oTitle='';
  206. if($info[i].title) {
  207. oTitle = $info[i].title;
  208. if($info[i].orgName){
  209. oTitle = $info[i].title +','+ $info[i].orgName;
  210. }
  211. } else {
  212. if($info[i].office) {
  213. oTitle = $info[i].office;
  214. if($info[i].orgName){
  215. oTitle = $info[i].office +','+ $info[i].orgName;
  216. }
  217. }
  218. }
  219. var oResult=""
  220. if($info[i].researchAreas.length > 0){
  221. oResult = '研究方向:';
  222. for(var n = 0; n < $info[i].researchAreas.length; n++) {
  223. oResult += $info[i].researchAreas[n].caption
  224. if(n < $info[i].researchAreas.length - 1) {
  225. oResult += ";"
  226. }
  227. }
  228. }
  229. var strCon='';
  230. strCon += '<a target="_blank" href="userInforShow.html?professorId='+$info[i].id+'">'
  231. strCon += '<div class="madiaHead" style="background-image:url('+imgurl+')"></div>'
  232. strCon += '<div class="madiaInfo">'
  233. strCon += '<div class="h1Font clearfix">'
  234. strCon += '<span class="qiyego ellipsisSty">'+cmpname+'</span>'
  235. strCon += '<span class="authiconNew '+oSty.sty+'" title="'+oSty.tit+'"></span>'
  236. strCon += '</div>'
  237. strCon += '<div class="h3Font ellipsisSty" style="margin-top:0;">'+oTitle+'</div>'
  238. strCon += '<div class="h3Font ellipsisSty-2">'+oResult+'</div>'
  239. strCon += '</div></a>'
  240. liStr.html(strCon);
  241. }
  242. }
  243. },
  244. error: function() {
  245. }
  246. })
  247. }
  248. function hotArea(){//领域名称
  249. $.ajax({
  250. url: "/ajax/dataDict/qaDictCode",
  251. type: "GET",
  252. timeout: 10000,
  253. async:false,
  254. dataType: "json",
  255. data: {
  256. "dictCode":"SUBJECT",
  257. },
  258. success: function(data) {
  259. if(data.success) {
  260. var $info = data.data;
  261. //console.log(data)
  262. for(var i = 0; i < $info.length; i++) {
  263. var liStr=$("<li>"+$info[i].caption+"</li>").appendTo("#hotArea");
  264. }
  265. }
  266. },
  267. error: function() {
  268. }
  269. })
  270. }
  271. //kexiu carousel
  272. function carouselThis(){
  273. $.ajax({
  274. url: "/ajax/article/find",
  275. type: "GET",
  276. timeout: 10000,
  277. dataType: "json",
  278. data:{
  279. "col": 7,
  280. "pageSize": 3,
  281. "pageNo": 1
  282. },
  283. success: function(data) {
  284. if(data.success) {
  285. $("#carouselThis").html("");
  286. var $info = data.data.data;
  287. for(var i = 0; i < $info.length; i++) {
  288. var liStr=$('<div class="item"></div>').appendTo("#carouselThis");
  289. if(i==0){
  290. $(".item").addClass("active")
  291. }
  292. var imgurl="../images/default-artical.jpg";
  293. if($info[i].articleImg) {
  294. imgurl ='/data/article/' + $info[i].articleImg ;
  295. }
  296. if($info[i].articleType==1){
  297. }
  298. var strCon='';
  299. strCon += '<a target="_blank" class="aitemLink" href="/'+ pageUrl('a',$info[i])+'" style="background-image: url('+ imgurl+')" alt="'+$info[i].articleTitle+'">'
  300. strCon += '<div class="carousel-caption">'
  301. strCon += '<div class="homeinfo">'
  302. strCon += '<p class="h1Font ellipsisSty-2">'+ $info[i].articleTitle+'</p>'
  303. // strCon += '<p class="h2Font ">'+ authorInfo +'</p>'
  304. // strCon += '<p class="h2Font">'+ $info[i].articleContent +'</p>'
  305. strCon += '</div>'
  306. strCon += '</div></a>'
  307. liStr.html(strCon);
  308. // if($info[i].articleType==1){
  309. // userFun($info[i].professorId, liStr);
  310. // }else{
  311. // cmpFun($info[i].orgId, liStr);
  312. // }
  313. }
  314. }
  315. },
  316. error: function() {
  317. }
  318. })
  319. }
  320. /*用户信息*/
  321. function userFun(id,$listItem) {
  322. $.ajax({
  323. "url": "/ajax/professor/baseInfo/" + id,
  324. "type": "get",
  325. "async": true,
  326. "success": function(data) {
  327. if(data.success && data.data) {
  328. $listItem.find(".ownerName").text(data.data.name);
  329. }
  330. },
  331. "error": function() {
  332. $.MsgBox.Alert('提示', '链接服务器超时')
  333. }
  334. });
  335. }
  336. /*企业用户信息*/
  337. function cmpFun(id,$listItem) {
  338. $.ajax({
  339. "url": "/ajax/org/" + id,
  340. "type": "get",
  341. "async": true,
  342. "success": function(data) {
  343. if(data.success && data.data) {
  344. if(data.data.forShort) {
  345. $listItem.find(".ownerName").text(data.data.forShort);
  346. }else{
  347. $listItem.find(".ownerName").text(data.data.name);
  348. }
  349. }
  350. },
  351. "error": function() {
  352. $.MsgBox.Alert('提示', '链接服务器超时')
  353. }
  354. });
  355. }
  356. //资源mouseIn效果
  357. function mouseIn(){
  358. $.fn.extend({
  359. showOn : function(div){
  360. var w = this.width(),
  361. h = this.height(),
  362. xpos = w/2,
  363. ypos = h/2,
  364. eventType = "",
  365. direct = "";
  366. this.css({"overflow" : "hidden", "position" : "relative"});
  367. div.css({"position" : "absolute", "top" : this.width()});
  368. this.on("mouseenter mouseleave", function(e){
  369. var oe = e || event;
  370. var x = oe.offsetX;
  371. var y = oe.offsetY;
  372. var angle = Math.atan((x - xpos)/(y - ypos)) * 180 / Math.PI;
  373. if(angle > -45 && angle < 45 && y > ypos){
  374. direct = "down";
  375. }
  376. if(angle > -45 && angle < 45 && y < ypos){
  377. direct = "up";
  378. }
  379. if(((angle > -90 && angle <-45) || (angle >45 && angle <90)) && x > xpos){
  380. direct = "right";
  381. }
  382. if(((angle > -90 && angle <-45) || (angle >45 && angle <90)) && x < xpos){
  383. direct = "left";
  384. }
  385. move(e.type, direct)
  386. });
  387. function move(eventType, direct){
  388. if(eventType == "mouseenter"){
  389. switch(direct){
  390. case "down":
  391. div.css({"left": "0px", "top": h}).stop(true,true).animate({"top": "0px"}, "fast");
  392. break;
  393. case "up":
  394. div.css({"left": "0px", "top": -h}).stop(true,true).animate({"top": "0px"}, "fast");
  395. break;
  396. case "right":
  397. div.css({"left": w, "top": "0px"}).stop(true,true).animate({"left": "0px"}, "fast");
  398. break;
  399. case "left":
  400. div.css({"left": -w, "top": "0px"}).stop(true,true).animate({"left": "0px"}, "fast");
  401. break;
  402. }
  403. }else{
  404. switch(direct){
  405. case "down":
  406. div.stop(true,true).animate({"top": h}, "fast");
  407. break;
  408. case "up":
  409. div.stop(true,true).animate({"top": -h}, "fast");
  410. break;
  411. case "right":
  412. div.stop(true,true).animate({"left": w}, "fast");
  413. break;
  414. case "left":
  415. div.stop(true,true).animate({"left": -w}, "fast");
  416. break;
  417. }
  418. }
  419. }
  420. }
  421. });
  422. }
  423. })