portal html css js resource

information.js 58KB

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