You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

edit_userinfo.js 3.0 kB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. app.controller('EditUserInfoController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common','$timeout','wx', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common,$timeout,wx){
  2. // common.checkLogin();
  3. $scope.replaceUrl = function(url){
  4. return url;
  5. };
  6. var vm = $scope;
  7. //单弹框
  8. vm.alertService_1 = alertService.create();
  9. //双弹框
  10. vm.alertService_2 = alertService.create();
  11. vm.getuserinfo = function(){
  12. $http.get(config.apiUrl + 'users/get_userinfo?token='+auth.token()).then(
  13. function(response) {
  14. console.log(response.data);
  15. vm.user = response.data.data;
  16. vm.lastname = vm.user.lastname;
  17. vm.mail = vm.user.mail;
  18. vm.sex = vm.user.gender;
  19. }
  20. );
  21. };
  22. vm.getuserinfo();
  23. vm.unbind = function(){
  24. vm.alertService_2.showMessage('提示', '是否确认解除绑定', function() {
  25. $http.post(config.apiUrl + "users/user_unbind",
  26. {token: auth.token()}
  27. ).then(function (response) {
  28. if (response.data.status == 0) {
  29. vm.alertService_1.showMessage('提示', '解除绑定成功', function () {
  30. wx.closeWindow();
  31. });
  32. }
  33. else {
  34. vm.alertService_1.showMessage('提示', response.data.message);
  35. }
  36. });
  37. });
  38. };
  39. vm.cancel = function(){
  40. vm.alertService_2.showMessage('提示', '是否确认取消', function() {
  41. wx.closeWindow();
  42. });
  43. };
  44. vm.confirm = function(frm){
  45. frm.$setSubmitted();
  46. console.log(frm);
  47. if (!frm.$valid) {
  48. console.log(frm.$error);
  49. return;
  50. }
  51. if(vm.lastname == ""){
  52. vm.alertService_1.showMessage('提示', '姓名不能为空');
  53. return;
  54. }
  55. if(vm.mail == ""){
  56. vm.alertService_1.showMessage('提示', '邮箱不能为空');
  57. return;
  58. }
  59. // if(!(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i.test(vm.mail))){
  60. // vm.alertService_1.showMessage('提示', '邮箱不合法');
  61. // return;
  62. // }
  63. $http.post(config.apiUrl + "users/edit_userinfo",
  64. {token: auth.token(),lastname: vm.lastname, sex: vm.sex, mail: vm.mail}
  65. ).then(function(response){
  66. if(response.data.status == 0)
  67. {
  68. vm.alertService_1.showMessage('提示', '修改成功',function(){
  69. wx.closeWindow();
  70. });
  71. }
  72. else{
  73. vm.alertService_1.showMessage('提示', response.data.message);
  74. }
  75. });
  76. };
  77. }]);

软件技术创新是当今国家整体创新能力的重要基础和发展引擎。近年来,大众参与的软件创新与创业活动已经成为网络时代软件开发和应用的新形态,正在快速改变着全球软件创新模式和软件产业格局。 ...