angular.module("app").controller('StdInfoCtrl', function($rootScope, $scope) {
	// 通用ajax请求
	$scope.std = {
		std_id : $rootScope.GobalStdReg.std_id,
		std_mobile1 : $rootScope.GobalStdReg.std_mobile1,
		std_mobile2 : $rootScope.GobalStdReg.std_mobile2,
		link_addr : $rootScope.GobalStdReg.link_addr
	}

	$scope.changeMobile = function() {
		if (!$rootScope.isMobile($scope.std.std_mobile1)) {
			$rootScope.msg('请输入正确的联系电话(11位手机号)！');
			return;
		}
		if (!$rootScope.isMobile($scope.std.std_mobile2)) {
			$rootScope.msg('请输入正确的备用电话(11位手机号)！');
			return;
		}
		if ($scope.std.std_mobile2 == $scope.std.std_mobile1) {
			$rootScope.msg('备用电话和联系电话必须不一样！');
			return;
		}
		if ($scope.std.link_addr == undefined || $.trim($scope.std.link_addr).length == 0) {
			$rootScope.msg('通信地址不允许为空！');
			return;
		}

		$rootScope.ajaxRequest('../enrol/std/info/save.htm', $scope.std, function() {
			$rootScope.GobalStdReg.std_mobile1 = $scope.std.std_mobile1;
			$rootScope.GobalStdReg.std_mobile2 = $scope.std.std_mobile2;
			$rootScope.GobalStdReg.link_addr = $scope.std.link_addr;
			$rootScope.msg('考生联系信息已经修改！', undefined, function() {
				$rootScope.goUrl('main')
			})
		})

	}
});