portal html css js resource

information.js 57KB

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