Browse Source

安全认证提示改为模态框

yangc 8 years ago
parent
commit
85f50faf17
1 changed files with 31 additions and 14 deletions
  1. 31 14
      src/main/webapp/resources/js/common/controllers/commonCtrls.js

+ 31 - 14
src/main/webapp/resources/js/common/controllers/commonCtrls.js

@@ -1741,23 +1741,40 @@ define([ 'app/app' ], function(app) {
   /**
    * 左侧导航栏控制器
    */
-	app.controller('leftNavCtrl', ["$scope", "toaster", function($scope, toaster){
+	app.controller('leftNavCtrl', ["$scope", "toaster", '$modal', '$rootScope', function($scope, toaster, $modal, $rootScope){
+		//安全设置提醒框
+		$scope.openHomeCenterModel = function() {
+			var modalInstance = $modal.open({
+				animation: true,
+				templateUrl: $rootScope.rootPath + '/static/view/usercenter/modal/homeCenter_modal.html',
+				controller:'homeModalCtrl'
+			});
+			modalInstance.result.then(function(){
+			}, function(){
+			});
+		};
 		$scope.promptUpdate = function() {
-			console.info($scope.userInfo.pwdEnable);
-			if (!$scope.userInfo.pwdEnable) {
-        toaster.pop("info", "请修改登录密码");
-        return;
+			if (!$scope.userInfo.pwdEnable || !$scope.userInfo.userEmail || !$scope.userInfo.haveUserQuestion) {
+				$scope.openHomeCenterModel();
 			}
-      if (!$scope.userInfo.userEmail) {
-        toaster.pop("info", "请绑定邮箱");
-        return;
-      }
-      if (!$scope.userInfo.haveUserQuestion) {
-        toaster.pop("info",  "请设置密保问题 ");
-        return;
-      }
-		}
+		};
   }]);
+
+	app.controller('homeModalCtrl', ['$rootScope', '$scope',  '$modalInstance', 'toaster', '$http', 'ShippingAddress','$state', function($rootScope, $scope, $modalInstance, toaster, $http, ShippingAddress,$state){
+		$rootScope.$on('$stateChangeStart',
+			function(event, toState, toParams, fromState, fromParams){
+				$modalInstance.dismiss();
+			})
+		$scope.goLink = function(op) {
+			$state.go('vendor_account_management',{op:op});
+			$modalInstance.dismiss('cancel');
+		}
+
+		$scope.cancel = function () {
+			$modalInstance.dismiss('cancel');
+		}
+	}]);
+
 	var getOriginalData = function(data) {
 		var result = {};
 		if(data&&data.length) {