説明なし

information.js 35KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165
  1. $(function(){
  2. //1获取数据
  3. loginStatus();
  4. var userid = $.cookie("userid");
  5. if(userid){
  6. //填充学术领域
  7. var subjectShow = function (data){
  8. if(data != undefined && data.length != 0 ){
  9. var subs = new Array();
  10. if(data.indexOf(',')){
  11. subs = data.split(',');
  12. }else{
  13. subs[0] = data;
  14. }
  15. if(subs.length>0){
  16. for (var i = 0; i < subs.length; i++) {
  17. $("#subjectList").append("<div class='acad'>"+ subs[i] +"<span class='remove'><img src='images/move.png'></span></div>");
  18. $("#subjectShow").append("<div class='acad'>"+subs[i]+"</div>");
  19. };
  20. }
  21. }
  22. }
  23. //填充应用行业
  24. var industryShow = function (data){
  25. if(data != undefined && data.length != 0 ){
  26. var subs = new Array();
  27. if(data.indexOf(',')){
  28. subs = data.split(',');
  29. }else{
  30. subs[0] = data;
  31. }
  32. if(subs.length>0){
  33. for (var i = 0; i < subs.length; i++) {
  34. $("#industryList").append("<div class='acad'>"+ subs[i] +"<span class='remove'><img src='images/move.png'></span></div>");
  35. $("#industryShow").append("<li>"+subs[i]+"</li>");
  36. };
  37. }
  38. }
  39. }
  40. //填充教育背景
  41. var eduBgShow = function(data) {
  42. if(data.length>0){
  43. for (var i = 0; i < data.length; i++) {
  44. $("#eduBgShow").append("<li>"+data[i].school+"-"+data[i].college+"-"+data[i].major+"-"+data[i].degree+"-"+data[i].year+"</li>");
  45. $("#eduBgList").append("<li class='eg'>"+data[i].school+"-"+data[i].college+"-"+data[i].major+"-"+data[i].degree+"-"+data[i].year+"<span class='modi' title='"+data[i].id+"'><img src='images/madify.png'></span><span class='remove' title='"+data[i].id+"' ><img src='images/move.png'></span></li>");
  46. }
  47. }
  48. }
  49. //填充社会兼职
  50. var timeJobShow = function(data) {
  51. if(data.length>0){
  52. for (var i = 0; i < data.length; i++) {
  53. $("#timeJobShow").append("<li>"+data[i].company+"-"+data[i].title+"-"+data[i].startMonth+"-"+data[i].stopMonth+"</li>");
  54. $("#timeJobList").append("<li class='tj'>"+data[i].company+"-"+data[i].title+"-"+data[i].startMonth+"-"+data[i].stopMonth+"<span class=\"modi\" title='"+data[i].id+"'><img src=\"images/madify.png\"></span><span class=\"remove\" title='"+data[i].id+"' ><img src=\"images/move.png\" ></span></li>");
  55. }
  56. }
  57. }
  58. //填充项目经历
  59. var projectShow = function(data){
  60. if(data.length>0){
  61. for (var i = 0; i < data.length; i++) {
  62. $("#projectShow").append("<li>名称:"+data[i].name+"<br>内容:"+data[i].descp+"</li>");
  63. $("#projectList").append("<li class='pro'>"+data[i].name+"<br>"+data[i].descp+"<span class=\"modi\" title='"+data[i].id+"'><img src=\"images/madify.png\"></span><span class=\"remove\" title='"+data[i].id+"' ><img src=\"images/move.png\" ></span></li>");
  64. }
  65. }
  66. }
  67. //填充著作论文文章
  68. var paperShow = function(data){
  69. if(data.length>0){
  70. for (var i = 0; i < data.length; i++) {
  71. $("#paperShow").append("<li>"+data[i].name+"</li>");
  72. $("#paperList").append("<li class='pap'>"+data[i].name+"<span class=\"modi\" title='"+data[i].id+"'><img src=\"images/madify.png\"></span><span class=\"remove\" title='"+data[i].id+"' ><img src=\"images/move.png\" ></span></li>");
  73. }
  74. }
  75. }
  76. //填充专利
  77. var patentShow = function(data){
  78. if(data.length>0){
  79. for (var i = 0; i < data.length; i++) {
  80. $("#patentShow").append("<li>"+data[i].name+"-"+data[i].year+"</li>");
  81. $("#patentList").append("<li class='pat'>"+data[i].name+"-"+data[i].year+"<span class=\"modi\" title='"+data[i].id+"'><img src=\"images/madify.png\"></span><span class=\"remove\" title='"+data[i].id+"' ><img src=\"images/move.png\" ></span></li>");
  82. }
  83. }
  84. }
  85. //填充荣誉
  86. var honorShow = function(data){
  87. if(data.length>0){
  88. for (var i = 0; i < data.length; i++) {
  89. $("#honorShow").append("<li>"+data[i].name+"</li>");
  90. $("#honorList").append("<li class='hon'>"+data[i].name+"<span class=\"modi\" title='"+data[i].id+"'><img src=\"images/madify.png\"></span><span class=\"remove\" title='"+data[i].id+"' ><img src=\"images/move.png\" ></span></li>");
  91. }
  92. }
  93. }
  94. //填充研究方向
  95. var researchAreaShow = function ($datas,$datarecords){
  96. if($datas != undefined && $datas.length != 0 ){
  97. for(var i =0 ; i< $datas.length;++i){
  98. var $data = $datas[i];
  99. var $photos = [];
  100. //获取头像
  101. if($datarecords.length>0){
  102. $photos = getRecords($datarecords,$data.caption);
  103. }
  104. var showDiv= "<div class='listbox listbox-browse clear'><div class='list-browse'><span class='like'>"+$data.count+"</span>"+$data.caption+"</div><div class='like-num'>";
  105. if($photos.length>10){
  106. showDiv += "<div class='triangleR'></div>";
  107. }
  108. if($photos.length>0){
  109. for(var j =0 ; j< $photos.length;++j){
  110. showDiv += "<span class='like-people'><img class='like-h' src='/images/head/"+$photos[j]+"_s.jpg'></span>";
  111. }
  112. }
  113. showDiv += "</div></div>";
  114. $("#researchAreaShow").append(showDiv);
  115. $("#researchAreaList").append("<div class='list'><span class='like'>"+$data.count+"</span><span class='ra'>"+$data.caption+"</span><span class='remove'><img src='images/move.png'></span></div>");
  116. // $("#researchAreaList").append("<div class=\"list\"><span class=\"like\">");
  117. // $("#researchAreaList").append($data.count);
  118. // $("#researchAreaList").append("</span>");
  119. // $("#researchAreaList").append($data.caption);
  120. // $("#researchAreaList").append("<span class=\"remove\"><img src=\"images/move.png\"></span></div>");
  121. $(".like-h").load(function(){
  122. })
  123. .error(function(){
  124. $(this).attr("src","/images/default-photo.jpg");
  125. });
  126. }
  127. }
  128. }
  129. //填充研究方向
  130. var getRecords = function ($researchAreaLogs,caption){
  131. var ret=[];
  132. for(var i = 0 ;i < $researchAreaLogs.length ; i++){
  133. if(caption==$researchAreaLogs[i].caption){
  134. ret.push($researchAreaLogs[i].opreteProfessorId);
  135. }
  136. }
  137. return ret;
  138. }
  139. //获取数据,填充页面
  140. $.get("/ajax/professor/info/" + userid, function($data) {
  141. if ($data.success) {
  142. var $info = $data.data;
  143. if ($info) {
  144. //展示专家的信息
  145. $("#nameS").text($info.name);
  146. $("#titleS").text($info.title);
  147. $("#orgNameS").text($info.orgName);
  148. $("#headImage").attr("src", "/images/head/" + userid + "_l.jpg");
  149. $("#headImage").load(function() {})
  150. .error(function() {
  151. $("#headImage").attr("src", "/images/default-photo.jpg");
  152. });
  153. $("#orgImage").attr("src", "/images/org/" + $info.orgId + ".jpg");
  154. $("#orgImage").load(function() {})
  155. .error(function() {
  156. $("#orgImage").attr("src", "/images/default-icon.jpg");
  157. });
  158. $("#descpS").text($info.descp);
  159. //显示专家信息到保存数据
  160. $("#name").val($info.name);
  161. $("#title").val($info.title);
  162. $("#orgId").val($info.orgId);
  163. $("#orgName").val($info.orgName);
  164. $("#department").val($info.department);
  165. $("#descp").val($info.descp);
  166. //展示专家的学术领域
  167. subjectShow($info.subject);
  168. //研究方向
  169. if ($info.researchAreas) {
  170. researchAreaShow($info.researchAreas, $info.researchAreaLogs);
  171. }
  172. //应用行业
  173. industryShow($info.industry);
  174. //教育背景
  175. if ($info.edus) {
  176. eduBgShow($info.edus);
  177. }
  178. //社会兼职
  179. if ($info.jobs) {
  180. timeJobShow($info.jobs);
  181. }
  182. //项目经历
  183. if ($info.projects) {
  184. projectShow($info.projects)
  185. }
  186. //著作 论文 文章
  187. if ($info.papers) {
  188. paperShow($info.papers);
  189. }
  190. //专利
  191. if ($info.patents) {
  192. patentShow($info.patents);
  193. }
  194. //荣誉及奖项
  195. if ($info.honors) {
  196. honorShow($info.honors);
  197. }
  198. //下滑滚动不覆盖底部
  199. var d;
  200. var t;
  201. /*向下滚动时,header背景变半透明*/
  202. var top5=$(".content-left").height();
  203. var top4 = $("#container").height();
  204. var top3 = $(window).height();
  205. $(document).scroll(function() {
  206. var top1 = $(document).scrollTop();
  207. var top2 = $("#container").height() - top3 + (top3 - 80 - top5) - 10; //变成绝对定位
  208. if (top1 >= 300) {
  209. $(".content-left").css({
  210. "position": "fixed",
  211. "top": "80px"
  212. });
  213. if (top1 >= top2) {
  214. $('.information-content').css("position", "static");
  215. $(".content-left").css("position", "absolute");
  216. $(".content-left").css("top", top4 - top5 - 10 + "px");
  217. } else {
  218. $('.information-content').css("position", "relative");
  219. $(".content-left").css({
  220. "position": "fixed",
  221. "top": "80px"
  222. });
  223. }
  224. } else {
  225. $(".content-left").css({
  226. "position": "static"
  227. });
  228. }
  229. })
  230. //下滑滚动不覆盖底部 结束
  231. }
  232. }
  233. });
  234. }
  235. else {
  236. location.href = "login.html";
  237. return;
  238. }
  239. //搜索框
  240. $("#hsearch").on("click", function() {
  241. var searchContent = $("#hsearchContent").val();
  242. location.href = "search.html?searchContent=" + searchContent;
  243. });
  244. //头像旁保存
  245. $("#saveProfessor").on("click",function () {
  246. var $data = {};
  247. $data.name = $("#name").val();
  248. $data.orgId = $("#orgId").val();
  249. $data.orgName = $("#orgName").val();
  250. $data.title = $("#title").val();
  251. $data.department = $("#department").val();
  252. var userid = $.cookie("userid");
  253. if (userid) {
  254. $data.id = userid;
  255. }
  256. $.ajax({"url" : "../ajax/professor",
  257. "type" : userid ? "PUT" : "POST",
  258. "success" : function(rdata) {
  259. console.log(rdata);
  260. if (rdata.success) {
  261. if (userid) {
  262. location.reload(true);
  263. } else {
  264. location.href = "information.html?id="+ rdata.data;
  265. }
  266. } else {
  267. alert(rdata.msg);
  268. }
  269. },
  270. "data" : userid ? JSON.stringify($data) : $data,
  271. "contentType" : userid ? "application/json": "application/x-www-form-urlencoded",
  272. dataType : "json"
  273. });
  274. })
  275. //上传图像的hover
  276. $(".head-left").hover(function() {
  277. $(".replace-photo").animate({
  278. "bottom": "0px"
  279. });
  280. }, function() {
  281. $(".replace-photo").animate({
  282. "bottom": "-50px"
  283. });
  284. })
  285. //专家信息点击换背景颜色
  286. $(".subsidebar").click(function(){
  287. $(".subsidebar").removeClass("subcolor");
  288. $(".subsidebar").eq($(".subsidebar").index(this)).addClass("subcolor");
  289. });
  290. //拿到点击的顺序,然后求出局文档的距离
  291. $(".subsidebar").click(function(){
  292. var index=$(".subsidebar").index(this);
  293. var offset=$(".introduction").eq(index).offset();
  294. $("body").animate({
  295. scrollTop:offset.top-80 //��body��scrollTop����pos��top����ʵ���˹���
  296. },1000);
  297. });
  298. //科研资源
  299. var $content = $(".sharescrollbox");
  300. var childcount = $content.find(".sharesrc").length;
  301. Carousel(3,3, childcount, $content, $(".resounext"), $(".resouprev"));
  302. function Carousel(inde, num, childcount, obj, next, prev) {
  303. next.click(function() {
  304. if (!obj.is(":animated")) {
  305. if (num < childcount) {
  306. num++;
  307. obj.animate({
  308. left: "-=212px"
  309. }, 600);
  310. }
  311. }
  312. });
  313. prev.click(function() {
  314. if (!obj.is(":animated")) {
  315. if (num > inde) {
  316. num--;
  317. obj.animate({
  318. left: "+=212px"
  319. }, 600);
  320. }
  321. }
  322. });
  323. }
  324. //放在编辑上面添加一个class和减少一个class
  325. $("#container .edit").hover(function(){
  326. $(this).addClass("edit-position-left")
  327. },function(){
  328. $(this).removeClass("edit-position-left")
  329. });
  330. //获取点击那个编辑,及
  331. $("#container .edit").click(function(){
  332. var edit =$(".edit").index(this);
  333. $(".right-title span").eq(edit-1).css("color","#3e3e3e");
  334. $(".infor-browse").eq(edit).hide();
  335. $(".modifybox").eq(edit).show();
  336. //点击取消的操作
  337. $(".close").click(function(){
  338. $(".modifybox").eq(edit).hide();
  339. $(".infor-browse").eq(edit).show();
  340. });
  341. }); //个人简介保存
  342. $("#saveDescp").on("click", function() {
  343. $.ajax({
  344. "url": "../ajax/professor/descp",
  345. "type": "POST",
  346. "data": {
  347. "id": userid,
  348. "descp": $("#descp").val()
  349. },
  350. "contentType": "application/x-www-form-urlencoded",
  351. "success": function($data) {
  352. //debugger;;
  353. if ($data.success) {
  354. $(".infor-browse").css("display","block");
  355. $(".modifybox").css("display","none");
  356. $("#descpS").text($("#descp").val());
  357. } else {
  358. $.MsgBox.Alert("message", $data.msg);
  359. }
  360. }
  361. })
  362. })
  363. //学术领域添加
  364. $("#subjectAdd").click(function(){
  365. var val=$("#subject").val();
  366. $("#subjectList").append("<div class='acad'>"+ val +"<span class='remove'><img src='images/move.png'></span></div>")
  367. })
  368. //学术领域删除
  369. $("#subjectList").on("click",".remove",function(){
  370. $(this).parent().remove();
  371. })
  372. //学术领域保存
  373. $("#subjectSave").on("click",function () {
  374. var subjects = $("#subjectList .acad");
  375. var subjectAll = "";
  376. if(subjects.size()>0){
  377. for (var i = 0; i <subjects.size(); i++) {
  378. subjectAll += subjects[i].innerText;
  379. subjectAll += ',';
  380. };
  381. subjectAll = subjectAll.substring(0, subjectAll.length-1);
  382. }
  383. $.ajax({"url" : "/ajax/professor/subject",
  384. "type" : "POST",
  385. "data" : {"id":userid,"subject":subjectAll},
  386. "contentType" : "application/x-www-form-urlencoded",
  387. "success" : function($data) {
  388. if ($data.success) {
  389. $("#subject").val("");
  390. $("#subjectShow").empty();
  391. $("#subjectList").empty();
  392. $(".modifybox").css("display","none");
  393. $(".infor-browse").css("display","block");
  394. subjectShow(subjectAll);
  395. } else {
  396. $.MsgBox.Alert("message",$data.msg);
  397. }
  398. }
  399. });
  400. })
  401. //应用行业添加
  402. $("#industryAdd").click(function(){
  403. var val=$("#industry").val();
  404. $("#industryList").append("<div class='acad'>"+ val +"<span class='remove'><img src='images/move.png'></span></div>")
  405. })
  406. //应用行业删除
  407. $("#industryList").on("click",".remove",function(){
  408. $(this).parent().remove();
  409. })
  410. //应用行业保存
  411. $("#industrySave").on("click",function () {
  412. var industrys = $("#industryList .acad");
  413. var industryAll = "";
  414. if(industrys.size()>0){
  415. for (var i = 0; i <industrys.size(); i++) {
  416. industryAll += industrys[i].innerText;
  417. industryAll += ',';
  418. };
  419. industryAll = industryAll.substring(0, industryAll.length-1);
  420. }
  421. $.ajax({"url" : "/ajax/professor/industry",
  422. "type" : "POST",
  423. "data" : {"id":userid,"industry":industryAll},
  424. "contentType" : "application/x-www-form-urlencoded",
  425. "success" : function($data) {
  426. if ($data.success) {
  427. $("#industry").val("");
  428. $("#industryShow").empty();
  429. $("#industryList").empty();
  430. $(".modifybox").css("display","none");
  431. $(".infor-browse").css("display","block");
  432. industryShow(industryAll);
  433. } else {
  434. $.MsgBox.Alert("message",$data.msg);
  435. }
  436. }
  437. });
  438. })
  439. //研究方向添加
  440. $("#researchAreaAdd").click(function(){
  441. var researchArea=$("#researchArea").val();
  442. $("#researchAreaList").append("<div class='list'><span class='like'>0</span><span class='ra'>"+ researchArea +"</span><span class='remove'><img src='images/move.png'></span></div>")
  443. });
  444. //研究方向删除
  445. $("#researchAreaList").on("click",".remove",function(){
  446. $(this).parent().remove();
  447. })
  448. //研究方向保存
  449. $("#researchAreaSave").on("click",function () {
  450. //debugger;
  451. var $data=[];
  452. var researchAreas = $("#researchAreaList .list .ra");
  453. if(researchAreas.length>0){
  454. for (var i = 0; i <researchAreas.length; i++) {
  455. var $rd ={};
  456. $rd.professorId = userid;
  457. $rd.caption= researchAreas[i].innerText;
  458. $data[i]=$rd;
  459. }
  460. }
  461. var $has = $data.length>0;
  462. $.ajax({
  463. "url" : $has?"../ajax/researchArea":"../ajax/researchArea/"+userid,
  464. "type" : $has? "PUT" : "DELETE",
  465. "data" : $has ? JSON.stringify($data) : null,
  466. "contentType" : $has ? "application/json": "application/x-www-form-urlencoded",
  467. "success" : function($data) {
  468. if ($data.success)
  469. {
  470. $("#researchArea").val("");
  471. $("#researchAreaList").empty();
  472. $("#researchAreaShow").empty();
  473. $(".modifybox").css("display","none");
  474. $(".infor-browse").css("display","block");
  475. $.get("/ajax/professor/info/" + userid, function($data)
  476. {
  477. if ($data.success)
  478. {
  479. researchAreaShow($data.data.researchAreas, $data.data.researchAreaLogs);
  480. }
  481. });
  482. }
  483. else
  484. {
  485. $.MsgBox.Alert("message",$data.msg);
  486. }
  487. }
  488. });
  489. })
  490. /*Ӧ����ҵ�������*/
  491. $("#other").click(function(){
  492. $(".addbox").toggle();
  493. });
  494. //教育背景最下面的例子
  495. $("#eduBgList").on("mouseover mouseout",".eg",function(even){
  496. if(event.type == "mouseover"){
  497. $(this).find("span").show();
  498. }else if(event.type == "mouseout"){
  499. $(this).find("span").hide();
  500. }
  501. })
  502. //教育背景,对添加的进行编辑
  503. var updateEdu = function(data){
  504. $.get("/ajax/edu/" + data, function($data) {
  505. if ($data.success) {
  506. $info = $data.data;
  507. $("#year").val($info.year ? $info.year : "");
  508. $("#school").val($info.school ? $info.school : "");
  509. $("#college").val($info.college ? $info.college : "");
  510. $("#major").val($info.major ? $info.major : "");
  511. $("#degree").val($info.degree ? $info.degree : "");
  512. $("#eduId").val(data);
  513. if($info.student){
  514. $("input[name='student'][value='1']").attr("checked","checked");
  515. }else{
  516. $("input[name='student'][value='0']").attr("checked","checked");
  517. }
  518. } else {
  519. alert($data.msg);
  520. }
  521. });
  522. }
  523. $("#eduBgList").on("click",".eg .modi",function(){
  524. updateEdu($(this)[0].title);
  525. });
  526. //教育背景,对已经添加的背景删除
  527. var delEdu = function(data){
  528. $.ajax({
  529. "url" : "/ajax/edu/" + data,
  530. "type" : "DELETE",
  531. "success" : function($data) {
  532. if ($data.success) {
  533. } else {
  534. alert($data.msg);
  535. }
  536. }
  537. });
  538. }
  539. $("#eduBgList").on("click",".eg .remove",function(){
  540. $(this).parent().remove();
  541. delEdu($(this)[0].title);
  542. })
  543. //教育背景保存
  544. $("#saveEduBg").on("click",function () {
  545. var $data = {};
  546. var $id = $("#eduId").val();
  547. if ($id){
  548. $data.id = $id;
  549. }
  550. $data.professorId = userid;
  551. $data.year = $("#year").val();
  552. $data.school = $("#school").val();
  553. $data.college = $("#college").val();
  554. $data.major = $("#major").val();
  555. $data.degree = $("#degree").val();
  556. $data.student = false;
  557. $.ajax({
  558. "url" : "/ajax/edu",
  559. "type" : $id ? "PUT" : "POST",
  560. "data" : $id ? JSON.stringify($data) : $data,
  561. "contentType" : $id ? "application/json"
  562. : "application/x-www-form-urlencoded",
  563. "success" : function($data) {
  564. if ($data.success)
  565. {
  566. $("#school").val("");
  567. $("#college").val("");
  568. $("#major").val("");
  569. $("#eduBgShow").empty();
  570. $("#eduBgList").empty();
  571. $(".modifybox").css("display","none");
  572. $(".infor-browse").css("display","block");
  573. $.get("/ajax/professor/info/" + userid, function($data)
  574. {
  575. if ($data.success) {
  576. eduBgShow($data.data.edus);
  577. }
  578. });
  579. }
  580. else
  581. {
  582. $.MsgBox.Alert("message",$data.msg);
  583. }
  584. }
  585. });
  586. })
  587. //社会兼职,mouseover的时候编辑和删除的标签显示
  588. $("#timeJobList").on("mouseover mouseout",".tj",function(even){
  589. if(event.type == "mouseover"){
  590. $(this).find("span").show();
  591. }else if(event.type == "mouseout"){
  592. $(this).find("span").hide();
  593. }
  594. })
  595. //社会兼职,对添加的进行编辑
  596. var updateTimeJob = function(data){
  597. $.get("/ajax/job/" + data, function($data) {
  598. if ($data.success) {
  599. $info = $data.data;
  600. $("#jobId").val(data);
  601. $("#startMonth").val($info.startMonth);
  602. $("#stopMonth").val($info.stopMonth ? $info.stopMonth: "");
  603. $("#jobCompany").val($info.company ? $info.company: "");
  604. $("#jobTitle").val($info.title ? $info.title: "");
  605. } else {
  606. alert($data.msg);
  607. }
  608. });
  609. }
  610. $("#timeJobList").on("click",".tj .modi",function(){
  611. updateTimeJob($(this)[0].title);
  612. })
  613. //社会兼职,对添加的兼职删除
  614. var delTimeJob = function(data){
  615. $.ajax({
  616. "url" : "/ajax/job/" + data,
  617. "type" : "DELETE",
  618. "success" : function($data) {
  619. if ($data.success) {
  620. } else {
  621. alert($data.msg);
  622. }
  623. }
  624. });
  625. }
  626. $("#timeJobList").on("click",".tj .remove",function(){
  627. $(this).parent().remove();
  628. delTimeJob($(this)[0].title);
  629. })
  630. //社会兼职保存
  631. $("#timeJobSave").on("click",function () {
  632. var $data = {};
  633. var $id = $("#jobId").val();
  634. if ($id){
  635. $data.id = $id;
  636. }
  637. $data.professorId = userid;
  638. $data.company = $("#jobCompany").val();
  639. $data.startMonth = $("#startMonth").val();
  640. $data.stopMonth = $("#stopMonth").val();
  641. $data.title = $("#jobTitle").val();
  642. $.ajax({
  643. "url" : "/ajax/job",
  644. "type" : $id ? "PUT" : "POST",
  645. "data" : $id ? JSON.stringify($data) : $data,
  646. "contentType" : $id ? "application/json"
  647. : "application/x-www-form-urlencoded",
  648. "success" : function($data) {
  649. if ($data.success)
  650. {
  651. $("#jobCompany").val("");
  652. $("#jobTitle").val("");
  653. $("#timeJobList").empty();
  654. $("#timeJobShow").empty();
  655. $(".modifybox").css("display","none");
  656. $(".infor-browse").css("display","block");
  657. $.get("/ajax/professor/info/" + userid, function($data)
  658. {
  659. if ($data.success) {
  660. timeJobShow($data.data.jobs);
  661. }
  662. });
  663. }
  664. else
  665. {
  666. $.MsgBox.Alert("message",$data.msg);
  667. }
  668. }
  669. });
  670. })
  671. //项目经历,mouseover的时候编辑和删除的标签显示
  672. $("#projectList").on("mouseover mouseout",".pro",function(even){
  673. if(event.type == "mouseover"){
  674. $(this).find("span").show();
  675. }else if(event.type == "mouseout"){
  676. $(this).find("span").hide();
  677. }
  678. })
  679. //项目经历,对添加的进行编辑
  680. var updateProject = function(data){
  681. $.get("/ajax/project/" + data,function($data) {
  682. if ($data.success) {
  683. $info = $data.data;
  684. $("#projectStartMonth").val($info.startMonth ? $info.startMonth: "");
  685. $("#projectStopMonth").val($info.stopMonth ? $info.stopMonth: "");
  686. $("#projectName").val($info.name ? $info.name: "");
  687. $("#projectDescp").val($info.descp ? $info.descp: "");
  688. $("#projectId").val(data);
  689. } else {
  690. alert($data.msg);
  691. }
  692. });
  693. }
  694. $("#projectList").on("click",".pro .modi",function(){
  695. updateProject($(this)[0].title);
  696. })
  697. //项目经历,对添加的项目删除
  698. var delProject = function(data){
  699. $.ajax({
  700. "url" : "/ajax/project/" + data,
  701. "type" : "DELETE",
  702. "success" : function($data) {
  703. if ($data.success) {
  704. location.reload(true);
  705. } else {
  706. alert($data.msg);
  707. }
  708. }
  709. });
  710. }
  711. $("#projectList").on("click",".pro .remove",function(){
  712. $(this).parent().remove();
  713. delProject($(this)[0].title);
  714. })
  715. //项目经历保存
  716. $("#projectSave").on("click",function () {
  717. var $data = {};
  718. var $id = $("#projectId").val();
  719. if ($id){
  720. $data.id = $id;
  721. }
  722. $data.professorId = userid;
  723. $data.startMonth = $("#projectStartMonth").val();
  724. $data.stopMonth = $("#projectStopMonth").val();
  725. $data.name = $("#projectName").val();
  726. $data.descp = $("#projectDescp").val();
  727. $.ajax({
  728. "url" : "../ajax/project",
  729. "type" : $id ? "PUT" : "POST",
  730. "data" : $id ? JSON.stringify($data) : $data,
  731. "contentType" : $id ? "application/json"
  732. : "application/x-www-form-urlencoded",
  733. "success" : function($data) {
  734. if ($data.success) {
  735. $("#projectName").val("");
  736. $("#projectDescp").val("");
  737. $("#projectList").empty();
  738. $("#projectShow").empty();
  739. $(".modifybox").css("display","none");
  740. $(".infor-browse").css("display","block");
  741. $.get("/ajax/professor/info/" + userid, function($data)
  742. {
  743. if ($data.success) {
  744. projectShow($data.data.projects);
  745. }
  746. });
  747. } else {
  748. $.MsgBox.Alert("message",$data.msg);
  749. }
  750. }
  751. });
  752. })
  753. //著作论文 文章 mouseover的时候编辑和删除的标签显示
  754. $("#paperList").on("mouseover mouseout",".pap",function(even){
  755. if(event.type == "mouseover"){
  756. $(this).find("span").show();
  757. }else if(event.type == "mouseout"){
  758. $(this).find("span").hide();
  759. }
  760. })
  761. //著作论文 文章 ,对添加的进行编辑
  762. var updatePaper = function(data){
  763. $.get("/ajax/paper/" + data, function($data) {
  764. if ($data.success) {
  765. $info = $data.data;
  766. $("#paperYear").val($info.year ? $info.year : "");
  767. $("#paperName").val($info.name ? $info.name : "");
  768. $("#paperUrl").val($info.url ? $info.url : "");
  769. $("#paperDescp").val($info.descp ? $info.descp : "");
  770. $("#paperId").val(data);
  771. } else {
  772. alert($data.msg);
  773. }
  774. });
  775. }
  776. $("#paperList").on("click",".pap .modi",function(){
  777. updatePaper($(this)[0].title);
  778. })
  779. //著作论文 文章 ,对添加的论文删除
  780. var delPaper = function(data){
  781. $.ajax({
  782. "url" : "../ajax/paper/" + data,
  783. "type" : "DELETE",
  784. "success" : function($data) {
  785. if ($data.success) {
  786. } else {
  787. alert($data.msg);
  788. }
  789. }
  790. });
  791. }
  792. $("#paperList").on("click",".pap .remove",function(){
  793. $(this).parent().remove();
  794. delPaper($(this)[0].title);
  795. })
  796. //著作 论文 文章 保存
  797. $("#paperSave").on("click",function () {
  798. var $data = {};
  799. var $id = $("#paperId").val();
  800. if ($id){
  801. $data.id = $id;
  802. }
  803. $data.professorId = userid;
  804. $data.year = $("#paperYear").val();
  805. $data.name = $("#paperName").val();
  806. $data.descp = $("#paperDescp").val();
  807. $data.url = $("#paperUrl").val();
  808. $.ajax({
  809. "url" : "../ajax/paper",
  810. "type" : $id ? "PUT" : "POST",
  811. "data" : $id ? JSON.stringify($data) : $data,
  812. "contentType" : $id ? "application/json"
  813. : "application/x-www-form-urlencoded",
  814. "success" : function($data) {
  815. if ($data.success) {
  816. $("#paperName").val("");
  817. $("#paperDescp").val("");
  818. $("#paperUrl").val("");
  819. $("#paperList").empty();
  820. $("#paperShow").empty();
  821. $(".modifybox").css("display","none");
  822. $(".infor-browse").css("display","block");
  823. $.get("/ajax/professor/info/" + userid, function($data)
  824. {
  825. if ($data.success) {
  826. paperShow($data.data.papers);
  827. }
  828. });
  829. } else {
  830. $.MsgBox.Alert("message",$data.msg);
  831. }
  832. }
  833. });
  834. });
  835. //专利,mouseover的时候编辑和删除的标签显示
  836. $("#patentList").on("mouseover mouseout",".pat",function(even){
  837. if(event.type == "mouseover"){
  838. $(this).find("span").show();
  839. }else if(event.type == "mouseout"){
  840. $(this).find("span").hide();
  841. }
  842. })
  843. //专利 ,对添加的进行编辑
  844. var updatePatent = function(data){
  845. $.get("/ajax/patent/" + data, function($data) {
  846. if ($data.success) {
  847. $info = $data.data;
  848. $("#patentYear").val($info.year ? $info.year : "");
  849. $("#patentName").val($info.name ? $info.name : "");
  850. $("#patentUrl").val($info.url ? $info.url : "");
  851. $("#patentDescp").val($info.descp ? $info.descp : "");
  852. $("#patentId").val(data);
  853. } else {
  854. alert($data.msg);
  855. }
  856. });
  857. }
  858. $("#patentList").on("click",".pat .modi",function(){
  859. updatePatent($(this)[0].title);
  860. })
  861. //专利 ,对添加的专利删除
  862. var delPatent = function(data){
  863. $.ajax({
  864. "url" : "/ajax/patent/" + data,
  865. "type" : "DELETE",
  866. "success" : function($data) {
  867. if ($data.success) {
  868. } else {
  869. alert($data.msg);
  870. }
  871. }
  872. });
  873. }
  874. $("#patentList").on("click",".pat .remove",function(){
  875. $(this).parent().remove();
  876. delPatent($(this)[0].title);
  877. })
  878. //专利保存
  879. $("#patentSave").on("click",function () {
  880. var $data = {};
  881. var $id = $("#patentId").val();
  882. if ($id){
  883. $data.id = $id;
  884. }
  885. $data.professorId = userid;
  886. $data.year = $("#patentYear").val();
  887. $data.name = $("#patentName").val();
  888. $data.descp = $("#patentDescp").val();
  889. $data.url = $("#patentUrl").val();
  890. $.ajax({
  891. "url" : "../ajax/patent",
  892. "type" : $id ? "PUT" : "POST",
  893. "data" : $id ? JSON.stringify($data) : $data,
  894. "contentType" : $id ? "application/json"
  895. : "application/x-www-form-urlencoded",
  896. "success" : function($data) {
  897. if ($data.success) {
  898. $("#patentName").val("");
  899. $("#patentUrl").val("");
  900. $("#patentDescp").val("");
  901. $("#patentList").empty();
  902. $("#patentShow").empty();
  903. $(".modifybox").css("display","none");
  904. $(".infor-browse").css("display","block");
  905. $.get("/ajax/professor/info/" + userid, function($data)
  906. {
  907. if ($data.success) {
  908. patentShow($data.data.patents);
  909. }
  910. });
  911. } else {
  912. $.MsgBox.Alert("message",$data.msg);
  913. }
  914. }
  915. });
  916. })
  917. //荣誉及奖项,mouseover的时候编辑和删除的标签显示
  918. $("#honorList").on("mouseover mouseout",".hon",function(even){
  919. if(event.type == "mouseover"){
  920. $(this).find("span").show();
  921. }else if(event.type == "mouseout"){
  922. $(this).find("span").hide();
  923. }
  924. })
  925. //荣誉及奖项 ,对添加的进行编辑
  926. var updateHonor = function(data){
  927. $.get("/ajax/honor/" + data, function($data) {
  928. if ($data.success) {
  929. $info = $data.data;
  930. $("#honorYear").val($info.year ? $info.year : "");
  931. $("#honorName").val($info.name ? $info.name : "");
  932. $("#honorDescp").val($info.descp ? $info.descp : "");
  933. $("#honorId").val(data);
  934. } else {
  935. alert($data.msg);
  936. }
  937. });
  938. }
  939. $("#honorList").on("click",".hon .modi",function(){
  940. updateHonor($(this)[0].title);
  941. })
  942. //荣誉及奖项 ,对添加的专利删除
  943. var delHonor = function(data){
  944. $.ajax({
  945. "url" : "/ajax/honor/" + data,
  946. "type" : "DELETE",
  947. "success" : function($data) {
  948. if ($data.success) {
  949. } else {
  950. alert($data.msg);
  951. }
  952. }
  953. });
  954. }
  955. $("#honorList").on("click",".hon .remove",function(){
  956. $(this).parent().remove();
  957. delHonor($(this)[0].title);
  958. })
  959. function getProfessorData(){
  960. $.get("/ajax/professor/info/" + userid, function($data) {
  961. if ($data.success) {
  962. console.log($data)
  963. }
  964. });
  965. }
  966. getProfessorData()
  967. //荣誉及奖项保存
  968. $("#honorSave").on("click",function () {
  969. var $data = {};
  970. var $id = $("#honorId").val();
  971. if ($id){
  972. $data.id = $id;
  973. }
  974. $data.professorId = userid;
  975. $data.year = $("#honorYear").val();
  976. $data.name = $("#honorName").val();
  977. $data.descp = $("#honorDescp").val();
  978. $.ajax({
  979. "url" : "../ajax/honor",
  980. "type" : $id ? "PUT" : "POST",
  981. "data" : $id ? JSON.stringify($data) : $data,
  982. "contentType" : $id ? "application/json"
  983. : "application/x-www-form-urlencoded",
  984. "success" : function($data) {
  985. if ($data.success)
  986. {
  987. $("#honorName").val("");
  988. $("#honorList").empty();
  989. $("#honorShow").empty();
  990. $(".modifybox").css("display","none");
  991. $(".infor-browse").css("display","block");
  992. $.get("/ajax/professor/info/" + userid, function($data)
  993. {
  994. if ($data.success) {
  995. honorShow($data.data.honors);
  996. }
  997. });
  998. }
  999. else
  1000. {
  1001. $.MsgBox.Alert("message",$data.msg);
  1002. }
  1003. }
  1004. });
  1005. })
  1006. //科研资源
  1007. $.ajax({
  1008. "url":"/ajax/resource/qapro",
  1009. "type":"get",
  1010. "data":{"professorId":userid},
  1011. "async": true,
  1012. "success":function(data){
  1013. //console.log(data);
  1014. if(data.data.length==0){
  1015. $("#infor-browse").css("display","none");
  1016. $(".resoubtn").css("display","none");
  1017. }
  1018. if(data.data.length > 0 && data.data.length <= 3){
  1019. $("#infor-browse").css("display","block");
  1020. $(".resoubtn").css("display","none");
  1021. }
  1022. var add="";
  1023. if(data.success)
  1024. {console.log(data);
  1025. for(var i=0;i<data.data.length;i++){
  1026. add='<div class="sharesrc">'
  1027. add+='<div class="shareshow">'
  1028. add+='<a href=""><img src="/images/resource/'+data.data[i].resourceId+'.jpg" width="100%" height="100%" class="resouImage"></a>'
  1029. add+='<div class="shareopeart"></div>'
  1030. add+='</div>'
  1031. add+='<p>资源名称:<span class="presou">'+ data.data[i].resourceName+'</span></p>'
  1032. if(data.data[i].descp==undefined){
  1033. data.data[i].descp="";
  1034. }
  1035. add+='<p class="briefinfor">简介:'+data.data[i].descp+'</p>'
  1036. add+='</div>'
  1037. $(".sharescrollbox").append(add);
  1038. $(".resouImage").load(function(){})
  1039. .error(function(){
  1040. $(this).attr("src","/images/default-resource.jpg");
  1041. });
  1042. add="";
  1043. }
  1044. //资源轮播
  1045. var $content = $(".sharescrollbox");
  1046. var childcount = $content.find(".sharesrc").length;
  1047. Carousel(3,3, childcount, $content, $(".resounext"), $(".resouprev"));
  1048. function Carousel(inde, num, childcount, obj, next, prev) {
  1049. next.click(function() {
  1050. if (!obj.is(":animated")) {
  1051. if (num < childcount) {
  1052. num++;
  1053. obj.animate({
  1054. left: "-=212px"
  1055. }, 600);
  1056. }
  1057. }
  1058. });
  1059. prev.click(function() {
  1060. if (!obj.is(":animated")) {
  1061. if (num > inde) {
  1062. num--;
  1063. obj.animate({
  1064. left: "+=212px"
  1065. }, 600);
  1066. }
  1067. }
  1068. });
  1069. }
  1070. }
  1071. else
  1072. {
  1073. $.MsgBox.Alert("消息","系统异常!");
  1074. }
  1075. },
  1076. "error":function(){$.MsgBox.Alert('message','failddd')}
  1077. });
  1078. $("#enterwork").on("click",function(){
  1079. location.href="workspaces.html?"+userid;
  1080. })
  1081. //到至今选中复选框的操作
  1082. /*$(".present").click(function(){
  1083. var date = $(".present").index(this);
  1084. $(".datebox").eq(date).find(".ago").remove();
  1085. $(".datebox").eq(date).css("width","326px");
  1086. })*/
  1087. $(".present").change(function(){
  1088. if($(".present").is(":checked"))
  1089. {
  1090. $(this).parent().parent().find('.ago').hide();
  1091. $(this).parent().parent().find('.inputno').hide();
  1092. }else{
  1093. $(this).parent().parent().find('.ago').show();
  1094. $(this).parent().parent().find('.inputno').show();
  1095. }
  1096. })
  1097. /*ģ��Selectѡ���*/
  1098. $(".input_select").click(function(){
  1099. var ul = $(this).next();
  1100. if(ul.css("display")=="none"){
  1101. ul.slideDown("fast");
  1102. }else{
  1103. ul.slideUp("fast");
  1104. }
  1105. });
  1106. $(".divselect ul li a").click(function(){
  1107. var txt = $(this).text();
  1108. $(".divselect .input_select").val(txt);
  1109. var value = $(this).attr("rel");
  1110. $(".divselect ul").hide();
  1111. });
  1112. $("#aclick").on("click",function(){
  1113. exit();
  1114. });
  1115. })
  1116. function exit(){
  1117. $.cookie('userid', null);
  1118. $.cookie('userAuth', null);
  1119. location.href="login.html"
  1120. }
  1121. //获取数据填充页面
  1122. /*����*/