portal html css js resource

information.js 58KB

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