angularjs 用户登录
发布在ZTS-H5疑难杂症2018年1月12日view:583angularjs
在文章任何区域双击击即可给文章添加【评注】!浮到评注点上可以查看详情。
 $rootScope.title = "用户登录";
    $scope.isReset = $routeParams.isReset ? false : true;
    $scope.hasWX = true;


$scope.inputCheck = {
        mobileNo: function(mobileNo) {
            if (mobileNo) {
                mobileNo = mobileNo + "";
                return mobileNo.length == 11;
            }
        },
        loginPwd: function(loginPwd) {
            if (loginPwd && loginPwd.length >= 6) {
                return true;
            }
        }
    };


    $scope.checkMobileNoAndPwd = function() {
        return $scope.inputCheck.mobileNo($scope.mobileNo) && $scope.inputCheck.loginPwd($scope.loginPwd);
    };

    $rootScope.back = function() {
        nativeService.closeH5();
    };

    //登录
    $scope.login = function() {
        if (!$scope.mobileNo || !$scope.loginPwd) {
            return;
        }
        if (!$scope.inputCheck.mobileNo($scope.mobileNo)) {
            $scope.toast = "请输入正确的手机号";
            return;
        }
        if (!$scope.inputCheck.loginPwd($scope.loginPwd)) {
            $scope.toast = "请输入正确的密码格式";
            return;
        }
        nativeService.getH5value("zzId,deviceInfo", function(deviceInfo) {
            userService.passwordLogin($scope.mobileNo, $scope.loginPwd, deviceInfo.zzId, deviceInfo.deviceInfo).success(function(response) {
                if (response.ret_Code == '0') {
                    nativeService.setH5Value({
                        mobile: $scope.mobileNo + "",
                        userCenterToken: response.token
                    });
                    nativeService.noticeLogin(); //通知原生已登录
                    nativeService.noticeLevel2Auth(); //通知原生查询level2权限
                    $scope.toast = '登录成功';
                    $rootScope.delayed(function() {
                        nativeService.closeH5();
                    }, 300);
                } else {
                    if (response.ret_Code == '1020') {
                        //密码错误
                        $rootScope.delayed(function() {
                            if (response.leftRetryTime == '0') {
                                //显示提示日登录密码错误,超过5次
                                $scope.stopLoginAlert = true;
                            } else {
                                //显示提示日登录密码已错误loginCount次
                                $scope.pwdErrorAlert = true;
                                $scope.loginCount = 5 - Number(response.leftRetryTime);
                            }
                        }, 500);
                    } else if (response.ret_Code == '1021') {
                        //超时日登录密码错误5次
                        $rootScope.delayed(function() {
                            //显示提示日登录密码错误,超过5次
                            $scope.stopLoginAlert = true;
                        }, 500);
                    } else if (response.ret_Code == '1005') {
                        $rootScope.delayed(function() {
                            $scope.noRegisterAlert = true;
                        }, 500);
                    } else if (response.ret_Code == '1025') {
                        $rootScope.delayed(function() {
                            $scope.noNoPassowrdAlert = true;
                        }, 500);
                    } else {
                        $scope.toast = response.ret_Msg;
                    }
                }
            });
        });
    };
  1. 啊哈哈哈哈哈啊哈哈哈哈哈啊哈哈哈哈哈啊哈哈哈哈哈
  2. h啊哈哈哈哈哈
  3. 啊哈哈哈哈哈啊哈哈哈哈哈## 哈哈哈 ##

顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶

等等都是

评论
发表评论
5个月前

测试 灌水

WRITTEN BY
爱在心中
java出身,做过管理后台,做过android开发,做过产品狗,目前专注移动前端开发,主要技术angularjs,requirejs,gulp,vue,webpack
TA的新浪微博
PUBLISHED IN

我的收藏