userInfoRequest.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. //修改用户信息
  2. function setUserInfo() {
  3. var name = $("#myInfo_name_edit").val();
  4. var sex = $("#myInfo_sex_edit").text();
  5. if (sex == "男") {
  6. sex = 1;
  7. }else if (sex == "女") {
  8. sex = 2;
  9. } else {
  10. sex = 3;
  11. }
  12. var phone = $("#myInfo_phone_edit").val();
  13. var email = $("#myInfo_email_edit").val();
  14. var birthday = $("#myInfo_birthday_edit").val();
  15. var provinceName = $("#myInfo_provinceName_edit").text();
  16. var provinceID=$("#myInfo_provinceName_edit").attr("data-value");
  17. var cityName = $("#myInfo_cityName_edit").text();
  18. var cityID=$("#myInfo_cityName_edit").attr("data-value");
  19. var operatorId = parent.myInfo.id;
  20. var operatorName = parent.myInfo.cName;
  21. var param = {
  22. operatorId: operatorId,
  23. operatorName: operatorName,
  24. userID: operatorId,
  25. cName: name,
  26. sex: sex,
  27. mainPhone: phone,
  28. email: email,
  29. birthDate: birthday,
  30. provinceName: provinceName,
  31. provinceID: provinceID,
  32. cityName: cityName,
  33. cityID:cityID
  34. };
  35. $.ajax({
  36. url: "UserInfoRequestAction/setUserInfo",
  37. dataType: "json",
  38. type: 'POST',
  39. data: param ,
  40. success: function (data) {
  41. if (data) {
  42. if (data.Code == 10000) {
  43. parent.myInfo.cName=name;
  44. parent.myInfo.sex = sex;
  45. parent.myInfo.phone= phone;
  46. parent.myInfo.email= email;
  47. parent.myInfo.birthday= birthday;
  48. parent.myInfo.provinceName=provinceName;
  49. parent.myInfo.provinceID=provinceID;
  50. parent.myInfo.cityName=cityName;
  51. parent.myInfo.cityID=cityID;
  52. parent.showHideMsg(data.Message,1);
  53. parent.$('#iframe-userInfo').attr("src","myUserInfo.html");
  54. window.location.href = "myUserInfo.html";
  55. parent.$(".c-f20.c-nowrap").html(parent.myInfo.cName);
  56. //location.reload();
  57. }else if(data.Code == -8000){
  58. //parent.showHideMsg(data.Message,3);
  59. window.parent.location.href = "jump.jsp";
  60. }else if(data.Message!=null&&data.Message!=""){
  61. parent.showHideMsg(data.Message,1);
  62. }else{
  63. parent.showHideMsg("修改信息出错",1);
  64. }
  65. }else{
  66. parent.showHideMsg("修改信息出错",1);
  67. }
  68. },
  69. error: function () {
  70. parent.showHideMsg("修改信息出错",1);
  71. }
  72. });
  73. }
  74. //修改密码
  75. function resetPwd(paramsObj) {
  76. $.ajax({
  77. url: "UserInfoRequestAction/resetPwd",
  78. dataType: "json",
  79. type: 'POST',
  80. data: paramsObj ,
  81. success: function (data) {
  82. if (data) {
  83. if (data.Code == 10000) {
  84. parent.showHideMsg(data.Message,3);
  85. parent.imClosed();
  86. } else if(data.Code == -10000) {
  87. parent.showHideMsg("原密码错误",3);
  88. }else if(data.Code == -8000){
  89. //parent.showHideMsg(data.Message,3);
  90. window.parent.location.href = "jump.jsp";
  91. }else if(data.Message!=null&&data.Message!=""){
  92. parent.showHideMsg(data.Message,3);
  93. }
  94. }
  95. },
  96. error: function () {
  97. parent.showHideMsg("修改密码出错",3);
  98. }
  99. });
  100. }
  101. //意见反馈
  102. function createFeedBackBySend(paramsObj) {
  103. $.ajax({
  104. url: "UserInfoRequestAction/feedBack",
  105. dataType: "json",
  106. type: 'POST',
  107. data: paramsObj ,
  108. success: function (data) {
  109. if (data) {
  110. if (data.Code == 10000) {
  111. parent.showHideMsg("意见反馈成功",3);
  112. $("#feedback_txt").val('');
  113. }else if(data.Code == -8000){
  114. //parent.showHideMsg(data.Message,3);
  115. window.parent.location.href = "jump.jsp";
  116. }else{
  117. parent.showHideMsg("意见反馈出错",1);
  118. }
  119. }
  120. },
  121. error: function () {
  122. parent.showHideMsg("意见反馈出错",1);
  123. }
  124. });
  125. }
  126. //查询是否好友
  127. function isfriend(fid) {
  128. var param = {
  129. passiveUserId: fid
  130. };
  131. $.ajax({
  132. url: "IsFriendAction/isFriend",
  133. dataType: "json",
  134. type: 'POST',
  135. data: param ,
  136. success: function (data) {
  137. if (data.Code == 10000) {
  138. if (data.isFirend == 1) {
  139. $("#addFriend").hide();
  140. $("#delFriend").show();
  141. } else {
  142. $("#addFriend").show();
  143. $("#delFriend").hide();
  144. }
  145. }else if(data.Code == -8000){
  146. //parent.showHideMsg(data.Message,3);
  147. window.parent.location.href = "jump.jsp";
  148. }else{
  149. parent.showHideMsg("查询是否好友出错",1);
  150. }
  151. }
  152. });
  153. }
  154. //加为好友
  155. function addFriend() {
  156. var param = {
  157. passiveUserId: $("#userid").val()
  158. };
  159. $.ajax({
  160. url: "IsFriendAction/addFriend",
  161. dataType: "json",
  162. type: 'POST',
  163. data: param,
  164. success: function (data) {
  165. if (data.Code == "10000") {
  166. parent.showHideMsg("请求加为好友成功,正在等待好友验证",3);
  167. parent.imClosed();
  168. //parent.$('.sec .message_box').hide();
  169. }else if(data.Code == -8000){
  170. //parent.showHideMsg(data.Message,3);
  171. window.parent.location.href = "jump.jsp";
  172. }else{
  173. parent.showHideMsg("加好友出错",1);
  174. }
  175. }
  176. });
  177. }
  178. //删除好友
  179. function delFriend() {
  180. if (!confirm("确定要删除好友吗?")) {
  181. return;
  182. }
  183. var param = {
  184. passiveUserId: $("#userid").val()
  185. };
  186. $.ajax({
  187. url: "IsFriendAction/delFriend",
  188. dataType: "json",
  189. data: param,
  190. type: 'POST',
  191. success: function (data) {
  192. if (data.Code == 10000) {
  193. parent.showHideMsg("删除成功",3);
  194. parent.imClosed();
  195. parent.$(".user-scroll").html("");
  196. parent.loadFriends();
  197. }else if(data.Code == -8000){
  198. //parent.showHideMsg(data.Message,3);
  199. window.parent.location.href = "jump.jsp";
  200. }else{
  201. parent.showHideMsg("删除出错",1);
  202. }
  203. }
  204. });
  205. }