js 的登录验证

  $scope.startLogin = function () {
            console.log('loginTimeHelper:startLogin: ' + getCurrentTime());
            efetion.CheckNetType();               // 检查内外网络环境
            $scope.mobile = $.trim($scope.mobile);// 获取手机号码
            $scope.password = $.trim($scope.password);// 获取账号密码
            //$rootScope.mobile = $scope.mobile;     
            // 匹配手机号和座机号的正则表达式,还需要重新找一个正则表达式
            var regExp = /1[3,5,8]{1}[0-9]{1}[0-9]{8}|0[0-9]{2,3}-[0-9]{7,8}(-[0-9]{1,4})?/gi;
if (!$scope.mobile) { $scope.errorMsg = "请输入账号"; return; } else if (hasNoNumberCode($scope.mobile)) { $scope.errorMsg = "请输入正确的手机号或固定号码"; return; } if (!$scope.password) { $scope.errorMsg = "请输入密码"; return; } if (!regExp.test($scope.mobile)) { $scope.errorMsg = "请输入正确的手机号或固定号码"; return; }

 

posted @ 2017-04-26 17:42  Lonely,lonelyBurning  阅读(372)  评论(0)    收藏  举报