12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- app.controller('StdDisableUserCtrl', function($rootScope, $scope, $http, $timeout, $state, myConfig, $cookieStore, $interval) {
- $scope.sendMessageTime = 0;
- $interval(function(){
- if($scope.sendMessageTime > 0){
- $scope.sendMessageTime--;
- }
- }, 1000);
-
- $scope.load = function(){
- $scope.myPromise = $http({
- url : myConfig.url + '/user/info?session=' + $rootScope.session,
- method : 'GET'
- }).success(function(data) {
- if(data.code == 0){
- $scope.login = data.result;
- $scope.login.mobile = $scope.login.login_name;
- }else{
- $rootScope.dialogMsg(data.errorMsg, function(){
- window.location = "index.html";
- })
- }
- }).error(function() {
- });
- }
- $scope.load();
-
- $scope.sendMessage = function(){
- $scope.sendMessageTime = 100;
-
- $scope.myPromise = $http({
- url : myConfig.url + '/user/checkSendSms',
- method : 'POST',
- data : angular.toJson($scope.login)
- }).success(function(data) {
- if(data.code == 0){
- if(data.result.checkResult){
- $scope.doSendSms();
- }else{
- $rootScope.dialogMsg("请勿频繁操作,请稍后重试", function(){});
- }
- }else{
- $rootScope.dialogMsg("请稍后重试", function(){});
- }
- }).error(function() {
- });
- }
-
- $scope.doSendSms = function(){
- $scope.myPromise = $http({
- url : myConfig.url + '/user/userSaveSmsLog?session=' + $rootScope.session,
- method : 'POST',
- data : angular.toJson($scope.login)
- }).success(function(data) {
- if(data.code == 0){
- $rootScope.dialogMsg("验证码已发送,请注意查收", function(){});
- }else{
- $rootScope.dialogMsg(data.errorMsg, function(){});
- }
- }).error(function() {
- });
- }
- $scope.submitForm = function(isValid) {
- $scope.submitted = true;
- if(isValid){
- $scope.myPromise = $http({
- url : myConfig.url + '/user/checkVerifyCode',
- method : 'POST',
- data : angular.toJson($scope.login)
- }).success(function(data) {
- if(data.code == 0){
- $scope.myPromise = $http({
- url : $rootScope.host_url + '/user/disableUser?session=' + $rootScope.session,
- method : 'POST'
- }).success(function(data) {
- if(data.code == 0){
- $rootScope.dialogMsg("删除成功", function(){
- $rootScope.logout();
- });
- }else{
- toaster.pop('error', data.message);
- }
- }).error(function() {
- });
- }else{
- $rootScope.dialogMsg(data.errorMsg, function(){});
- }
- }).error(function() {
- });
- }
-
- };
- });
|