portal html css js resource

fillinfoNew.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. $(function() {
  2. var userid = $.cookie('userid');
  3. userInformation(userid);
  4. //获取用户信息
  5. function userInformation(userid) {
  6. $.ajax("/ajax/professor/baseInfo/" + userid, {
  7. type: "GET",
  8. async: true,
  9. success: function($data) {
  10. console.log($data)
  11. if($data.success) {
  12. $("#username").text($data.data.name);
  13. if($data.data.hasHeadImage == 1) {
  14. var imgvar = '<img src="/images/head/' + userid + '_l.jpg" style="width:100%"/>';
  15. $("#userimg").append(imgvar);
  16. }
  17. }
  18. },
  19. error: function() {
  20. $.MsgBox.Alert('消息', '服务器请求失败')
  21. },
  22. });
  23. }
  24. })
  25. //校验信息
  26. function nameVal(_this, num) {
  27. var inputval = $(_this).text().replace(/[^\u0000-\u00ff]/g, "aa").length;
  28. if(inputval > num) {
  29. $(_this).next().find("span").text("最多输入" + num / 2 + "个字");
  30. $(_this).addClass("frmmsg-warning");
  31. } else {
  32. $(_this).next().find("span").text("");
  33. $(_this).removeClass("frmmsg-warning");
  34. }
  35. }
  36. /*获取焦点*/
  37. function getFocus(_this) {
  38. $(_this).next().find("span").text("");
  39. $(_this).removeClass("frmmsg-warning");
  40. }
  41. //进入科袖按钮
  42. function modifyUserInformation() {
  43. var $data = {};
  44. $data.name = $("#username").text(); //名字
  45. $data.orgName = $("#orgName").text(); //机构名称
  46. $data.title = $("#title").text(); //职称
  47. $data.office = $("#office").text(); //职位
  48. $data.department = $("#department").text(); //部门
  49. var province = $("#oprovince").text();
  50. var address = $("#ocity").text(); //市
  51. if(province == "请选择省/直辖市") {
  52. $data.province = "";
  53. } else {
  54. $data.province = province; //省
  55. }
  56. if(address == "请选择城市") {
  57. $data.address = "";
  58. } else {
  59. $data.address = address; //省
  60. }
  61. $data.id = $.cookie('userid');
  62. console.log($data);
  63. $.ajax("/ajax/professor/updatePro", {
  64. type: "POST",
  65. dataType: "json",
  66. data: $data,
  67. success: function($data) {
  68. console.log($data)
  69. if($data.success) {
  70. location.href = "index.html";
  71. }
  72. },
  73. error: function() {
  74. $.MsgBox.Alert('消息', '服务器请求失败')
  75. },
  76. });
  77. }