123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- app.controller('StdRegCtrl', [ '$rootScope', '$scope', '$http', '$timeout', '$state', '$stateParams', function($rootScope, $scope, $http, $timeout, $state, $stateParams) {
- $scope.curStep = 'start';
- $scope.StdReg = {};
- $scope.provinceArray = []; //省
- $scope.areaArray = []; //市
- $scope.cityArray = []; //县
- if(!$rootScope.loginSuccess)
- return;
- if ($rootScope.ArtStdReg !== undefined) {
- $scope.StdReg = angular.extend({}, $rootScope.ArtStdReg);
- if ($scope.StdReg.reg_status == 'IdCard') {
- $scope.curStep = 'NoCrownPhotoWarning';
- } else if ($scope.StdReg.reg_status == 'NoCrownPhoto') {
- $scope.curStep = 'StdExtendInfo';
- }
- }
- $rootScope.ajaxRequest({
- url : '../enrol/reg/province/list.htm'
- }, function(response) {
- $scope.provinceArray = response.array;
- });
-
- //alert($rootScope.checkParamValue('EnrolVerifyStdIdentity', 'InActive', 'Active'));
- // alert($rootScope.getParamValue('EnrolVerifyStdIdentity', 'InActive'));
- // console.log($rootScope.FrameParam);
- /***************************************************************************
- * 选择生源地
- */
- $scope.chooseProvince = function(p) {
- if(p.reg_status == 'InActive') {
- var msg = '未开放【'+p.province_name+'】考生注册!';
- if(p.reg_fetch_param != undefined)
- msg = p.reg_fetch_param;
- $.alert(msg);
- return;
- }
- $scope.currentProvince = p;
- $scope.StdReg.std_province = p.province_id;
- $scope.StdReg.province_name = p.province_name;
- if ((p.province_id + '') == '0099') {
- // 外国,护照
- $scope.curStep = 'PassportWarning';
- $scope.StdReg.cert_type = 'Passport';
- } else if ((p.province_id + '') == '0071') {
- // 台湾,台湾居民往来大陆通行证,澳门,香港 港澳居民来往内地通行证
- $scope.curStep = 'IdCard71Warning';
- $scope.StdReg.cert_type = 'TaiWanPass';
- }else if ((p.province_id + '') == '0081' || (p.province_id + '') == '0082') {
- // 澳门,香港 港澳居民来往内地通行证
- $scope.curStep = 'HongKongMacaoPass';
- $scope.StdReg.cert_type = 'TaiWanPass';
- } else {if (p.ksh_status == 'Active') {
- // 必须有高考报名号
- $scope.curStep = 'ExamIdWarning';
- } else {
- // 大陆,需要上传身份证
- $scope.curStep = 'IdCardWarning';
- $scope.StdReg.cert_type = 'IdCard';
- }
- }
- }
- $scope.checkExamId = function() {
- $scope.StdReg.exam_id = $.trim($scope.StdReg.exam_id);
- if ($scope.StdReg.exam_id == undefined || $scope.StdReg.exam_id.length == 0) {
- $.alert('高考报名号必须填写!');
- return false;
- }
- $.showLoading("正在提交考生信息,请稍后...")
- $rootScope.ajaxRequest({
- url : '../enrol/reg/province/check.htm',
- data : $scope.StdReg
- }, function(response) {
- $.hideLoading();
- // 大陆,需要上传身份证
- $scope.curStep = 'IdCardWarning';
- $scope.StdReg.cert_type = 'IdCard';
- });
- }
- /***************************************************************************
- * 识别正确,保存用户信息
- */
- $scope.saveIdCard = function() {
- $scope.StdReg.cert_id = $.trim($scope.StdReg.cert_id);
- $scope.StdReg.std_name = $.trim($scope.StdReg.std_name);
- $scope.StdReg.std_sex = $.trim($scope.StdReg.std_sex);
- $scope.StdReg.std_mobile = $.trim($scope.StdReg.std_mobile);
- $scope.StdReg.std_province = 61;
- $scope.StdReg.cert_type = 'IdCard';
- $scope.StdReg.std_birth = $.trim($scope.StdReg.std_birth);
- if ($scope.StdReg.cert_id == undefined || $scope.StdReg.cert_id.length == 0) {
- $.alert('请输入证件号码信息!');
- return false;
- }
- if ($scope.StdReg.std_name == undefined || $scope.StdReg.std_name.length == 0) {
- $.alert('请输入考生姓名信息!');
- return false;
- }
- if ($scope.StdReg.std_sex == undefined || $scope.StdReg.std_sex.length == 0) {
- $.alert('请选择考生性别!');
- return false;
- }
- if ($scope.StdReg.std_mobile == undefined || $scope.StdReg.std_mobile.length != 11) {
- $.alert('请输入正确的手机号码!');
- return false;
- }
- $.showLoading("正在提交考生信息,请稍后...")
- $rootScope.ajaxRequest({
- url : '../enrol/reg/save.htm',
- data : $scope.StdReg
- }, function(response) {
- $.hideLoading();
- $scope.StdReg = response.entity;
- $rootScope.ArtStdReg = $scope.StdReg;
- if($scope.StdReg.std_image) {
- $scope.curStep = 'StdExtendInfo';
- } else {
- // 上传免冠证件照
- $scope.curStep = 'NoCrownPhotoWarning';
- }
-
- });
- }
- /***************************************************************************
- * 完善个人信息
- */
- $scope.saveExtendInfo = function() {
- if(!$scope.checkStdInfo()) {
- return;
- }
- $.showLoading("正在提交考生信息,请稍后...")
- $rootScope.ajaxRequest({
- url : '../enrol/std/info/fz/save.htm',
- data : $scope.StdReg
- }, function(response) {
- $.hideLoading();
- // 显示注册成功
- $scope.curStep = 'RegSuccess';
- });
- }
- /********************
- * 核验考生信息
- */
- $scope.checkStdInfo = function() {
- if(!$scope.StdReg.std_school) {
- $.alert('请输入考生最高学历毕业学校!');
- return false;
- }
- if(!$scope.StdReg.start_date) {
- $.alert('请输入毕业学校起始日期!');
- return false;
- }
- if(!$scope.StdReg.end_date) {
- $.alert('请输入毕业学校毕业日期!');
- return false;
- }
- if(!$scope.StdReg.std_height) {
- $.alert('请输入考生身高!');
- return false;
- }
- if(!$scope.StdReg.std_weight) {
- $.alert('请输入考生体重!');
- return false;
- }
- if(!$scope.StdReg.link_mobile) {
- $.alert('请输入考生备用手机!');
- return false;
- }
- if(!$scope.StdReg.link_addr) {
- $.alert('请输入详细地址!');
- return false;
- }
- if(!$scope.StdReg.link_postal) {
- $.alert('请输入邮政编码!');
- return false;
- }
- if(!$scope.StdReg.std_param1) {
- $.alert('请选择附初高中!');
- return false;
- }
- if(!$scope.StdReg.std_type) {
- $.alert('请选择是否应届生!');
- return false;
- }
- /*if(!$scope.StdReg.school_province_id) {
- $.alert('请选择毕业学校所在省!');
- return false;
- }
- if(!$scope.StdReg.school_area_id) {
- $.alert('请选择毕业学校所在市!');
- return false;
- }
- if(!$scope.StdReg.school_city_id) {
- $.alert('请选择毕业学校所在县!');
- return false;
- }*/
- return true;
- }
- /***************************************************************************
- * 上传免冠证件照
- */
- $scope.uploadNoCrownPhoto = function() {
- $rootScope.uploadStdMaterial('NoCrownPhoto', function() {
- // $scope.curStep = 'StdExtendInfo';
- //if ($rootScope.checkParamValue('EnrolVerifyStdIdentity', 'InActive', 'Active')) {
- // $scope.curStep = 'VerifySuccess';
- //} else {
- $scope.curStep = 'StdExtendInfo';
- //}
- });
- }
- $scope.goStep = function(step) {
- $scope.curStep = step;
- }
- $scope.openIdCard = function() {
- wx.chooseImage({
- count : 1, // 默认9
- sizeType : [ 'compressed' ], // 可以指定是原图还是压缩图,默认二者都有'original',
- sourceType : [ 'album', 'camera' ], // 可以指定来源是相册还是相机,默认二者都有
- success : function(res) {
- var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
- wx.uploadImage({
- localId : localIds[0], // 需要上传的图片的本地ID,由chooseImage接口获得
- isShowProgressTips : 1, // 默认为1,显示进度提示
- success : function(serverRes) {
- var serverId = serverRes.serverId; // 返回图片的服务器端ID
- $.showLoading("证件照片上传中,请稍后...")
- // 上传成功,去服务器取图片
- /*var url = '../enrol/wx/reg/idcard/' + ($scope.StdReg.std_province < '70' ? '' : 'other/') + 'upload.htm';
- if($rootScope.getParamValue('SchoolCode') == '51065' ) {
- url = '../enrol/wx/reg/idcard/other/upload.htm';
- }*/
- var url = '../enrol/wx/reg/idcard/upload.htm';
- $rootScope.ajaxRequest({
- url : url,
- data : {
- media_id : serverId
- }
- }, function(response) {
- $.hideLoading();
- if($rootScope.getParamValue('SchoolCode') == '51065' ) {
- $scope.curStep = 'IdCardOther';
- }else {
- // if ($scope.StdReg.std_province < '70') {
- $scope.StdReg.cert_id = response.map.IdCardInfo.person_code;
- $scope.StdReg.std_name = response.map.IdCardInfo.person_name;
- $scope.StdReg.std_sex = response.map.IdCardInfo.person_sex;
- $scope.StdReg.std_nation = response.map.IdCardInfo.person_nation;
- $scope.StdReg.cert_addr = response.map.IdCardInfo.person_addr;
- $scope.StdReg.std_birth = $scope.getBirth($scope.StdReg.cert_id);
- $scope.curStep = 'IdCardResult';
- // } else {
- // $scope.curStep = 'IdCardOther';
- // }
-
- }
- $scope.StdReg.idcard_file_name = response.map.IdCardFileName;
- });
- },
- fail : function(error) {
- $.hideLoading();
- $.alert('图片服务器暂时无法访问,请稍侯再试', '错误提示');
- }
- });
- }
- });
- }
-
- //根据身份证获取出生年月日
- $scope.getBirth = function(cert_id) {
- var birthday = '';
- if(cert_id == null || cert_id == undefined ) {
- return '';
- }
- if(cert_id.length == 18) {
- birthday = cert_id.substr(6,8);
- }
- if(cert_id.length == 15) {
- birthday = "19"+cert_id.substr(6,6);
- }
- birthday = birthday.replace(/(.{4})(.{2})/,"$1-$2-");
- return birthday;
- }
-
- //市
- $scope.getAreaArr = function() {
- $scope.cityArray = [];
- $scope.areaArray = [];
- $scope.StdReg.area_id = '';
- $scope.StdReg.city_id = '';
- $rootScope.ajaxRequest({
- url : '../frame/region/area/list.htm',
- data :{province_id : $scope.StdReg.province_ids}
- }, function(response) {
- $scope.areaArray = response.array;
- });
- }
-
- //县
- $scope.getCityArr = function() {
- $scope.StdReg.city_id = '';
- $rootScope.ajaxRequest({
- url : '../frame/region/city/list.htm',
- data : {area_id : $scope.StdReg.area_id}
- }, function(response) {
- $scope.cityArray = response.array;
- });
- }
-
-
-
-
- //市-毕业学校
- $scope.getSchoolAreaArr = function() {
- $scope.schoolCityArray = [];
- $scope.schoolAreaArray = [];
- $scope.StdReg.school_area_id = '';
- $scope.StdReg.school_city_id = '';
- $rootScope.ajaxRequest({
- url : '../frame/region/area/list.htm',
- data :{province_id : $scope.StdReg.school_province_id}
- }, function(response) {
- $scope.schoolAreaArray = response.array;
- });
- }
-
- //县-毕业学校
- $scope.getSchoolCityArr = function() {
- $scope.StdReg.school_city_id = '';
- $rootScope.ajaxRequest({
- url : '../frame/region/city/list.htm',
- data : {area_id : $scope.StdReg.school_area_id}
- }, function(response) {
- $scope.schoolCityArray = response.array;
- });
- }
-
-
-
- } ])
|