app.controller('WyStdBindingCtrl', [ '$rootScope', '$scope', '$timeout', function($rootScope, $scope, $timeout) {
	$scope.curStep = 'info';
	$scope.StdReg = {};

	if(!$rootScope.loginSuccess)
		return;
	$scope.goStep = function(step) {
		$scope.curStep = step;
	}
	
	$timeout(function() {
		$scope.changeCode('imgCode');
	}, 100);

	$scope.stdBinding = function() {
		$scope.StdReg.exam_id = $.trim($scope.StdReg.exam_id);
		$scope.StdReg.login_pass = $.trim($scope.StdReg.login_pass);
		if ($scope.StdReg.exam_id == undefined || $scope.StdReg.exam_id.length == 0) {
			$.alert('请输入高考报名号!');
			return false;
		}
		if ($scope.StdReg.login_pass == undefined ) {
			$.alert('请输入登录密码!');
			return false;
		}
		$rootScope.ajaxRequest({
			url : '../enrol/wx/reg/wybinding.htm',
			data : $scope.StdReg
		}, function(response) {
			$scope.curStep = 'success';
		});
	}
	
	 $scope.changeCode = function (elementId) {
	     $('#' + elementId).attr('src', '../frame/verification/random.htm?verify=' + Math.random() + '&img_width=120&font_size=30&margin_left=15&font_interval=20&img_height=40&margin_top=25');
	 }
} ])