portal html css js resource

information.js 56KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423
  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. //研究方向删除
  625. $("#researchAreaList").on("click", ".closeThis", function() {
  626. $(this).parent().remove();
  627. var liNum = $("#researchAreaList").find("li").length;
  628. if(liNum < 10) {
  629. $("#researchAreaList").parents(".keyResult").siblings("div.col-w-12").show();
  630. }
  631. })
  632. //研究方向保存
  633. $("#researchAreaSave").on("click", function() {
  634. $(this).parents(".modifybox").hide();
  635. var $data = [];
  636. var researchAreas = $("#researchAreaList .yjlist .ra");
  637. if(researchAreas.length > 0) {
  638. for(var i = 0; i < researchAreas.length; i++) {
  639. var $rd = {};
  640. $rd.professorId = userid;
  641. $rd.caption = researchAreas[i].innerText;
  642. $data[i] = $rd;
  643. }
  644. }
  645. var $has = $data.length > 0;
  646. $.ajax({
  647. "url": $has ? "../ajax/researchArea" : "../ajax/researchArea/" + userid,
  648. "type": $has ? "PUT" : "DELETE",
  649. "data": $has ? JSON.stringify($data) : null,
  650. "contentType": $has ? "application/json" : "application/x-www-form-urlencoded",
  651. "success": function($data) {
  652. if($data.success) {
  653. $.get("/ajax/professor/info/" + userid, function($data) {
  654. if($data.success) {
  655. $("#researchAreaShow").empty("");
  656. $("#researchAreaShow").parents(".coninfocon").show();
  657. $("#researchAreaList").parents(".modifybox").hide();
  658. researchAreaShow($data.data.researchAreas, $data.data.editResearchAreaLogs);
  659. }
  660. });
  661. } else {
  662. $.MsgBox.Alert("提示", $data.msg);
  663. }
  664. }
  665. });
  666. })
  667. //////////////////研究方向增删改查相关结束//////////////
  668. //////////////////教育背景增删改查相关开始//////////////
  669. //填充教育背景
  670. var eduBgShow = function(data) {
  671. $("#eduUl").html("");
  672. eduFil("#eduUl");
  673. if(data.length > 0) {
  674. for(var i = 0; i < data.length; i++) {
  675. var college = "",
  676. major = "",
  677. degree = ""
  678. if(data[i].college) {
  679. college = ' - ' + data[i].college
  680. } else {
  681. data[i].college = "";
  682. }
  683. if(data[i].major) {
  684. major = ' - ' + data[i].major
  685. } else {
  686. data[i].major = "";
  687. }
  688. if(data[i].degree) {
  689. degree = ' - ' + data[i].degree
  690. if(data[i].degree == 0) {
  691. degree = ""
  692. }
  693. } else {
  694. data[i].degree = 0;
  695. }
  696. var timebiye = "";
  697. if(data[i].year) {
  698. if(trim(data[i].year) == "至今") {
  699. timebiye = data[i].year;
  700. } else {
  701. timebiye = data[i].year + '年';
  702. }
  703. } else {
  704. timebiye = "";
  705. data[i].year = "";
  706. }
  707. var string = '<li>'
  708. string += '<div class="showBx"> <div class="h4Font h4tit">'
  709. string += data[i].school + college + major + degree
  710. string += '<small class="h6Font">' + timebiye + '</small><em class="btnClick exitlist">编辑</em></div></div>'
  711. string += '<div class="modifybox"><ul class="cmpFrmList">'
  712. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>学校名称:</span><div class="col-w-10">'
  713. string += '<input type="text" class="frmcontype school" placeholder="请填写就读的学校" value="' + data[i].school + '" /><input type="hidden" class="eduId" value="' + data[i].id + '"></div></li>'
  714. string += '<li><span class="col-w-2 lableSpan">院系名称:</span><div class="col-w-10">'
  715. string += '<input type="text" class="frmcontype college" placeholder="请填写就读的院系" value="' + data[i].college + '" /></div></li>'
  716. string += '<li><span class="col-w-2 lableSpan">专业名称:</span><div class="col-w-10">'
  717. string += '<input type="text" class="frmcontype major" placeholder="请填写就读的专业" value="' + data[i].major + '" /></div></li>'
  718. string += '<li><span class="col-w-2 lableSpan">学位:</span><div class="col-w-5"><em class="mr_sj"></em>'
  719. string += '<select class="frmcontype mr_btn" onchange="seleCo(this)">'
  720. string += '<option value="0">请选择获得的学位</option>'
  721. string += '<option value="博士">博士</option>'
  722. string += '<option value="硕士">硕士</option>'
  723. string += '<option value="学士">学士</option>'
  724. string += '<option value="大专">大专</option>'
  725. string += '<option value="其他">其他</option>'
  726. string += '</select></div></li>'
  727. string += '<li><span class="col-w-2 lableSpan">毕业时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  728. 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 />'
  729. string += '<div class="mr_calendar_ym clearfix"><ul class="full_year"></ul></div></div>'
  730. string += '</form></div></li>'
  731. string += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  732. string += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  733. string += '<button type="button" class="frmcontype btnModel btnCancel cancelList">取消</button>'
  734. string += '<button type="button" class="frmcontype btnModel fontLink">删除本条</button></div></li>'
  735. string += '</ul></div><li>';
  736. var $string = $(string)
  737. $("#eduUl").append($string);
  738. if(data[i].degree != 0 || data[i].degree != "") {
  739. $string.find(".mr_btn").css("color", "#666");
  740. }
  741. $string.find(".mr_btn").val(data[i].degree);
  742. yearAdd();
  743. month();
  744. $(".full_year li:first-child").before('<li class="yearli">至今</li>');
  745. }
  746. }
  747. }
  748. //教育背景填充函数
  749. var eduFil = function(select) {
  750. var string = '<li class="listnone1" style="display:none;"><div class="modifybox" style="display:block;"><ul class="cmpFrmList">'
  751. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>学校名称:</span><div class="col-w-10">'
  752. string += '<input type="text" class="frmcontype school" placeholder="请填写就读的学校" /><input type="hidden" class="eduId"></div></li>'
  753. string += '<li><span class="col-w-2 lableSpan">院系名称:</span><div class="col-w-10">'
  754. string += '<input type="text" class="frmcontype college" placeholder="请填写就读的院系" /></div></li>'
  755. string += '<li><span class="col-w-2 lableSpan">专业名称:</span><div class="col-w-10">'
  756. string += '<input type="text" class="frmcontype major" placeholder="请填写就读的专业" /></div></li>'
  757. string += '<li><span class="col-w-2 lableSpan">学位:</span><div class="col-w-5"><em class="mr_sj"></em>'
  758. string += '<select class="frmcontype mr_btn" onchange="seleCo(this)">'
  759. string += '<option value="0">请选择获得的学位</option>'
  760. string += '<option value="博士">博士</option>'
  761. string += '<option value="硕士">硕士</option>'
  762. string += '<option value="学士">学士</option>'
  763. string += '<option value="大专">大专</option>'
  764. string += '<option value="其他">其他</option>'
  765. string += '</select></div></li>'
  766. string += '<li><span class="col-w-2 lableSpan">毕业时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  767. 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/>'
  768. string += '<div class="mr_calendar_ym clearfix"><ul class="full_year"></ul></div></div>'
  769. string += '</form></div></li>'
  770. string += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  771. string += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  772. string += '<button type="button" class="frmcontype btnModel btnCancel cancelO">取消</button></div></li>'
  773. string += '</ul></div><li>';
  774. $("" + select + "").prepend(string);
  775. }
  776. var eduThis = ""
  777. $("#eduUl").on("click", ".fontLink", function() { //编辑各个列表中的删除
  778. eduThis = $(this).parents(".modifybox").find(".eduId").val();
  779. $.MsgBox.Confirm("提示", "确认删除该教育背景?", delEdu);
  780. });
  781. //教育背景,对已经添加的背景删除
  782. var delEdu = function() {
  783. $.ajax({
  784. "url": "/ajax/edu/" + eduThis,
  785. "type": "DELETE",
  786. "success": function($data) {
  787. if($data.success) {
  788. $.get("/ajax/professor/info/" + userid, function($data) {
  789. if($data.success) {
  790. $("#eduUl").empty("");
  791. eduBgShow($data.data.edus);
  792. }
  793. });
  794. } else {
  795. $.MsgBox.Alert("提示", $data.msg);
  796. }
  797. }
  798. });
  799. }
  800. //教育背景保存
  801. $("#eduUl").on("click", ".saveGo", function() {
  802. var length = trim($(this).parents(".modifybox").find(".school").val());
  803. var length2 = trim($(this).parents(".modifybox").find(".college").val());
  804. var length3 = trim($(this).parents(".modifybox").find(".major").val());
  805. if(!length) {
  806. $.MsgBox.Alert("提示", "请填写学校名称");
  807. return;
  808. }
  809. if(length.length > 50) {
  810. $.MsgBox.Alert("提示", "学校名称不得超过50个字");
  811. return;
  812. }
  813. if(length2.length > 20) {
  814. $.MsgBox.Alert("提示", "院系名称不得超过20个字");
  815. return;
  816. }
  817. if(length3.length > 20) {
  818. $.MsgBox.Alert("提示", "专业名称不得超过20个字");
  819. return;
  820. }
  821. var $data = {};
  822. var $id = $(this).parents(".modifybox").find(".eduId").val();
  823. if($id) {
  824. $data.id = $id;
  825. }
  826. $data.professorId = userid;
  827. $data.year = $(this).parents(".modifybox").find(".year").val();
  828. $data.school = $(this).parents(".modifybox").find(".school").val();
  829. $data.college = $(this).parents(".modifybox").find(".college").val();
  830. $data.major = $(this).parents(".modifybox").find(".major").val();
  831. if($(this).parents(".modifybox").find(".mr_btn").val() != 0) {
  832. $data.degree = $(this).parents(".modifybox").find(".mr_btn").val();
  833. }
  834. $.ajax({
  835. "url": "/ajax/edu",
  836. "type": $id ? "PUT" : "POST",
  837. "data": $id ? JSON.stringify($data) : $data,
  838. "contentType": $id ? "application/json" : "application/x-www-form-urlencoded",
  839. "success": function($data) {
  840. if($data.success) {
  841. $.get("/ajax/professor/info/" + userid, function($data) {
  842. if($data.success) {
  843. $("#eduUl").empty("");
  844. eduBgShow($data.data.edus);
  845. }
  846. });
  847. } else {
  848. $.MsgBox.Alert("提示", $data.msg);
  849. }
  850. }
  851. });
  852. })
  853. //////////////////教育背景增删改查相关结束///////////////
  854. //////////////////工作经历增删改查相关开始///////////////
  855. //填充工作经历
  856. var timeJobShow = function(data) {
  857. $("#timeJobShow").html("");
  858. jobFil("#timeJobShow");
  859. if(data.length > 0) {
  860. for(var i = 0; i < data.length; i++) {
  861. var sDate = "",
  862. sDateV = "";
  863. var eDate = "",
  864. eDateV = "";
  865. if(data[i].department) {
  866. var dep = " - " + data[i].department;
  867. var depart = data[i].department;
  868. } else {
  869. var dep = "";
  870. var depart = ""
  871. }
  872. if(data[i].startMonth) {
  873. sDate = data[i].startMonth.substr(0, 4) + "年" + data[i].startMonth.substr(4, 6) + "月";
  874. sDateV = data[i].startMonth.substr(0, 4) + "-" + data[i].startMonth.substr(4, 6);
  875. if(data[i].stopMonth) {
  876. eDate = data[i].stopMonth.substr(0, 4) + "年" + data[i].stopMonth.substr(4, 6) + "月";
  877. eDateV = data[i].stopMonth.substr(0, 4) + "-" + data[i].stopMonth.substr(4, 6);
  878. } else {
  879. eDate = "至今";
  880. eDateV = "至今";
  881. }
  882. }
  883. var string = '<li>'
  884. string += ' <div class="showBx"><div class="h4Font h4tit">' + data[i].company + dep + ' - ' + data[i].title + '<small class="h6Font">';
  885. string += sDate;
  886. if(eDate) string += (" - " + eDate);
  887. string += '</small><em class="btnClick exitlist">编辑</em></div></div>';
  888. string += '<div class="modifybox"><ul class="cmpFrmList">'
  889. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>机构名称:</span><div class="col-w-10">'
  890. string += '<input type="text" class="frmcontype jobCompany" placeholder="请填写就职的机构" value="' + data[i].company + '" /><input type="hidden" class="jobId" value="' + data[i].id + '"></div></li>'
  891. string += '<li><span class="col-w-2 lableSpan">所在部门:</span><div class="col-w-10">'
  892. string += '<input type="text" class="frmcontype jobdepartment" placeholder="请填写就职的部门" value="' + depart + '" /></div></li>'
  893. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>职位:</span><div class="col-w-10">'
  894. string += '<input type="text" class="frmcontype jobTitle" placeholder="请填写担任的职位" value="' + data[i].title + '" /></div></li>'
  895. string += '<li><span class="col-w-2 lableSpan">任职时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  896. 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 + '" />'
  897. string += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"></ul><ul class="mr_month"></ul></div></div>'
  898. string += '<div class="col-w-1 alignCenter">至</div>'
  899. 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 + '" />'
  900. string += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"></ul><ul class="mr_month"></ul></div></div>'
  901. string += '</form></div></li>'
  902. string += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  903. string += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  904. string += '<button type="button" class="frmcontype btnModel btnCancel cancelList">取消</button>'
  905. string += '<button type="button" class="frmcontype btnModel fontLink">删除本条</button></div></li>'
  906. string += '</ul></div><li>';
  907. $("#timeJobShow").append(string);
  908. yearAdd();
  909. month();
  910. }
  911. }
  912. }
  913. var jobFil = function(select) {
  914. var string = '<li class="listnone1" style="display:none;"><div class="modifybox" style="display:block;"><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="请填写就职的机构" /><input type="hidden" class="jobId"></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="请填写就职的部门" /></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="请填写担任的职位" /></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 />'
  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 />'
  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 cancelO">取消</button></div></li>'
  931. string += '</ul></div><li>';
  932. $("" + select + "").prepend(string);
  933. }
  934. var jobThis = ""
  935. $("#timeJobShow").on("click", ".fontLink", function() { //编辑各个列表中的删除
  936. jobThis = $(this).parents(".modifybox").find(".jobId").val();
  937. $.MsgBox.Confirm("提示", "确认删除该工作经历?", delTimeJob);
  938. });
  939. //社会兼职,对添加的兼职删除
  940. var delTimeJob = function() {
  941. $.ajax({
  942. "url": "/ajax/job/" + jobThis,
  943. "type": "DELETE",
  944. "success": function($data) {
  945. if($data.success) {
  946. $.get("/ajax/professor/info/" + userid, function($data) {
  947. if($data.success) {
  948. $("#timeJobShow").empty("");
  949. timeJobShow($data.data.jobs);
  950. }
  951. });
  952. } else {
  953. $.MsgBox.Alert("提示", $data.msg);
  954. }
  955. }
  956. });
  957. }
  958. //社会兼职保存
  959. $("#timeJobShow").on("click", ".saveGo", function() {
  960. var length1 = trim($(this).parents(".modifybox").find(".jobCompany").val());
  961. var length2 = trim($(this).parents(".modifybox").find(".jobTitle").val());
  962. var length3 = trim($(this).parents(".modifybox").find(".StartMonth").val());
  963. var length4 = trim($(this).parents(".modifybox").find(".StopMonth").val());
  964. var length5 = trim($(this).parents(".modifybox").find(".jobdepartment").val());
  965. if(length1.length > 50) {
  966. $.MsgBox.Alert("提示", "机构名称不得超过50个字");
  967. return;
  968. }
  969. if(length5.length > 20) {
  970. $.MsgBox.Alert("提示", "部门名称不得超过20个字");
  971. return;
  972. }
  973. if(!length3 && length4) {
  974. $.MsgBox.Alert("提示", "请选择工作的开始时间");
  975. return;
  976. } else if(length3 && !length4) {
  977. $.MsgBox.Alert("提示", "请选择工作的结束时间");
  978. return;
  979. }
  980. if(!length1 && length2) {
  981. $.MsgBox.Alert("提示", "请填写机构名称");
  982. return;
  983. } else if(length1 && !length2) {
  984. $.MsgBox.Alert("提示", "请填写职位");
  985. return;
  986. } else if(!length1 && !length2) {
  987. $.MsgBox.Alert("提示", "请填写机构名称和职位");
  988. return;
  989. }
  990. var $data = {};
  991. var $id = $(this).parents(".modifybox").find(".jobId").val();
  992. if($id) {
  993. $data.id = $id;
  994. }
  995. $data.professorId = userid;
  996. $data.company = $(this).parents(".modifybox").find(".jobCompany").val();
  997. $data.department = $(this).parents(".modifybox").find(".jobdepartment").val();
  998. var s = $(this).parents(".modifybox").find(".StartMonth").val();
  999. var st = $(this).parents(".modifybox").find(".StopMonth").val();
  1000. if(s) {
  1001. $data.startMonth = s.substr(0, 4) + s.substr(5, 6);
  1002. }
  1003. if(st) {
  1004. if(st == "至今") {} else {
  1005. $data.stopMonth = st.substr(0, 4) + st.substr(5, 6);
  1006. }
  1007. }
  1008. $data.title = $(this).parents(".modifybox").find(".jobTitle").val();
  1009. $.ajax({
  1010. "url": "/ajax/job",
  1011. "type": $id ? "PUT" : "POST",
  1012. "data": $id ? JSON.stringify($data) : $data,
  1013. "contentType": $id ? "application/json" : "application/x-www-form-urlencoded",
  1014. beforeSend: function() {
  1015. //console.log(this.data)
  1016. },
  1017. "success": function($data) {
  1018. if($data.success) {
  1019. $.get("/ajax/professor/info/" + userid, function($data) {
  1020. if($data.success) {
  1021. $("#timeJobShow").empty("");
  1022. timeJobShow($data.data.jobs);
  1023. }
  1024. });
  1025. } else {
  1026. $.MsgBox.Alert("提示", $data.msg);
  1027. }
  1028. }
  1029. });
  1030. })
  1031. //////////////////工作经历增删改查相关结束///////////////
  1032. //////////////////项目经历增删改查相关开始///////////////
  1033. //填充项目经历
  1034. var projectShow = function(data) {
  1035. $("#projectShow").html("");
  1036. projectFil("#projectShow")
  1037. if(data.length > 0) {
  1038. for(var i = 0; i < data.length; i++) {
  1039. if(!data[i].descp) {
  1040. data[i].descp = "";
  1041. }
  1042. var sDate = "",
  1043. sDateV = "";
  1044. var eDate = "",
  1045. eDateV = "";
  1046. if(data[i].startMonth) {
  1047. sDate = data[i].startMonth.substr(0, 4) + "年" + data[i].startMonth.substr(4, 6) + "月";
  1048. sDateV = data[i].startMonth.substr(0, 4) + "-" + data[i].startMonth.substr(4, 6);
  1049. if(data[i].stopMonth) {
  1050. eDate = data[i].stopMonth.substr(0, 4) + "年" + data[i].stopMonth.substr(4, 6) + "月";
  1051. eDateV = data[i].stopMonth.substr(0, 4) + "-" + data[i].stopMonth.substr(4, 6);
  1052. } else {
  1053. eDate = "至今";
  1054. eDateV = "至今";
  1055. }
  1056. }
  1057. var stringHtml = '<li>';
  1058. stringHtml += '<div class="showBx"><div class="h4Font h4tit">' + data[i].name + '<small class="h6Font">'
  1059. stringHtml += sDate;
  1060. if(eDate) stringHtml += (" - " + eDate);
  1061. stringHtml += '</small><em class="btnClick exitlist">编辑</em></div>';
  1062. stringHtml += '<div class="h5Font">' + data[i].descp + '</div>';
  1063. stringHtml += '</div>';
  1064. stringHtml += '<div class="modifybox"><ul class="cmpFrmList">'
  1065. stringHtml += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>项目名称:</span><div class="col-w-10">'
  1066. stringHtml += '<input type="text" class="frmcontype projectName" placeholder="请填写项目名称" value="' + data[i].name + '" /><input type="hidden" class="projectId" value="' + data[i].id + '"></div></li>'
  1067. stringHtml += '<li><span class="col-w-2 lableSpan">项目时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  1068. 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 + '" />'
  1069. stringHtml += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"></ul><ul class="mr_month"></ul></div></div>'
  1070. stringHtml += '<div class="col-w-1 alignCenter">至</div>'
  1071. 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 + '" />'
  1072. stringHtml += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"> </ul><ul class="mr_month"></ul></div></div>'
  1073. stringHtml += '</form></div></li>'
  1074. stringHtml += '<li><span class="col-w-2 lableSpan">项目描述:</span><div class="col-w-10">'
  1075. 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>'
  1076. stringHtml += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  1077. stringHtml += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  1078. stringHtml += '<button type="button" class="frmcontype btnModel btnCancel cancelList">取消</button>'
  1079. stringHtml += '<button type="button" class="frmcontype btnModel fontLink">删除本条</button></div></li>'
  1080. var $stringHtml = $(stringHtml);
  1081. $("#projectShow").append($stringHtml);
  1082. limitObj($stringHtml.find(".projectDescp"), 200)
  1083. yearAdd();
  1084. month();
  1085. }
  1086. }
  1087. }
  1088. //项目经历添加填充
  1089. var projectFil = function(select) {
  1090. var string = '<li class="listnone1" style="display:none;"><div class="modifybox" style="display:block;"><ul class="cmpFrmList">'
  1091. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>项目名称:</span><div class="col-w-10">'
  1092. string += '<input type="text" class="frmcontype projectName" placeholder="请填写项目名称" /><input type="hidden" class="projectId"></div></li>'
  1093. string += '<li><span class="col-w-2 lableSpan">项目时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  1094. string += '<div class="col-w-5" style="position:relative"><input type="text" class="date-btn frmcontype project StartMonth" flag="2" difference="1" readonly placeholder="请选择起始时间" />'
  1095. string += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"></ul><ul class="mr_month"></ul></div></div>'
  1096. string += '<div class="col-w-1 alignCenter">至</div>'
  1097. string += '<div class="col-w-5" style="position:relative"><input type="text" class="date-btn frmcontype project StopMonth" flag="2" difference="2" readonly placeholder="请选择结束时间" />'
  1098. string += '<div class="mr_calendar_ym clearfix"><ul class="mr_year"> </ul><ul class="mr_month"></ul></div></div>'
  1099. string += '</form></div></li>'
  1100. string += '<li><span class="col-w-2 lableSpan">项目描述:</span><div class="col-w-10">'
  1101. string += '<div class="msgContbox"><textarea class="frmcontype msgCont projectDescp" placeholder="请填写项目描述"></textarea><span class="msgconNum"><em class="limitNum">0</em>/200</span></div></div></li>'
  1102. string += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  1103. string += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  1104. string += '<button type="button" class="frmcontype btnModel btnCancel cancelO">取消</button></div></li>'
  1105. string += '</ul></div><li>';
  1106. var $ostr = $(string);
  1107. $("" + select + "").prepend($ostr);
  1108. limitObj($ostr.find(".projectDescp"), 200)
  1109. }
  1110. var projectThis = ""
  1111. $("#projectShow").on("click", ".fontLink", function() { //编辑各个列表中的删除
  1112. projectThis = $(this).parents(".modifybox").find(".projectId").val();
  1113. $.MsgBox.Confirm("提示", "确认删除该项目经历?", delProject);
  1114. });
  1115. //项目经历,对添加的项目删除
  1116. var delProject = function() {
  1117. $.ajax({
  1118. "url": "/ajax/project/" + projectThis,
  1119. "type": "DELETE",
  1120. "success": function($data) {
  1121. if($data.success) {
  1122. $.get("/ajax/professor/info/" + userid, function($data) {
  1123. if($data.success) {
  1124. $("#projectShow").empty("");
  1125. projectShow($data.data.projects);
  1126. }
  1127. });
  1128. } else {
  1129. $.MsgBox.Alert("提示", $data.msg);
  1130. }
  1131. }
  1132. });
  1133. }
  1134. //项目经历保存
  1135. $("#projectShow").on("click", ".saveGo", function() {
  1136. var length = trim($(this).parents(".modifybox").find(".projectName").val());
  1137. var length1 = trim($(this).parents(".modifybox").find(".StartMonth").val());
  1138. var length2 = trim($(this).parents(".modifybox").find(".StopMonth").val());
  1139. var lengthDescp = trim($(this).parents(".modifybox").find(".projectDescp").val());
  1140. // if(lengthDescp.length>200){$.MsgBox.Alert("提示", "项目描述不得超过200个字");return;}
  1141. if(!length) {
  1142. $.MsgBox.Alert("提示", "请填写项目名称");
  1143. return;
  1144. }
  1145. if(length.length > 50) {
  1146. $.MsgBox.Alert("提示", "项目名称不得超过50个字");
  1147. return;
  1148. }
  1149. if(length1 && !length2) {
  1150. $.MsgBox.Alert("提示", "没有选结束时间");
  1151. return;
  1152. }
  1153. if(!length1 && length2) {
  1154. $.MsgBox.Alert("提示", "没有选开始时间");
  1155. return;
  1156. }
  1157. var $data = {};
  1158. var $id = $(this).parents(".modifybox").find(".projectId").val();
  1159. if($id) {
  1160. $data.id = $id;
  1161. }
  1162. $data.professorId = userid;
  1163. var s = $(this).parents(".modifybox").find(".StartMonth").val();
  1164. var st = $(this).parents(".modifybox").find(".StopMonth").val();
  1165. if(s) {
  1166. $data.startMonth = s.substr(0, 4) + s.substr(5, 6);
  1167. }
  1168. if(st) {
  1169. if(st == "至今") {} else {
  1170. $data.stopMonth = st.substr(0, 4) + st.substr(5, 6);
  1171. }
  1172. }
  1173. $data.name = $(this).parents(".modifybox").find(".projectName").val()
  1174. $data.descp = $(this).parents(".modifybox").find(".projectDescp").val()
  1175. $.ajax({
  1176. "url": "../ajax/project",
  1177. "type": $id ? "PUT" : "POST",
  1178. "data": $id ? JSON.stringify($data) : $data,
  1179. "contentType": $id ? "application/json" : "application/x-www-form-urlencoded",
  1180. "success": function($data) {
  1181. if($data.success) {
  1182. $.get("/ajax/professor/info/" + userid, function($data) {
  1183. if($data.success) {
  1184. $("#projectShow").empty("");
  1185. projectShow($data.data.projects);
  1186. // yearAdd();
  1187. // month();
  1188. }
  1189. });
  1190. } else {
  1191. $.MsgBox.Alert("提示", $data.msg);
  1192. }
  1193. }
  1194. });
  1195. })
  1196. //////////////////项目经历增删改查相关结束///////////////
  1197. //////////////////荣誉奖项增删改查相关开始///////////////
  1198. var honorShow = function(data) {
  1199. $("#honorShow").html("");
  1200. hounerFil("#honorShow");
  1201. if(data.length > 0) {
  1202. for(var i = 0; i < data.length; i++) {
  1203. var timeho = "";
  1204. if(data[i].year) {
  1205. timeho = data[i].year + '年';
  1206. } else {
  1207. data[i].year = "";
  1208. }
  1209. if(!data[i].descp) {
  1210. data[i].descp = "";
  1211. }
  1212. var stringHtml = '<li>';
  1213. stringHtml += '<div class="showBx"><div class="h4Font h4tit">' + data[i].name + '<small class="h6Font">' + timeho + '</small><em class="btnClick exitlist">编辑</em></div>';
  1214. stringHtml += '<div class="h5Font">' + data[i].descp + '</div>';
  1215. stringHtml += '</div>';
  1216. stringHtml += '<div class="modifybox"><ul class="cmpFrmList">'
  1217. stringHtml += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>奖项名称:</span><div class="col-w-10">'
  1218. stringHtml += '<input type="text" class="frmcontype honorName" placeholder="请填写奖项名称" value="' + data[i].name + '" /><input type="hidden" class="honorId" value="' + data[i].id + '"></div></li>'
  1219. stringHtml += '<li><span class="col-w-2 lableSpan">获奖时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  1220. 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 + '" />'
  1221. stringHtml += '<div class="mr_calendar_ym clearfix"><ul class="full_year"></ul></div></div>'
  1222. stringHtml += '</form></div></li>'
  1223. stringHtml += '<li><span class="col-w-2 lableSpan">获奖描述:</span><div class="col-w-10">'
  1224. 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>'
  1225. stringHtml += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  1226. stringHtml += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  1227. stringHtml += '<button type="button" class="frmcontype btnModel btnCancel cancelList">取消</button>'
  1228. stringHtml += '<button type="button" class="frmcontype btnModel fontLink">删除本条</button></div></li>'
  1229. var $stringHtml = $(stringHtml)
  1230. $("#honorShow").append($stringHtml);
  1231. yearAdd();
  1232. limitObj($stringHtml.find(".honorDescp"), 200)
  1233. }
  1234. }
  1235. }
  1236. var hounerFil = function(select) {
  1237. var string = '<li class="listnone1" style="display:none;"><div class="modifybox" style="display:block;"><ul class="cmpFrmList">'
  1238. string += '<li><span class="col-w-2 lableSpan"><span class="requiredcon">* </span>奖项名称:</span><div class="col-w-10">'
  1239. string += '<input type="text" class="frmcontype honorName" placeholder="请填写奖项名称" /><input type="hidden" class="honorId"></div></li>'
  1240. string += '<li><span class="col-w-2 lableSpan">项目时间:</span><div class="col-w-9"><form action="" class="col-w-12" name="formT">'
  1241. string += '<div class="col-w-5" style="position:relative"><input type="text" class="date-btn frmcontype honorYear" flag="1" readonly placeholder="请选择获奖时间" />'
  1242. string += '<div class="mr_calendar_ym clearfix"><ul class="full_year"></ul></div></div>'
  1243. string += '</form></div></li>'
  1244. string += '<li><span class="col-w-2 lableSpan">获奖描述:</span><div class="col-w-10">'
  1245. string += '<div class="msgContbox"><textarea class="frmcontype msgCont honorDescp" placeholder="请填写获奖描述"></textarea><span class="msgconNum"><em class="limitNum">0</em>/200</span></div></div></li>'
  1246. string += '<li class="saveBtn"><span class="col-w-2">&nbsp;</span><div class="col-w-10">'
  1247. string += '<button type="button" class="frmcontype btnModel saveGo">保存</button>'
  1248. string += '<button type="button" class="frmcontype btnModel btnCancel cancelO">取消</button></div></li>'
  1249. string += '</ul></div><li>';
  1250. var $ostr = $(string);
  1251. $("" + select + "").prepend($ostr);
  1252. limitObj($ostr.find(".honorDescp"), 200)
  1253. }
  1254. var honorThis = ""
  1255. $("#honorShow").on("click", ".fontLink", function() {
  1256. honorThis = $(this).parents(".modifybox").find(".honorId").val();
  1257. $.MsgBox.Confirm("提示", "确认删除该荣誉奖项?", delHonor);
  1258. });
  1259. var delHonor = function() { //荣誉及奖项 ,对添加的专利删除
  1260. $.ajax({
  1261. "url": "/ajax/honor/" + honorThis,
  1262. "type": "DELETE",
  1263. "success": function($data) {
  1264. if($data.success) {
  1265. $.get("/ajax/professor/info/" + userid, function($data) {
  1266. if($data.success) {
  1267. $("#honorShow").empty("");
  1268. honorShow($data.data.honors);
  1269. }
  1270. });
  1271. } else {
  1272. $.MsgBox.Alert("提示", $data.msg);
  1273. }
  1274. }
  1275. });
  1276. }
  1277. //荣誉及奖项保存
  1278. $("#honorShow").on("click", ".saveGo", function() {
  1279. var length = trim($(this).parents(".modifybox").find(".honorName").val());
  1280. var lengthDescp = trim($(this).parents(".modifybox").find(".honorDescp").val());
  1281. if(!length) {
  1282. $.MsgBox.Alert("提示", "请填写奖项名称");
  1283. return;
  1284. }
  1285. if(length.length > 50) {
  1286. $.MsgBox.Alert("提示", "奖项名称不得超过50个字");
  1287. return;
  1288. }
  1289. // if(lengthDescp.length>200){$.MsgBox.Alert("提示", "获奖描述不得超过200个字");return;}
  1290. var $data = {};
  1291. var $id = $(this).parents(".modifybox").find(".honorId").val();
  1292. if($id) {
  1293. $data.id = $id;
  1294. }
  1295. $data.professorId = userid;
  1296. $data.year = $(this).parents(".modifybox").find(".honorYear").val();
  1297. $data.name = $(this).parents(".modifybox").find(".honorName").val();
  1298. $data.descp = $(this).parents(".modifybox").find(".honorDescp").val();
  1299. console.log($data.descp);
  1300. $.ajax({
  1301. "url": "../ajax/honor",
  1302. "type": $id ? "PUT" : "POST",
  1303. "data": $id ? JSON.stringify($data) : $data,
  1304. "contentType": $id ? "application/json" : "application/x-www-form-urlencoded",
  1305. "success": function($data) {
  1306. if($data.success) {
  1307. $.get("/ajax/professor/info/" + userid, function($data) {
  1308. if($data.success) {
  1309. $("#honorShow").empty("");
  1310. honorShow($data.data.honors);
  1311. //yearAdd();
  1312. }
  1313. });
  1314. } else {
  1315. $.MsgBox.Alert("提示", $data.msg);
  1316. }
  1317. }
  1318. });
  1319. })
  1320. //////////////////荣誉奖项增删改查相关结束///////////////
  1321. //////////////////相关操作按钮///////////////
  1322. //用户基本信息编辑
  1323. $(".headconBox").on("click", ".proEdit", function() {
  1324. $(this).parents(".coninfocon").siblings(".modifybox").show();
  1325. $(this).parents(".coninfocon").hide();
  1326. $(".head-left").css("top", "100px");
  1327. //点击取消的操作
  1328. $(".btnCancel").click(function() {
  1329. $(".head-left").css("top", "");
  1330. $(this).parents(".modifybox").siblings(".coninfocon").show();
  1331. $(this).parents(".modifybox").hide();
  1332. getInfo(userid);
  1333. });
  1334. });
  1335. //获取点击那个编辑
  1336. $(".leftconBox").on("click", ".edit", function() {
  1337. $(this).parents(".coninfobox").find(".modifybox").show();
  1338. $(this).parents(".coninfobox").find(".coninfocon").hide();
  1339. //点击取消的操作
  1340. $(".btnCancel").click(function() {
  1341. $(this).parents(".coninfobox").find(".modifybox").hide();
  1342. $(this).parents(".coninfobox").find(".coninfocon").show();
  1343. getInfo(userid);
  1344. });
  1345. });
  1346. $(".addedit").on("click", function() { //点击添加按钮
  1347. $(this).parents(".coninfobox").find(".listnone1").toggle(100);
  1348. $(this).parents(".coninfobox").find(".showBx").show();
  1349. $(this).parents(".coninfobox").find(".showBx + .modifybox").hide();
  1350. $(this).parents(".coninfobox").find(".listnone1").find(".frmcontype").val("");
  1351. $(this).parents(".coninfobox").find(".listnone1").find(".mr_btn").val("0");
  1352. });
  1353. $(".coninfobox").on("click", ".cancelO", function() { //添加模块的取消
  1354. $(this).parents(".listnone1").toggle(100);
  1355. });
  1356. $(".coninfobox").on("click", ".exitlist", function() { //编辑列表模块
  1357. $(this).parents(".showBx").hide().siblings(".modifybox").show();
  1358. $(this).parents("li").siblings().find(".showBx").show().siblings(".modifybox").hide();
  1359. });
  1360. $(".coninfobox").on("click", ".cancelList", function() { //编辑各个列表中的取消
  1361. $(this).parents(".modifybox").hide();
  1362. $(this).parents(".modifybox").siblings(".showBx").show();
  1363. getInfo(userid);
  1364. });
  1365. //点击查看自己的主页
  1366. $("#showMyself").click(function() {
  1367. $(this).attr("href", "userInforShow.html?professorId=" + userid);
  1368. })
  1369. function trim(str) { //删除左右两端的空格   
  1370. return str.replace(/(^\s*)|(\s*$)/g, "");
  1371. }
  1372. })