portal html css js resource

information.js 57KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450
  1. $(function() {
  2. loginStatus(); //判断个人是否登录
  3. //1获取数据
  4. var authSD, osty, opName, orgName,osyp,ofl=false;
  5. var userid = $.cookie("userid");
  6. if(userid) {
  7. //获取数据,填充页面
  8. getInfo(userid);
  9. } else {
  10. location.href = "login.html";
  11. return;
  12. }
  13. $("#downResume").attr("href","/pdf/professor?id="+userid+"&_dl=1");
  14. function getInfo(InfoId) {
  15. $.get("/ajax/professor/editInfo/" + InfoId, function($data) {
  16. if($data.success) {
  17. var $info = $data.data;
  18. authSD = $info.orgAuth;
  19. if($info) {
  20. //展示专家的信息
  21. if($info.hasHeadImage) {
  22. $("#proHead").css("background-image", "url(/images/head/" + $info.id + "_l.jpg)");
  23. }
  24. $("#proName").text($info.name);
  25. var oStyS = autho($info.authType, $info.orgAuth, $info.authStatus);
  26. osyp=oStyS.sty
  27. if(oStyS.sty == "e") {
  28. osty = "e";
  29. $("#name").replaceWith('<input type="text" class="frmcontype" placeholder="请填写您的姓名" id="name" value="' + $info.name + '">')
  30. opName = $info.name;
  31. }
  32. $("#proAuth").addClass(oStyS.sty);
  33. $("#proAuth").attr("title", oStyS.title);
  34. if($info.address) {
  35. $("#proAddress").html($info.address);
  36. }
  37. var proOther = "";
  38. if($info.orgName) {
  39. orgName = $info.orgName;
  40. if($info.department) {
  41. if($info.office) {
  42. proOther = $info.orgName + "," + $info.department + "," + $info.office
  43. } else {
  44. proOther = $info.orgName + "," + $info.department
  45. }
  46. } else {
  47. if($info.office) {
  48. proOther = $info.orgName + "," + $info.office
  49. } else {
  50. proOther = $info.orgName
  51. }
  52. }
  53. } else {
  54. if($info.department) {
  55. if($info.office) {
  56. proOther = $info.department + "," + $info.office
  57. } else {
  58. proOther = $info.department
  59. }
  60. } else {
  61. if($info.office) {
  62. proOther = $info.office
  63. }
  64. }
  65. }
  66. $("#proOther").text(proOther);
  67. var llqtitle = $info.name + "-" + proOther.replace(/,/gi, "-") + "-科袖网"; //修改浏览器title信息
  68. if($info.title) {
  69. $("#proTit").html($info.title + "<span style='margin-right:10px;'></span>");
  70. llqtitle = $info.name + "-" + $info.title + "-" + proOther.replace(/,/gi, "-") + "-科袖网";
  71. }
  72. document.title = llqtitle;
  73. if($info.email) {
  74. $("#mail").text("联系邮箱:" + $info.email);
  75. $("#moileMail").val($info.email);
  76. }
  77. if($info.phone) {
  78. $("#phone").text("联系电话:" + $info.phone);
  79. $("#mobilePhone").val($info.phone);
  80. }
  81. $("#descpS").text($info.descp);
  82. //编辑显示专家信息到保存数据
  83. $("#name").text($info.name);
  84. $("#title").val($info.title);
  85. $("#orgName").val($info.orgName);
  86. $("#department").val($info.department);
  87. $("#officeRevise").val($info.office);
  88. //省
  89. if(!$info.province) {
  90. $("#Province .mr_show").text("请选择省/直辖市");
  91. } else {
  92. $("#Province .mr_show").text($info.province);
  93. }
  94. //市
  95. if(!$info.address) {
  96. $("#City .mr_show").text("请选择城市");
  97. } else {
  98. $("#City .mr_show").text($info.address);
  99. }
  100. //省份城市颜色
  101. if($("#oprovince").text() == "请选择省/直辖市") {
  102. $("#oprovince").removeClass("mr_select");
  103. } else {
  104. $("#oprovince").addClass("mr_select");
  105. }
  106. if($("#ocity").text() == "请选择城市") {
  107. $("#ocity").removeClass("mr_select");
  108. } else {
  109. $("#ocity").addClass("mr_select");
  110. }
  111. $("#descp").val($info.descp);
  112. $("#descp").siblings().find("em").text($("#descp").val().length);
  113. if($info.subject) {
  114. subjectShow($info.subject);
  115. }
  116. //研究方向
  117. if($info.researchAreas.length) {
  118. researchAreaShow($info.researchAreas, $info.editResearchAreaLogs);
  119. }
  120. //展示专家的行业
  121. if($info.industry) {
  122. industryShow($info.industry);
  123. }
  124. //教育背景
  125. if($info.edus) {
  126. eduBgShow($info.edus);
  127. }
  128. //社会兼职
  129. if($info.jobs) {
  130. timeJobShow($info.jobs);
  131. }
  132. //项目经历
  133. if($info.projects) {
  134. projectShow($info.projects)
  135. }
  136. //荣誉及奖项
  137. if($info.honors) {
  138. honorShow($info.honors);
  139. }
  140. //yearAdd();
  141. $(".StopMonth").next(".mr_calendar_ym").find(".mr_year li:first-child").before('<li class="ymli">至今</li>');
  142. $("#eduUl").find(".full_year li:first-child").before('<li class="ymli">至今</li>');
  143. //month();
  144. }
  145. }
  146. });
  147. }
  148. hotKey(".oinput"); //
  149. //////////////////基本信息增删改查相关开始//////////////
  150. //头像旁保存
  151. $("#saveProfessor").on("click", function() {
  152. var Str1 = trim($("#title").val()); //职称
  153. var Str2 = trim($("#officeRevise").val()); //职位
  154. var Str3 = trim($("#orgName").val()); //所在机构
  155. var Str4 = trim($("#department").val()); //所在部门
  156. if(osty=="e") {
  157. if($("#name").val().trim()=='') {
  158. $.MsgBox.Alert("提示", "姓名不能为空");
  159. return;
  160. }else if($("#name").val().trim().length>10) {
  161. $.MsgBox.Alert("提示", "姓名不得超过10个字");
  162. return;
  163. }
  164. }
  165. if(Str1.length > 20) {
  166. $.MsgBox.Alert("提示", "职称不得超过20个字");
  167. return;
  168. }
  169. if(Str2.length > 20) {
  170. $.MsgBox.Alert("提示", "职位不得超过20个字");
  171. return;
  172. }
  173. if(Str3.length > 50) {
  174. $.MsgBox.Alert("提示", "所在机构不得超过50个字");
  175. return;
  176. }
  177. if(Str4.length > 20) {
  178. $.MsgBox.Alert("提示", "所在部门不得超过20个字");
  179. return;
  180. }
  181. var loginName = $("#mobilePhone").val();
  182. if(trim(loginName)) {
  183. if(loginName.length > 50) {
  184. $.MsgBox.Alert('提示', '联系电话不得超过50个字');
  185. return;
  186. }
  187. }
  188. var mail = $("#moileMail").val();
  189. if(mail.trim()) {
  190. if(mail.trim().indexOf("@") == -1) {
  191. $.MsgBox.Alert('提示', '联系邮箱格式有误,请检查后重新填写');
  192. return;
  193. }
  194. }
  195. console.log(orgName);
  196. console.log($("#orgName").val())
  197. if(orgName != $("#orgName").val()) {
  198. if(authSD == 1) {
  199. $.MsgBox.Confirm("提示", "您修改了所在机构,认证员工身份将失效,为企业发布的需求也将自动关闭,确定修改 ?", function() {
  200. ofl=true
  201. setTimeout(function() {
  202. if(osty == "e") {
  203. if($("#name").val() != opName) {
  204. $.MsgBox.Confirm("提示", "您修改了姓名,您的专利和论文将自动取消关联,确定修改?", personUpdata);
  205. }
  206. }else{
  207. personUpdata();
  208. }
  209. }, 100)
  210. });
  211. } else {
  212. $.MsgBox.Confirm("提示", "您修改了所在机构,为该机构发布的需求将自动关闭,确定修改?", function() {
  213. setTimeout(function() {
  214. if(osty == "e") {
  215. if($("#name").val() != opName) {
  216. $.MsgBox.Confirm("提示", "您修改了姓名,您的专利和论文将自动取消关联,确定修改?", personUpdata);
  217. }else {
  218. personUpdata();
  219. }
  220. }else{
  221. personUpdata();
  222. }
  223. }, 100)
  224. });
  225. }
  226. } else {
  227. if(osty == "e") {
  228. if($("#name").val() != opName) {
  229. $.MsgBox.Confirm("提示", "您修改了姓名,您的专利和论文将自动取消关联,确定修改?", personUpdata);
  230. }else{
  231. personUpdata();
  232. }
  233. }else{
  234. personUpdata();
  235. }
  236. }
  237. });
  238. function personUpdata() {
  239. var $data = {};
  240. $data.name = (osty == "e") ? $("#name").val() : $("#name").text();
  241. $data.orgName = $("#orgName").val();
  242. $data.title = $("#title").val();
  243. $data.department = $("#department").val();
  244. $data.office = $("#officeRevise").val();
  245. $data.phone = $("#mobilePhone").val();
  246. $data.email = $("#moileMail").val();
  247. if($("#Province input[name=cho_Province]").val() != "请选择省/直辖市") {
  248. $data.province = $("#Province input[name=cho_Province]").val(); //省
  249. }
  250. if($("#City input[name=cho_City]").val() != "请选择城市") {
  251. $data.address = $("#City input[name=cho_City]").val(); //市
  252. }
  253. var userid = $.cookie("userid");
  254. if(userid) {
  255. $data.id = userid;
  256. }
  257. $.ajax({
  258. "url": "../ajax/professor",
  259. "type": userid ? "PUT" : "POST",
  260. "success": function(rdata) {
  261. if(rdata.success) {
  262. if(userid) {
  263. $.get("/ajax/professor/info/" + userid, function($data) {
  264. if($data.success) {
  265. var $info = $data.data;
  266. if(osyp=="authicon-staff-ok") {
  267. if(ofl) {
  268. $("#proAuth")[0].className="authiconNew e";
  269. $("#proAuth").attr("title","")
  270. }
  271. }
  272. $("#proName").text($info.name);
  273. authSD = $info.orgAuth;
  274. opName = $info.name;
  275. if($info) {
  276. //展示专家的信息
  277. $(".modifybox").css("display", "none");
  278. $(".coninfocon").css("display", "block");
  279. if($info.phone) {
  280. $("#phone").text("联系电话:" + $info.phone);
  281. $("#mobilePhone").val($info.phone);
  282. } else {
  283. $("#phone").text("");
  284. $("#mobilePhone").val("");
  285. }
  286. if($info.email) {
  287. $("#mail").text("联系邮箱:" + $info.email);
  288. $("#moileMail").val($info.email);
  289. } else {
  290. $("#mail").text("");
  291. $("#moileMail").val("");
  292. }
  293. if($info.title) {
  294. $("#proTit").html($info.title + "<span style='margin-right:10px;'></span>");
  295. } else {
  296. $("#proTit").html("")
  297. }
  298. if($info.address) {
  299. $("#proAddress").html($info.address + "<span style='margin-right:10px;'></span>");
  300. } else {
  301. $("#proAddress").html('')
  302. }
  303. var proOther = "";
  304. if($info.orgName) {
  305. if($info.department) {
  306. if($info.office) {
  307. proOther = $info.orgName + "," + $info.department + "," + $info.office
  308. } else {
  309. proOther = $info.orgName + "," + $info.department
  310. }
  311. } else {
  312. if($info.office) {
  313. proOther = $info.orgName + "," + $info.office
  314. } else {
  315. proOther = $info.orgName
  316. }
  317. }
  318. } else {
  319. if($info.department) {
  320. if($info.office) {
  321. proOther = $info.department + "," + $info.office
  322. } else {
  323. proOther = $info.department
  324. }
  325. } else {
  326. if($info.office) {
  327. proOther = $info.office
  328. }
  329. }
  330. }
  331. $("#proOther").text(proOther);
  332. //显示专家信息到保存数据
  333. if(osty == "e") {
  334. $("#name").val($info.name);
  335. } else {
  336. $("#name").text($info.name);
  337. }
  338. $("#title").val($info.title);
  339. orgName = $info.orgName
  340. $("#orgName").val($info.orgName);
  341. $("#department").val($info.department);
  342. $("#officeRevise").val($info.office);
  343. //省
  344. if(!$info.province) {
  345. $("#Province .mr_show").text("请选择省/直辖市");
  346. } else {
  347. $("#Province .mr_show").text("");
  348. $("#Province input[name=cho_Province]").val($info.province);
  349. $("#Province .mr_show").text($info.province);
  350. }
  351. //市
  352. if(!$info.address) {
  353. $("#City .mr_show").text("请选择城市");
  354. } else {
  355. $("#City .mr_show").text("");
  356. $("#City input[name=cho_City]").val($info.address);
  357. $("#City .mr_show").text($info.address);
  358. }
  359. //省份城市颜色
  360. if($("#oprovince").text() == "请选择省/直辖市") {
  361. $("#oprovince").removeClass("mr_select");
  362. } else {
  363. $("#oprovince").addClass("mr_select");
  364. }
  365. if($("#ocity").text() == "请选择城市") {
  366. $("#ocity").removeClass("mr_select");
  367. } else {
  368. $("#ocity").addClass("mr_select");
  369. }
  370. }
  371. }
  372. })
  373. } else {
  374. location.href = "information.html?id=" + rdata.data;
  375. }
  376. } else {
  377. $.MsgBox.Alert("提示", rdata.msg);
  378. }
  379. },
  380. "data": userid ? JSON.stringify($data) : $data,
  381. "contentType": userid ? "application/json" : "application/x-www-form-urlencoded",
  382. dataType: "json"
  383. });
  384. }
  385. //////////////////基本信息增删改查相关结束//////////////
  386. //////////////////个人简介增删改查相关开始//////////////
  387. limitObj("#descp", 500)
  388. //个人简介保存
  389. $("#saveDescp").on("click", function() {
  390. $.ajax({
  391. "url": "../ajax/professor/descp",
  392. "type": "POST",
  393. "data": {
  394. "id": userid,
  395. "descp": $("#descp").val()
  396. },
  397. "contentType": "application/x-www-form-urlencoded",
  398. "success": function($data) {
  399. //debugger;;
  400. if($data.success) {
  401. $(".coninfocon").css("display", "block");
  402. $(".modifybox").css("display", "none");
  403. $("#descpS").text($("#descp").val());
  404. } else {
  405. $.MsgBox.Alert("提示", $data.msg);
  406. }
  407. }
  408. })
  409. })
  410. //////////////////个人简介增删改查相关结束//////////////
  411. //////////////////学术领域增删改查相关开始//////////////
  412. //填充学术领域
  413. var subjectShow = function(data) {
  414. $("#subjectShow").html("");
  415. $("#subjectList").html("");
  416. if(data != undefined && data.length != 0) {
  417. var subs = new Array();
  418. if(data.indexOf(',')) {
  419. subs = data.split(',');
  420. } else {
  421. subs[0] = data;
  422. }
  423. if(subs.length > 0) {
  424. for(var i = 0; i < subs.length; i++) {
  425. $("#subjectList").append('<li>' + subs[i] + '<div class="closeThis"></div></li>');
  426. $("#subjectShow").append('<li>' + subs[i] + '</li>');
  427. };
  428. }
  429. if($("#subjectShow").find("li").length >= 20) {
  430. $("#subjectList").parents(".keyResult").siblings("div.col-w-12").hide();
  431. }
  432. }
  433. }
  434. //学术领域删除
  435. $("#subjectList").on("click", ".closeThis", function() {
  436. $(this).parent().remove();
  437. var liNum = $("#subjectList").find("li").length;
  438. if(liNum < 20) {
  439. $("#subjectList").parents(".keyResult").siblings("div.col-w-12").show();
  440. }
  441. })
  442. //学术领域保存
  443. $("#subjectSave").on("click", function() {
  444. $(this).parents(".modifybox").hide();
  445. var subjects = $("#subjectList li");
  446. var subjectAll = "";
  447. if(subjects.size() > 0) {
  448. for(var i = 0; i < subjects.size(); i++) {
  449. subjectAll += subjects[i].innerText;
  450. subjectAll += ',';
  451. };
  452. subjectAll = subjectAll.substring(0, subjectAll.length - 1);
  453. }
  454. $.ajax({
  455. "url": "/ajax/professor/subject",
  456. "type": "POST",
  457. "data": {
  458. "id": userid,
  459. "subject": subjectAll
  460. },
  461. "contentType": "application/x-www-form-urlencoded",
  462. "success": function($data) {
  463. if($data.success) {
  464. $("#subject").val("");
  465. $("#subjectShow").empty();
  466. $("#subjectList").empty();
  467. $(".coninfocon").css("display", "block");
  468. subjectShow(subjectAll);
  469. } else {
  470. $.MsgBox.Alert("提示", $data.msg);
  471. }
  472. }
  473. });
  474. })
  475. //////////////////学术领域增删改查相关结束//////////////
  476. //////////////////应用行业增删改查相关开始//////////////
  477. //填充应用行业
  478. var industryShow = function(data) {
  479. $("#industryList").html("");
  480. $("#industryShow").html("");
  481. if(data != undefined && data.length != 0) {
  482. var subs = new Array();
  483. if(data.indexOf(',')) {
  484. subs = data.split(',');
  485. } else {
  486. subs[0] = data;
  487. }
  488. if(subs.length > 0) {
  489. for(var i = 0; i < subs.length; i++) {
  490. $("#industryList").append('<li>' + subs[i] + '<div class="closeThis"></div></li>');
  491. $("#industryShow").append("<li><div class='h4tit'>" + subs[i] + "</div></li>");
  492. };
  493. }
  494. if($("#industryShow").find("li").length >= 20) {
  495. $("#industryList").parents(".keyResult").siblings("div.col-w-12").hide();
  496. }
  497. }
  498. }
  499. //应用行业删除
  500. $("#industryList").on("click", ".closeThis", function() {
  501. $(this).parent().remove();
  502. var liNum = $("#industryList").find("li").length;
  503. if(liNum < 20) {
  504. $("#industryList").parents(".keyResult").siblings("div.col-w-12").show();
  505. }
  506. })
  507. //应用行业保存
  508. $("#industrySave").on("click", function() {
  509. $(this).parents(".modifybox").hide();
  510. var industrys = $("#industryList li");
  511. var industryAll = "";
  512. if(industrys.size() > 0) {
  513. for(var i = 0; i < industrys.size(); i++) {
  514. industryAll += industrys[i].innerText;
  515. industryAll += ',';
  516. };
  517. industryAll = industryAll.substring(0, industryAll.length - 1);
  518. }
  519. $.ajax({
  520. "url": "/ajax/professor/industry",
  521. "type": "POST",
  522. "data": {
  523. "id": userid,
  524. "industry": industryAll
  525. },
  526. "contentType": "application/x-www-form-urlencoded",
  527. "success": function($data) {
  528. if($data.success) {
  529. $("#industry").val("");
  530. $("#industryShow").empty();
  531. $("#industryList").empty();
  532. $(".indu").css("display", "none");
  533. $(".coninfocon").css("display", "block");
  534. industryShow(industryAll);
  535. } else {
  536. $.MsgBox.Alert("提示", $data.msg);
  537. }
  538. }
  539. });
  540. })
  541. //////////////////应用行业增删改查相关结束//////////////
  542. //////////////////研究方向增删改查相关开始//////////////
  543. //填充研究方向
  544. var researchAreaShow = function($datas, $datarecords) {
  545. $("#researchAreaShow").html("");
  546. $("#researchAreaList").html("");
  547. if($datas != undefined && $datas.length != 0) {
  548. $("#researchAreaList").empty();
  549. for(var i = 0; i < $datas.length; ++i) {
  550. var $data = $datas[i];
  551. var $photos = [];
  552. //获取头像
  553. if($datarecords.length > 0) {
  554. $photos = getRecords($datarecords, $data.caption);
  555. }
  556. var showDiv = '<li><div class="favorBox" caption="' + $data.caption + '"><span class="like">' + $data.count + '</span>' + $data.caption + '</div><div class="favorCount" caption="' + $data.caption + '">';
  557. if($photos.length < 6) {
  558. for(var j = 0; j < $photos.length; ++j) {
  559. if($photos[j].img) {
  560. showDiv += '<span class="like-people" style="background-image: url(../images/head/' + $photos[j].id + '_s.jpg);"></span>';
  561. } else {
  562. showDiv += '<span class="like-people" style="background-image: url(../images/default-photo.jpg);"></span>';
  563. }
  564. }
  565. } else {
  566. for(var j = $photos.length - 5; j < $photos.length; ++j) {
  567. if($photos[j].img) {
  568. showDiv += '<span class="like-people" style="background-image: url(../images/head/' + $photos[j].id + '_s.jpg);"></span>';
  569. } else {
  570. showDiv += '<span class="like-people" style="background-image: url(../images/default-photo.jpg);"></span>';
  571. }
  572. }
  573. showDiv += '<span class="like-people like-more"></span>';
  574. }
  575. showDiv += "</div></li>";
  576. $("#researchAreaShow").append(showDiv);
  577. $("#researchAreaList").append("<li class='yjlist'><div><span class='like'>" + $data.count + "</span><span class='ra'>" + $data.caption + "</span><span class='closeThis'></span></div></li>");
  578. }
  579. if($("#researchAreaShow").find("li").length >= 10) {
  580. $("#researchAreaList").parents(".keyResult").siblings("div.col-w-12").hide();
  581. }
  582. }
  583. }
  584. //判断点赞的用户是否有头像
  585. var getRecords = function($researchAreaLogs, caption) {
  586. var ret = [];
  587. var t = 0;
  588. for(var i = 0; i < $researchAreaLogs.length; i++) {
  589. if(caption == $researchAreaLogs[i].caption) {
  590. ret[t] = {
  591. id: $researchAreaLogs[i].opreteProfessorId,
  592. img: $researchAreaLogs[i].hasHeadImage
  593. }
  594. t++;
  595. }
  596. }
  597. return ret;
  598. }
  599. hotKey(".oinputM", 1);
  600. //研究方向添加
  601. $("#researchAreaAdd").click(function() {
  602. var researchArea = $("#researchArea").val();
  603. if(!researchArea) {
  604. $.MsgBox.Alert("提示", "内容不能为空");
  605. return;
  606. }
  607. if(researchArea.length > 30) {
  608. $.MsgBox.Alert("提示", "研究方向不得超过30个字");
  609. return;
  610. }
  611. var inV = $("#researchAreaList .ra");
  612. for(var i = 0; i < inV.length; i++) {
  613. if(inV[i].innerText == researchArea) {
  614. $.MsgBox.Alert("提示", "不能添加重复内容");
  615. return;
  616. }
  617. }
  618. if(inV.length == 9) {
  619. $("#researchAreaList").parents(".keyResult").siblings("div.col-w-12").hide();
  620. }
  621. $("#researchAreaList").append("<li class='yjlist'><div><span class='like'>0</span><span class='ra'>" + researchArea + "</span><span class='closeThis'></span></div></li>");
  622. $("#researchArea").val("");
  623. });
  624. $("#researchAreaAdd").siblings("input").keypress(function(){
  625. var e = event || window.event;
  626. if(e.keyCode == 13) {
  627. var researchArea = $("#researchArea").val();
  628. if(!researchArea) {
  629. $.MsgBox.Alert("提示", "内容不能为空");
  630. return;
  631. }
  632. if(researchArea.length > 30) {
  633. $.MsgBox.Alert("提示", "研究方向不得超过30个字");
  634. return;
  635. }
  636. var inV = $("#researchAreaList .ra");
  637. for(var i = 0; i < inV.length; i++) {
  638. if(inV[i].innerText == researchArea) {
  639. $.MsgBox.Alert("提示", "不能添加重复内容");
  640. return;
  641. }
  642. }
  643. if(inV.length == 9) {
  644. $("#researchAreaList").parents(".keyResult").siblings("div.col-w-12").hide();
  645. }
  646. $("#researchAreaList").append("<li class='yjlist'><div><span class='like'>0</span><span class='ra'>" + researchArea + "</span><span class='closeThis'></span></div></li>");
  647. $("#researchArea").val("");
  648. }
  649. })
  650. //研究方向删除
  651. $("#researchAreaList").on("click", ".closeThis", function() {
  652. $(this).parents(".yjlist").remove();
  653. var liNum = $("#researchAreaList").find("li").length;
  654. if(liNum < 10) {
  655. $("#researchAreaList").parents(".keyResult").siblings("div.col-w-12").show();
  656. }
  657. })
  658. //研究方向保存
  659. $("#researchAreaSave").on("click", function() {
  660. $(this).parents(".modifybox").hide();
  661. var $data = [];
  662. var researchAreas = $("#researchAreaList .yjlist .ra");
  663. if(researchAreas.length > 0) {
  664. for(var i = 0; i < researchAreas.length; i++) {
  665. var $rd = {};
  666. $rd.professorId = userid;
  667. $rd.caption = researchAreas[i].innerText;
  668. $data[i] = $rd;
  669. }
  670. }
  671. var $has = $data.length > 0;
  672. $.ajax({
  673. "url": $has ? "../ajax/researchArea" : "../ajax/researchArea/" + userid,
  674. "type": $has ? "PUT" : "DELETE",
  675. "data": $has ? JSON.stringify($data) : null,
  676. "contentType": $has ? "application/json" : "application/x-www-form-urlencoded",
  677. "success": function($data) {
  678. if($data.success) {
  679. $.get("/ajax/professor/info/" + userid, function($data) {
  680. if($data.success) {
  681. $("#researchAreaShow").empty("");
  682. $("#researchAreaShow").parents(".coninfocon").show();
  683. $("#researchAreaList").parents(".modifybox").hide();
  684. researchAreaShow($data.data.researchAreas, $data.data.editResearchAreaLogs);
  685. }
  686. });
  687. } else {
  688. $.MsgBox.Alert("提示", $data.msg);
  689. }
  690. }
  691. });
  692. })
  693. //////////////////研究方向增删改查相关结束//////////////
  694. //////////////////教育背景增删改查相关开始//////////////
  695. //填充教育背景
  696. var eduBgShow = function(data) {
  697. $("#eduUl").html("");
  698. eduFil("#eduUl");
  699. if(data.length > 0) {
  700. for(var i = 0; i < data.length; i++) {
  701. var college = "",
  702. major = "",
  703. degree = ""
  704. if(data[i].college) {
  705. college = ' - ' + data[i].college
  706. } else {
  707. data[i].college = "";
  708. }
  709. if(data[i].major) {
  710. major = ' - ' + data[i].major
  711. } else {
  712. data[i].major = "";
  713. }
  714. if(data[i].degree) {
  715. degree = ' - ' + data[i].degree
  716. if(data[i].degree == 0) {
  717. degree = ""
  718. }
  719. } else {
  720. data[i].degree = 0;
  721. }
  722. var timebiye = "";
  723. if(data[i].year) {
  724. if(trim(data[i].year) == "至今") {
  725. timebiye = data[i].year;
  726. } else {
  727. timebiye = data[i].year + '年';
  728. }
  729. } else {
  730. timebiye = "";
  731. data[i].year = "";
  732. }
  733. var string = '<li>'
  734. string += '<div class="showBx"> <div class="h4Font h4tit">'
  735. string += data[i].school + college + major + degree
  736. string += '<small class="h6Font">' + timebiye + '</small><em class="btnClick exitlist">编辑</em></div></div>'
  737. string += '<div class="modifybox"><ul class="cmpFrmList">'
  738. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>学校名称:</span><div class="col-w-10">'
  739. string += '<input type="text" class="frmcontype school" placeholder="请填写就读的学校" value="' + data[i].school + '" /><input type="hidden" class="eduId" value="' + data[i].id + '"></div></li>'
  740. string += '<li><span class="col-w-2 lableSpan">院系名称:</span><div class="col-w-10">'
  741. string += '<input type="text" class="frmcontype college" placeholder="请填写就读的院系" value="' + data[i].college + '" /></div></li>'
  742. string += '<li><span class="col-w-2 lableSpan">专业名称:</span><div class="col-w-10">'
  743. string += '<input type="text" class="frmcontype major" placeholder="请填写就读的专业" value="' + data[i].major + '" /></div></li>'
  744. string += '<li><span class="col-w-2 lableSpan">学位:</span><div class="col-w-5"><em class="mr_sj"></em>'
  745. string += '<select class="frmcontype mr_btn" onchange="seleCo(this)">'
  746. string += '<option value="0">请选择获得的学位</option>'
  747. string += '<option value="博士">博士</option>'
  748. string += '<option value="硕士">硕士</option>'
  749. string += '<option value="学士">学士</option>'
  750. string += '<option value="大专">大专</option>'
  751. string += '<option value="其他">其他</option>'
  752. string += '</select></div></li>'
  753. string += '<li><span class="col-w-2 lableSpan">毕业时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  754. string += '<div class="col-w-5" style="position:relative"><em class="mr_sj"></em><input type="text" class="date-btn frmcontype year" flag="1" placeholder="请选择毕业时间" value="' + data[i].year + '" readonly />'
  755. string += '<div class="mr_calendar_ym clearfix"><ul class="full_year"></ul></div></div>'
  756. string += '</form></div></li>'
  757. string += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  758. string += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  759. string += '<button type="button" class="frmcontype btnModel btnCancel cancelList">取消</button>'
  760. string += '<button type="button" class="frmcontype btnModel fontLink">删除本条</button></div></li>'
  761. string += '</ul></div><li>';
  762. var $string = $(string)
  763. $("#eduUl").append($string);
  764. if(data[i].degree != 0 || data[i].degree != "") {
  765. $string.find(".mr_btn").css("color", "#666");
  766. }
  767. $string.find(".mr_btn").val(data[i].degree);
  768. yearAdd();
  769. month();
  770. $(".full_year li:first-child").before('<li class="yearli">至今</li>');
  771. }
  772. }
  773. }
  774. //教育背景填充函数
  775. var eduFil = function(select) {
  776. var string = '<li class="listnone1" style="display:none;"><div class="modifybox" style="display:block;"><ul class="cmpFrmList">'
  777. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>学校名称:</span><div class="col-w-10">'
  778. string += '<input type="text" class="frmcontype school" placeholder="请填写就读的学校" /><input type="hidden" class="eduId"></div></li>'
  779. string += '<li><span class="col-w-2 lableSpan">院系名称:</span><div class="col-w-10">'
  780. string += '<input type="text" class="frmcontype college" placeholder="请填写就读的院系" /></div></li>'
  781. string += '<li><span class="col-w-2 lableSpan">专业名称:</span><div class="col-w-10">'
  782. string += '<input type="text" class="frmcontype major" placeholder="请填写就读的专业" /></div></li>'
  783. string += '<li><span class="col-w-2 lableSpan">学位:</span><div class="col-w-5"><em class="mr_sj"></em>'
  784. string += '<select class="frmcontype mr_btn" onchange="seleCo(this)">'
  785. string += '<option value="0">请选择获得的学位</option>'
  786. string += '<option value="博士">博士</option>'
  787. string += '<option value="硕士">硕士</option>'
  788. string += '<option value="学士">学士</option>'
  789. string += '<option value="大专">大专</option>'
  790. string += '<option value="其他">其他</option>'
  791. string += '</select></div></li>'
  792. string += '<li><span class="col-w-2 lableSpan">毕业时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  793. string += '<div class="col-w-5" style="position:relative"><em class="mr_sj"></em><input type="text" class="date-btn frmcontype year" flag="1" placeholder="请选择毕业时间" readonly/>'
  794. string += '<div class="mr_calendar_ym clearfix"><ul class="full_year"></ul></div></div>'
  795. string += '</form></div></li>'
  796. string += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  797. string += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  798. string += '<button type="button" class="frmcontype btnModel btnCancel cancelO">取消</button></div></li>'
  799. string += '</ul></div><li>';
  800. $("" + select + "").prepend(string);
  801. }
  802. var eduThis = ""
  803. $("#eduUl").on("click", ".fontLink", function() { //编辑各个列表中的删除
  804. eduThis = $(this).parents(".modifybox").find(".eduId").val();
  805. $.MsgBox.Confirm("提示", "确认删除该教育背景?", delEdu);
  806. });
  807. //教育背景,对已经添加的背景删除
  808. var delEdu = function() {
  809. $.ajax({
  810. "url": "/ajax/edu/" + eduThis,
  811. "type": "DELETE",
  812. "success": function($data) {
  813. if($data.success) {
  814. $.get("/ajax/professor/info/" + userid, function($data) {
  815. if($data.success) {
  816. $("#eduUl").empty("");
  817. eduBgShow($data.data.edus);
  818. }
  819. });
  820. } else {
  821. $.MsgBox.Alert("提示", $data.msg);
  822. }
  823. }
  824. });
  825. }
  826. //教育背景保存
  827. $("#eduUl").on("click", ".saveGo", function() {
  828. var length = trim($(this).parents(".modifybox").find(".school").val());
  829. var length2 = trim($(this).parents(".modifybox").find(".college").val());
  830. var length3 = trim($(this).parents(".modifybox").find(".major").val());
  831. if(!length) {
  832. $.MsgBox.Alert("提示", "请填写学校名称");
  833. return;
  834. }
  835. if(length.length > 50) {
  836. $.MsgBox.Alert("提示", "学校名称不得超过50个字");
  837. return;
  838. }
  839. if(length2.length > 20) {
  840. $.MsgBox.Alert("提示", "院系名称不得超过20个字");
  841. return;
  842. }
  843. if(length3.length > 20) {
  844. $.MsgBox.Alert("提示", "专业名称不得超过20个字");
  845. return;
  846. }
  847. var $data = {};
  848. var $id = $(this).parents(".modifybox").find(".eduId").val();
  849. if($id) {
  850. $data.id = $id;
  851. }
  852. $data.professorId = userid;
  853. $data.year = $(this).parents(".modifybox").find(".year").val();
  854. $data.school = $(this).parents(".modifybox").find(".school").val();
  855. $data.college = $(this).parents(".modifybox").find(".college").val();
  856. $data.major = $(this).parents(".modifybox").find(".major").val();
  857. if($(this).parents(".modifybox").find(".mr_btn").val() != 0) {
  858. $data.degree = $(this).parents(".modifybox").find(".mr_btn").val();
  859. }
  860. $.ajax({
  861. "url": "/ajax/edu",
  862. "type": $id ? "PUT" : "POST",
  863. "data": $id ? JSON.stringify($data) : $data,
  864. "contentType": $id ? "application/json" : "application/x-www-form-urlencoded",
  865. "success": function($data) {
  866. if($data.success) {
  867. $.get("/ajax/professor/info/" + userid, function($data) {
  868. if($data.success) {
  869. $("#eduUl").empty("");
  870. eduBgShow($data.data.edus);
  871. }
  872. });
  873. } else {
  874. $.MsgBox.Alert("提示", $data.msg);
  875. }
  876. }
  877. });
  878. })
  879. //////////////////教育背景增删改查相关结束///////////////
  880. //////////////////工作经历增删改查相关开始///////////////
  881. //填充工作经历
  882. var timeJobShow = function(data) {
  883. $("#timeJobShow").html("");
  884. jobFil("#timeJobShow");
  885. if(data.length > 0) {
  886. for(var i = 0; i < data.length; i++) {
  887. var sDate = "",
  888. sDateV = "";
  889. var eDate = "",
  890. eDateV = "";
  891. if(data[i].department) {
  892. var dep = " - " + data[i].department;
  893. var depart = data[i].department;
  894. } else {
  895. var dep = "";
  896. var depart = ""
  897. }
  898. if(data[i].startMonth) {
  899. sDate = data[i].startMonth.substr(0, 4) + "年" + data[i].startMonth.substr(4, 6) + "月";
  900. sDateV = data[i].startMonth.substr(0, 4) + "-" + data[i].startMonth.substr(4, 6);
  901. if(data[i].stopMonth) {
  902. eDate = data[i].stopMonth.substr(0, 4) + "年" + data[i].stopMonth.substr(4, 6) + "月";
  903. eDateV = data[i].stopMonth.substr(0, 4) + "-" + data[i].stopMonth.substr(4, 6);
  904. } else {
  905. eDate = "至今";
  906. eDateV = "至今";
  907. }
  908. }
  909. var string = '<li>'
  910. string += ' <div class="showBx"><div class="h4Font h4tit">' + data[i].company + dep + ' - ' + data[i].title + '<small class="h6Font">';
  911. string += sDate;
  912. if(eDate) string += (" - " + eDate);
  913. string += '</small><em class="btnClick exitlist">编辑</em></div></div>';
  914. string += '<div class="modifybox"><ul class="cmpFrmList">'
  915. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>机构名称:</span><div class="col-w-10">'
  916. string += '<input type="text" class="frmcontype jobCompany" placeholder="请填写就职的机构" value="' + data[i].company + '" /><input type="hidden" class="jobId" value="' + data[i].id + '"></div></li>'
  917. string += '<li><span class="col-w-2 lableSpan">所在部门:</span><div class="col-w-10">'
  918. string += '<input type="text" class="frmcontype jobdepartment" placeholder="请填写就职的部门" value="' + depart + '" /></div></li>'
  919. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>职位:</span><div class="col-w-10">'
  920. string += '<input type="text" class="frmcontype jobTitle" placeholder="请填写担任的职位" value="' + data[i].title + '" /></div></li>'
  921. string += '<li><span class="col-w-2 lableSpan">任职时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  922. string += '<div class="col-w-5" style="position:relative"><input type="text" class="date-btn frmcontype StartMonth" flag="2" difference="1" placeholder="请选择起始时间" readonly value="' + sDateV + '" />'
  923. string += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"></ul><ul class="mr_month"></ul></div></div>'
  924. string += '<div class="col-w-1 alignCenter">至</div>'
  925. string += '<div class="col-w-5" style="position:relative"><input type="text" class="date-btn frmcontype StopMonth" flag="2" difference="2" placeholder="请选择结束时间" readonly value="' + eDateV + '" />'
  926. string += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"></ul><ul class="mr_month"></ul></div></div>'
  927. string += '</form></div></li>'
  928. string += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  929. string += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  930. string += '<button type="button" class="frmcontype btnModel btnCancel cancelList">取消</button>'
  931. string += '<button type="button" class="frmcontype btnModel fontLink">删除本条</button></div></li>'
  932. string += '</ul></div><li>';
  933. $("#timeJobShow").append(string);
  934. yearAdd();
  935. month();
  936. }
  937. }
  938. }
  939. var jobFil = function(select) {
  940. var string = '<li class="listnone1" style="display:none;"><div class="modifybox" style="display:block;"><ul class="cmpFrmList">'
  941. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>机构名称:</span><div class="col-w-10">'
  942. string += '<input type="text" class="frmcontype jobCompany" placeholder="请填写就职的机构" /><input type="hidden" class="jobId"></div></li>'
  943. string += '<li><span class="col-w-2 lableSpan">所在部门:</span><div class="col-w-10">'
  944. string += '<input type="text" class="frmcontype jobdepartment" placeholder="请填写就职的部门" /></div></li>'
  945. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>职位:</span><div class="col-w-10">'
  946. string += '<input type="text" class="frmcontype jobTitle" placeholder="请填写担任的职位" /></div></li>'
  947. string += '<li><span class="col-w-2 lableSpan">任职时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  948. string += '<div class="col-w-5" style="position:relative"><input type="text" class="date-btn frmcontype StartMonth" flag="2" difference="1" placeholder="请选择起始时间" readonly />'
  949. string += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"></ul><ul class="mr_month"></ul></div></div>'
  950. string += '<div class="col-w-1 alignCenter">至</div>'
  951. string += '<div class="col-w-5" style="position:relative"><input type="text" class="date-btn frmcontype StopMonth" flag="2" difference="2" placeholder="请选择结束时间" readonly />'
  952. string += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"> </ul><ul class="mr_month"></ul></div></div>'
  953. string += '</form></div></li>'
  954. string += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  955. string += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  956. string += '<button type="button" class="frmcontype btnModel btnCancel cancelO">取消</button></div></li>'
  957. string += '</ul></div><li>';
  958. $("" + select + "").prepend(string);
  959. }
  960. var jobThis = ""
  961. $("#timeJobShow").on("click", ".fontLink", function() { //编辑各个列表中的删除
  962. jobThis = $(this).parents(".modifybox").find(".jobId").val();
  963. $.MsgBox.Confirm("提示", "确认删除该工作经历?", delTimeJob);
  964. });
  965. //社会兼职,对添加的兼职删除
  966. var delTimeJob = function() {
  967. $.ajax({
  968. "url": "/ajax/job/" + jobThis,
  969. "type": "DELETE",
  970. "success": function($data) {
  971. if($data.success) {
  972. $.get("/ajax/professor/info/" + userid, function($data) {
  973. if($data.success) {
  974. $("#timeJobShow").empty("");
  975. timeJobShow($data.data.jobs);
  976. }
  977. });
  978. } else {
  979. $.MsgBox.Alert("提示", $data.msg);
  980. }
  981. }
  982. });
  983. }
  984. //社会兼职保存
  985. $("#timeJobShow").on("click", ".saveGo", function() {
  986. var length1 = trim($(this).parents(".modifybox").find(".jobCompany").val());
  987. var length2 = trim($(this).parents(".modifybox").find(".jobTitle").val());
  988. var length3 = trim($(this).parents(".modifybox").find(".StartMonth").val());
  989. var length4 = trim($(this).parents(".modifybox").find(".StopMonth").val());
  990. var length5 = trim($(this).parents(".modifybox").find(".jobdepartment").val());
  991. if(length1.length > 50) {
  992. $.MsgBox.Alert("提示", "机构名称不得超过50个字");
  993. return;
  994. }
  995. if(length5.length > 20) {
  996. $.MsgBox.Alert("提示", "部门名称不得超过20个字");
  997. return;
  998. }
  999. if(!length3 && length4) {
  1000. $.MsgBox.Alert("提示", "请选择工作的开始时间");
  1001. return;
  1002. } else if(length3 && !length4) {
  1003. $.MsgBox.Alert("提示", "请选择工作的结束时间");
  1004. return;
  1005. }
  1006. if(!length1 && length2) {
  1007. $.MsgBox.Alert("提示", "请填写机构名称");
  1008. return;
  1009. } else if(length1 && !length2) {
  1010. $.MsgBox.Alert("提示", "请填写职位");
  1011. return;
  1012. } else if(!length1 && !length2) {
  1013. $.MsgBox.Alert("提示", "请填写机构名称和职位");
  1014. return;
  1015. }
  1016. var $data = {};
  1017. var $id = $(this).parents(".modifybox").find(".jobId").val();
  1018. if($id) {
  1019. $data.id = $id;
  1020. }
  1021. $data.professorId = userid;
  1022. $data.company = $(this).parents(".modifybox").find(".jobCompany").val();
  1023. $data.department = $(this).parents(".modifybox").find(".jobdepartment").val();
  1024. var s = $(this).parents(".modifybox").find(".StartMonth").val();
  1025. var st = $(this).parents(".modifybox").find(".StopMonth").val();
  1026. if(s) {
  1027. $data.startMonth = s.substr(0, 4) + s.substr(5, 6);
  1028. }
  1029. if(st) {
  1030. if(st == "至今") {} else {
  1031. $data.stopMonth = st.substr(0, 4) + st.substr(5, 6);
  1032. }
  1033. }
  1034. $data.title = $(this).parents(".modifybox").find(".jobTitle").val();
  1035. $.ajax({
  1036. "url": "/ajax/job",
  1037. "type": $id ? "PUT" : "POST",
  1038. "data": $id ? JSON.stringify($data) : $data,
  1039. "contentType": $id ? "application/json" : "application/x-www-form-urlencoded",
  1040. beforeSend: function() {
  1041. //console.log(this.data)
  1042. },
  1043. "success": function($data) {
  1044. if($data.success) {
  1045. $.get("/ajax/professor/info/" + userid, function($data) {
  1046. if($data.success) {
  1047. $("#timeJobShow").empty("");
  1048. timeJobShow($data.data.jobs);
  1049. }
  1050. });
  1051. } else {
  1052. $.MsgBox.Alert("提示", $data.msg);
  1053. }
  1054. }
  1055. });
  1056. })
  1057. //////////////////工作经历增删改查相关结束///////////////
  1058. //////////////////项目经历增删改查相关开始///////////////
  1059. //填充项目经历
  1060. var projectShow = function(data) {
  1061. $("#projectShow").html("");
  1062. projectFil("#projectShow")
  1063. if(data.length > 0) {
  1064. for(var i = 0; i < data.length; i++) {
  1065. if(!data[i].descp) {
  1066. data[i].descp = "";
  1067. }
  1068. var sDate = "",
  1069. sDateV = "";
  1070. var eDate = "",
  1071. eDateV = "";
  1072. if(data[i].startMonth) {
  1073. sDate = data[i].startMonth.substr(0, 4) + "年" + data[i].startMonth.substr(4, 6) + "月";
  1074. sDateV = data[i].startMonth.substr(0, 4) + "-" + data[i].startMonth.substr(4, 6);
  1075. if(data[i].stopMonth) {
  1076. eDate = data[i].stopMonth.substr(0, 4) + "年" + data[i].stopMonth.substr(4, 6) + "月";
  1077. eDateV = data[i].stopMonth.substr(0, 4) + "-" + data[i].stopMonth.substr(4, 6);
  1078. } else {
  1079. eDate = "至今";
  1080. eDateV = "至今";
  1081. }
  1082. }
  1083. var stringHtml = '<li>';
  1084. stringHtml += '<div class="showBx"><div class="h4Font h4tit">' + data[i].name + '<small class="h6Font">'
  1085. stringHtml += sDate;
  1086. if(eDate) stringHtml += (" - " + eDate);
  1087. stringHtml += '</small><em class="btnClick exitlist">编辑</em></div>';
  1088. stringHtml += '<div class="h5Font">' + data[i].descp + '</div>';
  1089. stringHtml += '</div>';
  1090. stringHtml += '<div class="modifybox"><ul class="cmpFrmList">'
  1091. stringHtml += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>项目名称:</span><div class="col-w-10">'
  1092. stringHtml += '<input type="text" class="frmcontype projectName" placeholder="请填写项目名称" value="' + data[i].name + '" /><input type="hidden" class="projectId" value="' + data[i].id + '"></div></li>'
  1093. stringHtml += '<li><span class="col-w-2 lableSpan">项目时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  1094. stringHtml += '<div class="col-w-5" style="position:relative"><input type="text" class="date-btn frmcontype project StartMonth" flag="2" difference="1" placeholder="请选择起始时间" readonly value="' + sDateV + '" />'
  1095. stringHtml += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"></ul><ul class="mr_month"></ul></div></div>'
  1096. stringHtml += '<div class="col-w-1 alignCenter">至</div>'
  1097. stringHtml += '<div class="col-w-5" style="position:relative"><input type="text" class="date-btn frmcontype project StopMonth" flag="2" difference="2" placeholder="请选择结束时间" readonly value="' + eDateV + '" />'
  1098. stringHtml += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"> </ul><ul class="mr_month"></ul></div></div>'
  1099. stringHtml += '</form></div></li>'
  1100. stringHtml += '<li><span class="col-w-2 lableSpan">项目描述:</span><div class="col-w-10">'
  1101. stringHtml += '<div class="msgContbox"><textarea class="frmcontype msgCont projectDescp" placeholder="请填写项目描述">' + data[i].descp + '</textarea><span class="msgconNum"><em class="limitNum">' + data[i].descp.length + '</em>/200</span></div></div></li>'
  1102. stringHtml += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  1103. stringHtml += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  1104. stringHtml += '<button type="button" class="frmcontype btnModel btnCancel cancelList">取消</button>'
  1105. stringHtml += '<button type="button" class="frmcontype btnModel fontLink">删除本条</button></div></li>'
  1106. var $stringHtml = $(stringHtml);
  1107. $("#projectShow").append($stringHtml);
  1108. limitObj($stringHtml.find(".projectDescp"), 200)
  1109. yearAdd();
  1110. month();
  1111. }
  1112. }
  1113. }
  1114. //项目经历添加填充
  1115. var projectFil = function(select) {
  1116. var string = '<li class="listnone1" style="display:none;"><div class="modifybox" style="display:block;"><ul class="cmpFrmList">'
  1117. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>项目名称:</span><div class="col-w-10">'
  1118. string += '<input type="text" class="frmcontype projectName" placeholder="请填写项目名称" /><input type="hidden" class="projectId"></div></li>'
  1119. string += '<li><span class="col-w-2 lableSpan">项目时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  1120. string += '<div class="col-w-5" style="position:relative"><input type="text" class="date-btn frmcontype project StartMonth" flag="2" difference="1" readonly placeholder="请选择起始时间" />'
  1121. string += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"></ul><ul class="mr_month"></ul></div></div>'
  1122. string += '<div class="col-w-1 alignCenter">至</div>'
  1123. string += '<div class="col-w-5" style="position:relative"><input type="text" class="date-btn frmcontype project StopMonth" flag="2" difference="2" readonly placeholder="请选择结束时间" />'
  1124. string += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"> </ul><ul class="mr_month"></ul></div></div>'
  1125. string += '</form></div></li>'
  1126. string += '<li><span class="col-w-2 lableSpan">项目描述:</span><div class="col-w-10">'
  1127. string += '<div class="msgContbox"><textarea class="frmcontype msgCont projectDescp" placeholder="请填写项目描述"></textarea><span class="msgconNum"><em class="limitNum">0</em>/200</span></div></div></li>'
  1128. string += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  1129. string += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  1130. string += '<button type="button" class="frmcontype btnModel btnCancel cancelO">取消</button></div></li>'
  1131. string += '</ul></div><li>';
  1132. var $ostr = $(string);
  1133. $("" + select + "").prepend($ostr);
  1134. limitObj($ostr.find(".projectDescp"), 200)
  1135. }
  1136. var projectThis = ""
  1137. $("#projectShow").on("click", ".fontLink", function() { //编辑各个列表中的删除
  1138. projectThis = $(this).parents(".modifybox").find(".projectId").val();
  1139. $.MsgBox.Confirm("提示", "确认删除该项目经历?", delProject);
  1140. });
  1141. //项目经历,对添加的项目删除
  1142. var delProject = function() {
  1143. $.ajax({
  1144. "url": "/ajax/project/" + projectThis,
  1145. "type": "DELETE",
  1146. "success": function($data) {
  1147. if($data.success) {
  1148. $.get("/ajax/professor/info/" + userid, function($data) {
  1149. if($data.success) {
  1150. $("#projectShow").empty("");
  1151. projectShow($data.data.projects);
  1152. }
  1153. });
  1154. } else {
  1155. $.MsgBox.Alert("提示", $data.msg);
  1156. }
  1157. }
  1158. });
  1159. }
  1160. //项目经历保存
  1161. $("#projectShow").on("click", ".saveGo", function() {
  1162. var length = trim($(this).parents(".modifybox").find(".projectName").val());
  1163. var length1 = trim($(this).parents(".modifybox").find(".StartMonth").val());
  1164. var length2 = trim($(this).parents(".modifybox").find(".StopMonth").val());
  1165. var lengthDescp = trim($(this).parents(".modifybox").find(".projectDescp").val());
  1166. // if(lengthDescp.length>200){$.MsgBox.Alert("提示", "项目描述不得超过200个字");return;}
  1167. if(!length) {
  1168. $.MsgBox.Alert("提示", "请填写项目名称");
  1169. return;
  1170. }
  1171. if(length.length > 50) {
  1172. $.MsgBox.Alert("提示", "项目名称不得超过50个字");
  1173. return;
  1174. }
  1175. if(length1 && !length2) {
  1176. $.MsgBox.Alert("提示", "没有选结束时间");
  1177. return;
  1178. }
  1179. if(!length1 && length2) {
  1180. $.MsgBox.Alert("提示", "没有选开始时间");
  1181. return;
  1182. }
  1183. var $data = {};
  1184. var $id = $(this).parents(".modifybox").find(".projectId").val();
  1185. if($id) {
  1186. $data.id = $id;
  1187. }
  1188. $data.professorId = userid;
  1189. var s = $(this).parents(".modifybox").find(".StartMonth").val();
  1190. var st = $(this).parents(".modifybox").find(".StopMonth").val();
  1191. if(s) {
  1192. $data.startMonth = s.substr(0, 4) + s.substr(5, 6);
  1193. }
  1194. if(st) {
  1195. if(st == "至今") {} else {
  1196. $data.stopMonth = st.substr(0, 4) + st.substr(5, 6);
  1197. }
  1198. }
  1199. $data.name = $(this).parents(".modifybox").find(".projectName").val()
  1200. $data.descp = $(this).parents(".modifybox").find(".projectDescp").val()
  1201. $.ajax({
  1202. "url": "../ajax/project",
  1203. "type": $id ? "PUT" : "POST",
  1204. "data": $id ? JSON.stringify($data) : $data,
  1205. "contentType": $id ? "application/json" : "application/x-www-form-urlencoded",
  1206. "success": function($data) {
  1207. if($data.success) {
  1208. $.get("/ajax/professor/info/" + userid, function($data) {
  1209. if($data.success) {
  1210. $("#projectShow").empty("");
  1211. projectShow($data.data.projects);
  1212. // yearAdd();
  1213. // month();
  1214. }
  1215. });
  1216. } else {
  1217. $.MsgBox.Alert("提示", $data.msg);
  1218. }
  1219. }
  1220. });
  1221. })
  1222. //////////////////项目经历增删改查相关结束///////////////
  1223. //////////////////荣誉奖项增删改查相关开始///////////////
  1224. var honorShow = function(data) {
  1225. $("#honorShow").html("");
  1226. hounerFil("#honorShow");
  1227. if(data.length > 0) {
  1228. for(var i = 0; i < data.length; i++) {
  1229. var timeho = "";
  1230. if(data[i].year) {
  1231. timeho = data[i].year + '年';
  1232. } else {
  1233. data[i].year = "";
  1234. }
  1235. if(!data[i].descp) {
  1236. data[i].descp = "";
  1237. }
  1238. var stringHtml = '<li>';
  1239. stringHtml += '<div class="showBx"><div class="h4Font h4tit">' + data[i].name + '<small class="h6Font">' + timeho + '</small><em class="btnClick exitlist">编辑</em></div>';
  1240. stringHtml += '<div class="h5Font">' + data[i].descp + '</div>';
  1241. stringHtml += '</div>';
  1242. stringHtml += '<div class="modifybox"><ul class="cmpFrmList">'
  1243. stringHtml += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>奖项名称:</span><div class="col-w-10">'
  1244. stringHtml += '<input type="text" class="frmcontype honorName" placeholder="请填写奖项名称" value="' + data[i].name + '" /><input type="hidden" class="honorId" value="' + data[i].id + '"></div></li>'
  1245. stringHtml += '<li><span class="col-w-2 lableSpan">获奖时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  1246. stringHtml += '<div class="col-w-5" style="position:relative"><input type="text" class="date-btn frmcontype project honorYear" placeholder="请填写奖项时间" readonly flag="1" value="' + data[i].year + '" />'
  1247. stringHtml += '<div class="mr_calendar_ym clearfix"><ul class="full_year"></ul></div></div>'
  1248. stringHtml += '</form></div></li>'
  1249. stringHtml += '<li><span class="col-w-2 lableSpan">获奖描述:</span><div class="col-w-10">'
  1250. stringHtml += '<div class="msgContbox"><textarea class="frmcontype msgCont honorDescp" placeholder="请填写获奖描述">' + data[i].descp + '</textarea><span class="msgconNum"><em class="limitNum">' + data[i].descp.length + '</em>/200</span></div></div></li>'
  1251. stringHtml += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  1252. stringHtml += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  1253. stringHtml += '<button type="button" class="frmcontype btnModel btnCancel cancelList">取消</button>'
  1254. stringHtml += '<button type="button" class="frmcontype btnModel fontLink">删除本条</button></div></li>'
  1255. var $stringHtml = $(stringHtml)
  1256. $("#honorShow").append($stringHtml);
  1257. yearAdd();
  1258. limitObj($stringHtml.find(".honorDescp"), 200)
  1259. }
  1260. }
  1261. }
  1262. var hounerFil = function(select) {
  1263. var string = '<li class="listnone1" style="display:none;"><div class="modifybox" style="display:block;"><ul class="cmpFrmList">'
  1264. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>奖项名称:</span><div class="col-w-10">'
  1265. string += '<input type="text" class="frmcontype honorName" placeholder="请填写奖项名称" /><input type="hidden" class="honorId"></div></li>'
  1266. string += '<li><span class="col-w-2 lableSpan">项目时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  1267. string += '<div class="col-w-5" style="position:relative"><input type="text" class="date-btn frmcontype honorYear" flag="1" readonly placeholder="请选择获奖时间" />'
  1268. string += '<div class="mr_calendar_ym clearfix"><ul class="full_year"></ul></div></div>'
  1269. string += '</form></div></li>'
  1270. string += '<li><span class="col-w-2 lableSpan">获奖描述:</span><div class="col-w-10">'
  1271. string += '<div class="msgContbox"><textarea class="frmcontype msgCont honorDescp" placeholder="请填写获奖描述"></textarea><span class="msgconNum"><em class="limitNum">0</em>/200</span></div></div></li>'
  1272. string += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  1273. string += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  1274. string += '<button type="button" class="frmcontype btnModel btnCancel cancelO">取消</button></div></li>'
  1275. string += '</ul></div><li>';
  1276. var $ostr = $(string);
  1277. $("" + select + "").prepend($ostr);
  1278. limitObj($ostr.find(".honorDescp"), 200)
  1279. }
  1280. var honorThis = ""
  1281. $("#honorShow").on("click", ".fontLink", function() {
  1282. honorThis = $(this).parents(".modifybox").find(".honorId").val();
  1283. $.MsgBox.Confirm("提示", "确认删除该荣誉奖项?", delHonor);
  1284. });
  1285. var delHonor = function() { //荣誉及奖项 ,对添加的专利删除
  1286. $.ajax({
  1287. "url": "/ajax/honor/" + honorThis,
  1288. "type": "DELETE",
  1289. "success": function($data) {
  1290. if($data.success) {
  1291. $.get("/ajax/professor/info/" + userid, function($data) {
  1292. if($data.success) {
  1293. $("#honorShow").empty("");
  1294. honorShow($data.data.honors);
  1295. }
  1296. });
  1297. } else {
  1298. $.MsgBox.Alert("提示", $data.msg);
  1299. }
  1300. }
  1301. });
  1302. }
  1303. //荣誉及奖项保存
  1304. $("#honorShow").on("click", ".saveGo", function() {
  1305. var length = trim($(this).parents(".modifybox").find(".honorName").val());
  1306. var lengthDescp = trim($(this).parents(".modifybox").find(".honorDescp").val());
  1307. if(!length) {
  1308. $.MsgBox.Alert("提示", "请填写奖项名称");
  1309. return;
  1310. }
  1311. if(length.length > 50) {
  1312. $.MsgBox.Alert("提示", "奖项名称不得超过50个字");
  1313. return;
  1314. }
  1315. // if(lengthDescp.length>200){$.MsgBox.Alert("提示", "获奖描述不得超过200个字");return;}
  1316. var $data = {};
  1317. var $id = $(this).parents(".modifybox").find(".honorId").val();
  1318. if($id) {
  1319. $data.id = $id;
  1320. }
  1321. $data.professorId = userid;
  1322. $data.year = $(this).parents(".modifybox").find(".honorYear").val();
  1323. $data.name = $(this).parents(".modifybox").find(".honorName").val();
  1324. $data.descp = $(this).parents(".modifybox").find(".honorDescp").val();
  1325. console.log($data.descp);
  1326. $.ajax({
  1327. "url": "../ajax/honor",
  1328. "type": $id ? "PUT" : "POST",
  1329. "data": $id ? JSON.stringify($data) : $data,
  1330. "contentType": $id ? "application/json" : "application/x-www-form-urlencoded",
  1331. "success": function($data) {
  1332. if($data.success) {
  1333. $.get("/ajax/professor/info/" + userid, function($data) {
  1334. if($data.success) {
  1335. $("#honorShow").empty("");
  1336. honorShow($data.data.honors);
  1337. //yearAdd();
  1338. }
  1339. });
  1340. } else {
  1341. $.MsgBox.Alert("提示", $data.msg);
  1342. }
  1343. }
  1344. });
  1345. })
  1346. //////////////////荣誉奖项增删改查相关结束///////////////
  1347. //////////////////相关操作按钮///////////////
  1348. //用户基本信息编辑
  1349. $(".headconBox").on("click", ".proEdit", function() {
  1350. $(this).parents(".coninfocon").siblings(".modifybox").show();
  1351. $(this).parents(".coninfocon").hide();
  1352. $(".head-left").css("top", "100px");
  1353. //点击取消的操作
  1354. $(".btnCancel").click(function() {
  1355. $(".head-left").css("top", "");
  1356. $(this).parents(".modifybox").siblings(".coninfocon").show();
  1357. $(this).parents(".modifybox").hide();
  1358. getInfo(userid);
  1359. });
  1360. });
  1361. //获取点击那个编辑
  1362. $(".leftconBox").on("click", ".edit", function() {
  1363. $(this).parents(".coninfobox").find(".modifybox").show();
  1364. $(this).parents(".coninfobox").find(".coninfocon").hide();
  1365. //点击取消的操作
  1366. $(".btnCancel").click(function() {
  1367. $(this).parents(".coninfobox").find(".modifybox").hide();
  1368. $(this).parents(".coninfobox").find(".coninfocon").show();
  1369. getInfo(userid);
  1370. });
  1371. });
  1372. $(".addedit").on("click", function() { //点击添加按钮
  1373. $(this).parents(".coninfobox").find(".listnone1").toggle(100);
  1374. $(this).parents(".coninfobox").find(".showBx").show();
  1375. $(this).parents(".coninfobox").find(".showBx + .modifybox").hide();
  1376. $(this).parents(".coninfobox").find(".listnone1").find(".frmcontype").val("");
  1377. $(this).parents(".coninfobox").find(".listnone1").find(".mr_btn").val("0");
  1378. });
  1379. $(".coninfobox").on("click", ".cancelO", function() { //添加模块的取消
  1380. $(this).parents(".listnone1").toggle(100);
  1381. });
  1382. $(".coninfobox").on("click", ".exitlist", function() { //编辑列表模块
  1383. $(this).parents(".showBx").hide().siblings(".modifybox").show();
  1384. $(this).parents("li").siblings().find(".showBx").show().siblings(".modifybox").hide();
  1385. });
  1386. $(".coninfobox").on("click", ".cancelList", function() { //编辑各个列表中的取消
  1387. $(this).parents(".modifybox").hide();
  1388. $(this).parents(".modifybox").siblings(".showBx").show();
  1389. getInfo(userid);
  1390. });
  1391. //点击查看自己的主页
  1392. $("#showMyself").click(function() {
  1393. $(this).attr("href", "userInforShow.html?professorId=" + userid);
  1394. })
  1395. function trim(str) { //删除左右两端的空格   
  1396. return str.replace(/(^\s*)|(\s*$)/g, "");
  1397. }
  1398. })