std_reg.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. app.controller('StdRegCtrl', [ '$rootScope', '$scope', '$http', '$timeout', '$state', '$stateParams', function($rootScope, $scope, $http, $timeout, $state, $stateParams) {
  2. $scope.curStep = 'start';
  3. $scope.StdReg = {};
  4. $scope.provinceArray = []; //省
  5. $scope.areaArray = []; //市
  6. $scope.cityArray = []; //县
  7. if(!$rootScope.loginSuccess)
  8. return;
  9. if ($rootScope.ArtStdReg !== undefined) {
  10. $scope.StdReg = angular.extend({}, $rootScope.ArtStdReg);
  11. if ($scope.StdReg.reg_status == 'IdCard') {
  12. $scope.curStep = 'NoCrownPhotoWarning';
  13. } else if ($scope.StdReg.reg_status == 'NoCrownPhoto') {
  14. $scope.curStep = 'StdExtendInfo';
  15. }
  16. }
  17. $rootScope.ajaxRequest({
  18. url : '../enrol/reg/province/list.htm'
  19. }, function(response) {
  20. $scope.provinceArray = response.array;
  21. });
  22. //alert($rootScope.checkParamValue('EnrolVerifyStdIdentity', 'InActive', 'Active'));
  23. // alert($rootScope.getParamValue('EnrolVerifyStdIdentity', 'InActive'));
  24. // console.log($rootScope.FrameParam);
  25. /***************************************************************************
  26. * 选择生源地
  27. */
  28. $scope.chooseProvince = function(p) {
  29. if(p.reg_status == 'InActive') {
  30. var msg = '未开放【'+p.province_name+'】考生注册!';
  31. if(p.reg_fetch_param != undefined)
  32. msg = p.reg_fetch_param;
  33. $.alert(msg);
  34. return;
  35. }
  36. $scope.currentProvince = p;
  37. $scope.StdReg.std_province = p.province_id;
  38. $scope.StdReg.province_name = p.province_name;
  39. if ((p.province_id + '') == '0099') {
  40. // 外国,护照
  41. $scope.curStep = 'PassportWarning';
  42. $scope.StdReg.cert_type = 'Passport';
  43. } else if ((p.province_id + '') == '0071') {
  44. // 台湾,台湾居民往来大陆通行证,澳门,香港 港澳居民来往内地通行证
  45. $scope.curStep = 'IdCard71Warning';
  46. $scope.StdReg.cert_type = 'TaiWanPass';
  47. }else if ((p.province_id + '') == '0081' || (p.province_id + '') == '0082') {
  48. // 澳门,香港 港澳居民来往内地通行证
  49. $scope.curStep = 'HongKongMacaoPass';
  50. $scope.StdReg.cert_type = 'TaiWanPass';
  51. } else {if (p.ksh_status == 'Active') {
  52. // 必须有高考报名号
  53. $scope.curStep = 'ExamIdWarning';
  54. } else {
  55. // 大陆,需要上传身份证
  56. $scope.curStep = 'IdCardWarning';
  57. $scope.StdReg.cert_type = 'IdCard';
  58. }
  59. }
  60. }
  61. $scope.checkExamId = function() {
  62. $scope.StdReg.exam_id = $.trim($scope.StdReg.exam_id);
  63. if ($scope.StdReg.exam_id == undefined || $scope.StdReg.exam_id.length == 0) {
  64. $.alert('高考报名号必须填写!');
  65. return false;
  66. }
  67. $.showLoading("正在提交考生信息,请稍后...")
  68. $rootScope.ajaxRequest({
  69. url : '../enrol/reg/province/check.htm',
  70. data : $scope.StdReg
  71. }, function(response) {
  72. $.hideLoading();
  73. // 大陆,需要上传身份证
  74. $scope.curStep = 'IdCardWarning';
  75. $scope.StdReg.cert_type = 'IdCard';
  76. });
  77. }
  78. /***************************************************************************
  79. * 识别正确,保存用户信息
  80. */
  81. $scope.saveIdCard = function() {
  82. $scope.StdReg.cert_id = $.trim($scope.StdReg.cert_id);
  83. $scope.StdReg.std_name = $.trim($scope.StdReg.std_name);
  84. $scope.StdReg.std_sex = $.trim($scope.StdReg.std_sex);
  85. $scope.StdReg.std_mobile = $.trim($scope.StdReg.std_mobile);
  86. $scope.StdReg.std_province = 61;
  87. $scope.StdReg.cert_type = 'IdCard';
  88. $scope.StdReg.std_birth = $.trim($scope.StdReg.std_birth);
  89. if ($scope.StdReg.cert_id == undefined || $scope.StdReg.cert_id.length == 0) {
  90. $.alert('请输入证件号码信息!');
  91. return false;
  92. }
  93. if ($scope.StdReg.std_name == undefined || $scope.StdReg.std_name.length == 0) {
  94. $.alert('请输入考生姓名信息!');
  95. return false;
  96. }
  97. if ($scope.StdReg.std_sex == undefined || $scope.StdReg.std_sex.length == 0) {
  98. $.alert('请选择考生性别!');
  99. return false;
  100. }
  101. if ($scope.StdReg.std_mobile == undefined || $scope.StdReg.std_mobile.length != 11) {
  102. $.alert('请输入正确的手机号码!');
  103. return false;
  104. }
  105. $.showLoading("正在提交考生信息,请稍后...")
  106. $rootScope.ajaxRequest({
  107. url : '../enrol/reg/save.htm',
  108. data : $scope.StdReg
  109. }, function(response) {
  110. $.hideLoading();
  111. $scope.StdReg = response.entity;
  112. $rootScope.ArtStdReg = $scope.StdReg;
  113. if($scope.StdReg.std_image) {
  114. $scope.curStep = 'StdExtendInfo';
  115. } else {
  116. // 上传免冠证件照
  117. $scope.curStep = 'NoCrownPhotoWarning';
  118. }
  119. });
  120. }
  121. /***************************************************************************
  122. * 完善个人信息
  123. */
  124. $scope.saveExtendInfo = function() {
  125. if(!$scope.checkStdInfo()) {
  126. return;
  127. }
  128. $.showLoading("正在提交考生信息,请稍后...")
  129. $rootScope.ajaxRequest({
  130. url : '../enrol/std/info/fz/save.htm',
  131. data : $scope.StdReg
  132. }, function(response) {
  133. $.hideLoading();
  134. // 显示注册成功
  135. $scope.curStep = 'RegSuccess';
  136. });
  137. }
  138. /********************
  139. * 核验考生信息
  140. */
  141. $scope.checkStdInfo = function() {
  142. if(!$scope.StdReg.std_school) {
  143. $.alert('请输入考生最高学历毕业学校!');
  144. return false;
  145. }
  146. if(!$scope.StdReg.start_date) {
  147. $.alert('请输入毕业学校起始日期!');
  148. return false;
  149. }
  150. if(!$scope.StdReg.end_date) {
  151. $.alert('请输入毕业学校毕业日期!');
  152. return false;
  153. }
  154. if(!$scope.StdReg.std_height) {
  155. $.alert('请输入考生身高!');
  156. return false;
  157. }
  158. if(!$scope.StdReg.std_weight) {
  159. $.alert('请输入考生体重!');
  160. return false;
  161. }
  162. if(!$scope.StdReg.link_mobile) {
  163. $.alert('请输入考生备用手机!');
  164. return false;
  165. }
  166. if(!$scope.StdReg.link_addr) {
  167. $.alert('请输入详细地址!');
  168. return false;
  169. }
  170. if(!$scope.StdReg.link_postal) {
  171. $.alert('请输入邮政编码!');
  172. return false;
  173. }
  174. if(!$scope.StdReg.std_param1) {
  175. $.alert('请选择附初高中!');
  176. return false;
  177. }
  178. if(!$scope.StdReg.std_type) {
  179. $.alert('请选择是否应届生!');
  180. return false;
  181. }
  182. /*if(!$scope.StdReg.school_province_id) {
  183. $.alert('请选择毕业学校所在省!');
  184. return false;
  185. }
  186. if(!$scope.StdReg.school_area_id) {
  187. $.alert('请选择毕业学校所在市!');
  188. return false;
  189. }
  190. if(!$scope.StdReg.school_city_id) {
  191. $.alert('请选择毕业学校所在县!');
  192. return false;
  193. }*/
  194. return true;
  195. }
  196. /***************************************************************************
  197. * 上传免冠证件照
  198. */
  199. $scope.uploadNoCrownPhoto = function() {
  200. $rootScope.uploadStdMaterial('NoCrownPhoto', function() {
  201. // $scope.curStep = 'StdExtendInfo';
  202. //if ($rootScope.checkParamValue('EnrolVerifyStdIdentity', 'InActive', 'Active')) {
  203. // $scope.curStep = 'VerifySuccess';
  204. //} else {
  205. $scope.curStep = 'StdExtendInfo';
  206. //}
  207. });
  208. }
  209. $scope.goStep = function(step) {
  210. $scope.curStep = step;
  211. }
  212. $scope.openIdCard = function() {
  213. wx.chooseImage({
  214. count : 1, // 默认9
  215. sizeType : [ 'compressed' ], // 可以指定是原图还是压缩图,默认二者都有'original',
  216. sourceType : [ 'album', 'camera' ], // 可以指定来源是相册还是相机,默认二者都有
  217. success : function(res) {
  218. var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
  219. wx.uploadImage({
  220. localId : localIds[0], // 需要上传的图片的本地ID,由chooseImage接口获得
  221. isShowProgressTips : 1, // 默认为1,显示进度提示
  222. success : function(serverRes) {
  223. var serverId = serverRes.serverId; // 返回图片的服务器端ID
  224. $.showLoading("证件照片上传中,请稍后...")
  225. // 上传成功,去服务器取图片
  226. /*var url = '../enrol/wx/reg/idcard/' + ($scope.StdReg.std_province < '70' ? '' : 'other/') + 'upload.htm';
  227. if($rootScope.getParamValue('SchoolCode') == '51065' ) {
  228. url = '../enrol/wx/reg/idcard/other/upload.htm';
  229. }*/
  230. var url = '../enrol/wx/reg/idcard/upload.htm';
  231. $rootScope.ajaxRequest({
  232. url : url,
  233. data : {
  234. media_id : serverId
  235. }
  236. }, function(response) {
  237. $.hideLoading();
  238. if($rootScope.getParamValue('SchoolCode') == '51065' ) {
  239. $scope.curStep = 'IdCardOther';
  240. }else {
  241. // if ($scope.StdReg.std_province < '70') {
  242. $scope.StdReg.cert_id = response.map.IdCardInfo.person_code;
  243. $scope.StdReg.std_name = response.map.IdCardInfo.person_name;
  244. $scope.StdReg.std_sex = response.map.IdCardInfo.person_sex;
  245. $scope.StdReg.std_nation = response.map.IdCardInfo.person_nation;
  246. $scope.StdReg.cert_addr = response.map.IdCardInfo.person_addr;
  247. $scope.StdReg.std_birth = $scope.getBirth($scope.StdReg.cert_id);
  248. $scope.curStep = 'IdCardResult';
  249. // } else {
  250. // $scope.curStep = 'IdCardOther';
  251. // }
  252. }
  253. $scope.StdReg.idcard_file_name = response.map.IdCardFileName;
  254. });
  255. },
  256. fail : function(error) {
  257. $.hideLoading();
  258. $.alert('图片服务器暂时无法访问,请稍侯再试', '错误提示');
  259. }
  260. });
  261. }
  262. });
  263. }
  264. //根据身份证获取出生年月日
  265. $scope.getBirth = function(cert_id) {
  266. var birthday = '';
  267. if(cert_id == null || cert_id == undefined ) {
  268. return '';
  269. }
  270. if(cert_id.length == 18) {
  271. birthday = cert_id.substr(6,8);
  272. }
  273. if(cert_id.length == 15) {
  274. birthday = "19"+cert_id.substr(6,6);
  275. }
  276. birthday = birthday.replace(/(.{4})(.{2})/,"$1-$2-");
  277. return birthday;
  278. }
  279. //市
  280. $scope.getAreaArr = function() {
  281. $scope.cityArray = [];
  282. $scope.areaArray = [];
  283. $scope.StdReg.area_id = '';
  284. $scope.StdReg.city_id = '';
  285. $rootScope.ajaxRequest({
  286. url : '../frame/region/area/list.htm',
  287. data :{province_id : $scope.StdReg.province_ids}
  288. }, function(response) {
  289. $scope.areaArray = response.array;
  290. });
  291. }
  292. //县
  293. $scope.getCityArr = function() {
  294. $scope.StdReg.city_id = '';
  295. $rootScope.ajaxRequest({
  296. url : '../frame/region/city/list.htm',
  297. data : {area_id : $scope.StdReg.area_id}
  298. }, function(response) {
  299. $scope.cityArray = response.array;
  300. });
  301. }
  302. //市-毕业学校
  303. $scope.getSchoolAreaArr = function() {
  304. $scope.schoolCityArray = [];
  305. $scope.schoolAreaArray = [];
  306. $scope.StdReg.school_area_id = '';
  307. $scope.StdReg.school_city_id = '';
  308. $rootScope.ajaxRequest({
  309. url : '../frame/region/area/list.htm',
  310. data :{province_id : $scope.StdReg.school_province_id}
  311. }, function(response) {
  312. $scope.schoolAreaArray = response.array;
  313. });
  314. }
  315. //县-毕业学校
  316. $scope.getSchoolCityArr = function() {
  317. $scope.StdReg.school_city_id = '';
  318. $rootScope.ajaxRequest({
  319. url : '../frame/region/city/list.htm',
  320. data : {area_id : $scope.StdReg.school_area_id}
  321. }, function(response) {
  322. $scope.schoolCityArray = response.array;
  323. });
  324. }
  325. } ])