|
|
@@ -37,6 +37,17 @@ define([ 'toaster', 'ngTable', 'common/services', 'ui.router', 'ui.bootstrap', '
|
|
|
url : "/:id",
|
|
|
templateUrl : "static/tpl/serve/guide.html",
|
|
|
controller: 'GuideCtrl'
|
|
|
+ }).state('self', {
|
|
|
+ url : "/self",
|
|
|
+ templateUrl : "static/tpl/serve/self.html"
|
|
|
+ }).state('self.forget_pwd1', {
|
|
|
+ url : "/forget_pwd1",
|
|
|
+ templateUrl : "static/tpl/serve/self/forget_pwd1.html",
|
|
|
+ controller: 'ForgetPwd1Ctrl'
|
|
|
+ }).state('self.forget_pwd2', {
|
|
|
+ url : "/forget_pwd2/:uu/:checkcode",
|
|
|
+ templateUrl : "static/tpl/serve/self/forget_pwd2.html",
|
|
|
+ controller: 'ForgetPwd2Ctrl'
|
|
|
});
|
|
|
}]);
|
|
|
app.controller('MyCtrl', ['$scope', '$rootScope', function($scope, $rootScope) {
|
|
|
@@ -76,5 +87,100 @@ define([ 'toaster', 'ngTable', 'common/services', 'ui.router', 'ui.bootstrap', '
|
|
|
$scope.slides = data;
|
|
|
});
|
|
|
}]);
|
|
|
+ app.controller('ForgetPwd1Ctrl', function($scope, toaster, Password){
|
|
|
+ $scope.loading = false;
|
|
|
+ $scope.getUserInfo = function(){
|
|
|
+ $scope.loading = true;
|
|
|
+ Password.getUserInfo($scope.userName).then(function(data){
|
|
|
+ $scope.userInfo = data;
|
|
|
+ $scope.userInfoError = false;
|
|
|
+ $scope.loading = false;
|
|
|
+ }, function(data) {
|
|
|
+ $scope.userInfoError = data;
|
|
|
+ $scope.userInfo = false;
|
|
|
+ $scope.loading = false;
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ var setTimeDown = function(value) {
|
|
|
+ if(value > 0) {
|
|
|
+ setTimeout(function() {
|
|
|
+ value --;
|
|
|
+ setTimeDown(value);
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.sendEmail = function(type){
|
|
|
+ $scope.loading = true;
|
|
|
+ Password.sendEmail($scope.userInfo.userUU, type).then(function(data){
|
|
|
+ $scope.sendSuccess = true;
|
|
|
+ $scope.waitingTime = 60;
|
|
|
+ setTimeDown($scope.waitingTime);
|
|
|
+ $scope.loading = false;
|
|
|
+ }, function(data) {
|
|
|
+ $scope.sendFaild = true;
|
|
|
+ $scope.loading = false;
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ });
|
|
|
+ app.controller('ForgetPwd2Ctrl', function($scope, toaster, $stateParams, Password){
|
|
|
+ $scope.uu = $stateParams.uu;
|
|
|
+ $scope.checkcode = $stateParams.checkcode;
|
|
|
+ $scope.checking = true;
|
|
|
+ $scope.all = {};
|
|
|
+
|
|
|
+ setTimeout(function() {//延迟3秒执行
|
|
|
+ Password.check($scope.uu, $scope.checkcode).then(function(data){
|
|
|
+ $scope.checkSuccess = true;
|
|
|
+ $scope.checking = false;
|
|
|
+ $scope.newCheckcode = data.checkcode;
|
|
|
+ }, function(data){
|
|
|
+ $scope.checkError = true;
|
|
|
+ $scope.checking = false;
|
|
|
+ $scope.errorInfo = data;
|
|
|
+ });
|
|
|
+ }, 2000);
|
|
|
+
|
|
|
+ $scope.reset = function(){
|
|
|
+ $scope.loading = true;
|
|
|
+ console.log($scope);
|
|
|
+ console.log($scope.password);
|
|
|
+ Password.reset($scope.uu, $scope.all.password, $scope.newCheckcode).then(function(data){
|
|
|
+ $scope.loading = false;
|
|
|
+ $scope.resetSuccess = true;
|
|
|
+ $scope.resetError = false;
|
|
|
+ setTimeout(function() {//延迟3秒执行
|
|
|
+ window.location.href = "http://www.ubtob.com";
|
|
|
+ }, 2000);
|
|
|
+ }, function(data){
|
|
|
+ $scope.loading = false;
|
|
|
+ $scope.resetSuccess = false;
|
|
|
+ $scope.resetError = true;
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ });
|
|
|
+ /**
|
|
|
+ * 搜索框,回车触发
|
|
|
+ */
|
|
|
+ app.directive('ngSearch', ['$parse', function($parse) {
|
|
|
+ return {
|
|
|
+ require : '?ngModel',
|
|
|
+ restrict : 'A',
|
|
|
+ link : function(scope, element, attrs, ngModel) {
|
|
|
+ var searchFn = $parse(attrs.ngSearch);
|
|
|
+ element.bind('keypress', function(event) {
|
|
|
+ if (event.keyCode == '13') {
|
|
|
+ event.preventDefault();
|
|
|
+ event.stopPropagation();
|
|
|
+ searchFn(scope, {$data: ngModel.$modelValue, $event: event});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }]);
|
|
|
+
|
|
|
return app;
|
|
|
});
|